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 |
|---|---|---|---|---|
18 | // contract owner initiates vote counting and set WorkflowStatus to Votes Tallied/no need for a for loop as winningProposalId was updated live during votin sessio | function countVotes()
public
onlyOwner
checkStatus(state, WorkflowStatus.VotingSessionEnded)
| function countVotes()
public
onlyOwner
checkStatus(state, WorkflowStatus.VotingSessionEnded)
| 4,833 |
62 | // MODIFIED: Only the steward is allowed to transfer | return (spender == steward);
| return (spender == steward);
| 26,056 |
24 | // mapping(uint256 => awardpartner) public awardpartners; | uint256 public totalDeposit;
uint256 public totalAward;
uint256 public minAward = 100 ether;
uint256 public maxAward = 1000 ether;
uint256 public seeResultFee = 1 ether;
uint256[] public seeResultFeePercent = [7000, 3000];
uint256 public totalAwardSystem;
uint256 public totalAwardRanking... | uint256 public totalDeposit;
uint256 public totalAward;
uint256 public minAward = 100 ether;
uint256 public maxAward = 1000 ether;
uint256 public seeResultFee = 1 ether;
uint256[] public seeResultFeePercent = [7000, 3000];
uint256 public totalAwardSystem;
uint256 public totalAwardRanking... | 11,080 |
72 | // Allows the user to get the first value for the requestId before the specified timestamp_requestId is the requestId to look up the value for_timestamp before which to search for first verified value return _ifRetrieve bool true if it is able to retreive a value, the value, and the value's timestamp return _value the ... | function getDataBefore(uint256 _requestId, uint256 _timestamp)
public
returns (bool _ifRetrieve, uint256 _value, uint256 _timestampRetrieved)
| function getDataBefore(uint256 _requestId, uint256 _timestamp)
public
returns (bool _ifRetrieve, uint256 _value, uint256 _timestampRetrieved)
| 22,892 |
23 | // Create a uniswap pair for this new token uniswapV2Pair = IUniswapV2Pair(IUniswapV2Factory(_uniswapV2Router.factory()).getPair(_priceToken,_uniswapV2Router.WETH())); | uniswapV2Router = _uniswapV2Router;
Growth_Value.push(AttackDogLib.GrowthValue(5,3,3));
Growth_Value.push(AttackDogLib.GrowthValue(5,3,3));
Growth_Value.push(AttackDogLib.GrowthValue(3,6,2));
Growth_Value.push(AttackDogLib.GrowthValue(3,5,4));
Growth_Value.push(AttackDogL... | uniswapV2Router = _uniswapV2Router;
Growth_Value.push(AttackDogLib.GrowthValue(5,3,3));
Growth_Value.push(AttackDogLib.GrowthValue(5,3,3));
Growth_Value.push(AttackDogLib.GrowthValue(3,6,2));
Growth_Value.push(AttackDogLib.GrowthValue(3,5,4));
Growth_Value.push(AttackDogL... | 13,663 |
12 | // etherfund.me fee wallet | address public feeReceiverWallet;
| address public feeReceiverWallet;
| 50,298 |
211 | // ------------------------------------------------------------------------------------------------/ Interface for ECR_MGRINHERITANCE: / | interface ECR_MGR_Interface {
/*
* @dev Set an asset to escrow status (6/50/56). Sets timelock for unix timestamp of escrow end.
*/
function setEscrow(
bytes32 _idxHash,
uint8 _newAssetStatus,
bytes32 _escrowOwnerAddressHash,
uint256 _timelock
) external;
/*
... | interface ECR_MGR_Interface {
/*
* @dev Set an asset to escrow status (6/50/56). Sets timelock for unix timestamp of escrow end.
*/
function setEscrow(
bytes32 _idxHash,
uint8 _newAssetStatus,
bytes32 _escrowOwnerAddressHash,
uint256 _timelock
) external;
/*
... | 62,767 |
18 | // track the deposit on the ledger this could revert for a few reasons: - the key is not root - the vault is not a trusted collateral provider the ledger | (,,uint256 finalLedgerBalance) = ledger.deposit(keyId, tokenArn, amount);
| (,,uint256 finalLedgerBalance) = ledger.deposit(keyId, tokenArn, amount);
| 15,406 |
46 | // Attempt to send them to funds | uint256 funds = abandonedIcoBalances[msg.sender];
abandonedIcoBalances[msg.sender] = 0;
if (!msg.sender.send(funds))
throw;
| uint256 funds = abandonedIcoBalances[msg.sender];
abandonedIcoBalances[msg.sender] = 0;
if (!msg.sender.send(funds))
throw;
| 11,551 |
15 | // Set the token URI descriptor. Only callable by the owner when not locked. / | function setDescriptor(IGorfDescriptor _descriptor) external onlyOwner whenDescriptorNotLocked {
descriptor = _descriptor;
}
| function setDescriptor(IGorfDescriptor _descriptor) external onlyOwner whenDescriptorNotLocked {
descriptor = _descriptor;
}
| 61,297 |
46 | // Send seller the proceeds. | if (!msg.sender.send(safeSub(transactionWeiAmountNoFee, currentTakeFee))) {
revert();
}
| if (!msg.sender.send(safeSub(transactionWeiAmountNoFee, currentTakeFee))) {
revert();
}
| 45,278 |
31 | // Cumulative amount of Wei credited to an account, since the contract's deployment | mapping(address => uint256) public scaledDividendCreditedTo;
| mapping(address => uint256) public scaledDividendCreditedTo;
| 78,019 |
255 | // ----VIEWS |
function networkOpened(uint chainId) external view returns (bool);
function accountOutboundings(
address account,
uint periodId,
uint index
) external view returns (uint);
function accountInboundings(address account, uint index) external view returns (uint);
|
function networkOpened(uint chainId) external view returns (bool);
function accountOutboundings(
address account,
uint periodId,
uint index
) external view returns (uint);
function accountInboundings(address account, uint index) external view returns (uint);
| 15,992 |
112 | // Pay referral fee to the referrer, if any. | function payReferralFee(address _user, uint _pending) internal {
if (referralFeeBP > 0) {
address referrer = userReferrer[_user];
if (referrer != address(0) && referrer != 0x000000000000000000000000000000000000dEaD) {
uint referralFee = _pending.mul(referralFeeBP).div... | function payReferralFee(address _user, uint _pending) internal {
if (referralFeeBP > 0) {
address referrer = userReferrer[_user];
if (referrer != address(0) && referrer != 0x000000000000000000000000000000000000dEaD) {
uint referralFee = _pending.mul(referralFeeBP).div... | 27,390 |
65 | // Permissionless pool actions/Contains pool methods that can be called by anyone | interface IUniswapV3PoolActions {
/// @notice Sets the initial price for the pool
/// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value
/// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96
function initialize(uint160 sqrtPriceX96) external;
/// @notice Ad... | interface IUniswapV3PoolActions {
/// @notice Sets the initial price for the pool
/// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value
/// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96
function initialize(uint160 sqrtPriceX96) external;
/// @notice Ad... | 3,612 |
24 | // Current fallback withdrawal root / | bytes32 public fallbackRoot;
| bytes32 public fallbackRoot;
| 41,815 |
346 | // we want to revert if we can't liquidateall | if(!forceMigrate) {
require(position < minWant);
}
| if(!forceMigrate) {
require(position < minWant);
}
| 5,136 |
15 | // Allows the Lock owner to extend an existing keys with no charge. _tokenId The id of the token to extend _duration The duration in secondes to add ot the key set `_duration` to 0 to use the default duration of the lock / | function grantKeyExtension(uint _tokenId, uint _duration) external;
| function grantKeyExtension(uint _tokenId, uint _duration) external;
| 11,189 |
104 | // Pay the caller for relaying the rate | rewardCaller(feeReceiver, callerReward);
| rewardCaller(feeReceiver, callerReward);
| 31,576 |
219 | // Transfer a child token from an ERC721 contract to a composable. Used for old tokens that does nothave a safeTransferFrom method like cryptokitties This contract has to be approved first in _childContract _from The address that owns the child token. _tokenId The token that becomes the parent owner _childContract The ... | function _getChild(
address _from,
uint256 _tokenId,
address _childContract,
uint256 _childTokenId
| function _getChild(
address _from,
uint256 _tokenId,
address _childContract,
uint256 _childTokenId
| 60,586 |
109 | // Current number of votes for abstaining for this proposal | uint abstainVotes;
| uint abstainVotes;
| 7,399 |
32 | // Adds new token to list of valid tokenstoken address of token contract to add to listtokenNum uint128 index of a token to add/ | function addToken(address token, uint128 tokenNum) external onlyOwner {
numsTokens.set(tokenNum, token);
}
| function addToken(address token, uint128 tokenNum) external onlyOwner {
numsTokens.set(tokenNum, token);
}
| 46,059 |
19 | // Init first node. ownerAddress Address of person who is top referrer. / | function init(address ownerAddress) onlyOwner public{
require(lastUserId == 0, "Contract has already been initialized");
users[ownerAddress] = User(
++lastUserId,
address(0),
new address[](0)
);
addressById[lastUserId] = ownerAddress;
... | function init(address ownerAddress) onlyOwner public{
require(lastUserId == 0, "Contract has already been initialized");
users[ownerAddress] = User(
++lastUserId,
address(0),
new address[](0)
);
addressById[lastUserId] = ownerAddress;
... | 17,702 |
147 | // No conversion is needed as the pool token has 18 decimals | IERC20(poolToken).safeTransferFrom(msg.sender, feeRecipient, feeAmount);
| IERC20(poolToken).safeTransferFrom(msg.sender, feeRecipient, feeAmount);
| 53,116 |
221 | // timestamp setter/_preSaleStartTs timestamp that designates the start of presale phase/_preSaleEndTs timestamp that designates the end of presale phase/_publicSaleStartTs timestamp that designates the start of public sale phase/_publicSaleEndTs timestamp that designates the end of public sale phase | function setDates(
uint256 _preSaleStartTs,
uint256 _preSaleEndTs,
uint256 _publicSaleStartTs,
uint256 _publicSaleEndTs
| function setDates(
uint256 _preSaleStartTs,
uint256 _preSaleEndTs,
uint256 _publicSaleStartTs,
uint256 _publicSaleEndTs
| 18,961 |
80 | // Contract implements Chainlink's Upkeep system interface, automating the upkeep of a registry of Pod contracts | contract PodsUpkeep is KeeperCompatibleInterface, Ownable {
using SafeMathUpgradeable for uint256;
/// @notice Address of the registry of pods contract which require upkeep
AddressRegistry public podsRegistry;
/// @dev Fixed length of the last upkeep block number (multiple this by 8 to get the ma... | contract PodsUpkeep is KeeperCompatibleInterface, Ownable {
using SafeMathUpgradeable for uint256;
/// @notice Address of the registry of pods contract which require upkeep
AddressRegistry public podsRegistry;
/// @dev Fixed length of the last upkeep block number (multiple this by 8 to get the ma... | 9,524 |
151 | // Returns the owner of the `tokenId` token. Requirements: - `tokenId` must exist. / | function ownerOf(uint256 tokenId) external view returns (address owner);
| function ownerOf(uint256 tokenId) external view returns (address owner);
| 343 |
7 | // Calculate the service fee for provider according to the performance per day and SLA penalties | uint earningsProviderSinceLastUpdate = costPerDay * availabilityData.length * providerPenalty / 100;
withdrawableForProvider += earningsProviderSinceLastUpdate;
| uint earningsProviderSinceLastUpdate = costPerDay * availabilityData.length * providerPenalty / 100;
withdrawableForProvider += earningsProviderSinceLastUpdate;
| 18,059 |
0 | // user A | address payable private _userA;
bool private _choiceA;
| address payable private _userA;
bool private _choiceA;
| 10,324 |
14 | // scan the burn outputs and return the value and script data of first burned output. | function scanBurns(bytes memory txBytes, uint pos) private pure
returns (uint, address, uint32, uint8, address)
| function scanBurns(bytes memory txBytes, uint pos) private pure
returns (uint, address, uint32, uint8, address)
| 19,733 |
112 | // matrix marked -- start creating route from base token back to target | uint8 baseIdx = 0;
for (uint8 i = 0; i < pools.length; i++) {
if (
address(pools[i].tokens(1)) == _base ||
address(pools[i].tokens(0)) == _base
) {
if (baseIdx == 0 || baseIdx > pairIdx[i]) {
| uint8 baseIdx = 0;
for (uint8 i = 0; i < pools.length; i++) {
if (
address(pools[i].tokens(1)) == _base ||
address(pools[i].tokens(0)) == _base
) {
if (baseIdx == 0 || baseIdx > pairIdx[i]) {
| 52,832 |
10 | // Transfers Tangle from one holder to another, may implement a/ variable number of taxes and may modify the amount transferred. Can be/ initiated by an approved 3rd party/Modifies the value transferred according to the pre and tax/ Transformers, which are implementation./_from The address Tangle will be sent from/_to ... | function transferFrom(address _from, address _to, uint value)
external
returns
| function transferFrom(address _from, address _to, uint value)
external
returns
| 3,834 |
331 | // just for trace and debug (not use ) ; | require(nftContract.ownerOf(tokenId) == newOwner , "new Owner is not correct in main nft contract; Use ownerOf Method for get correct owner" );
MarketGameAssets[tokenId].owner = newOwner;
| require(nftContract.ownerOf(tokenId) == newOwner , "new Owner is not correct in main nft contract; Use ownerOf Method for get correct owner" );
MarketGameAssets[tokenId].owner = newOwner;
| 4,202 |
2 | // The caller cannot approve to their own address. / | error ApproveToCaller();
| error ApproveToCaller();
| 27,033 |
19 | // Events broadcast to ledger as public but anonymous receipt, if needs be. see notes to detect Events on Hedera. more to add |
event Profilecreated(
address smartcontractid
);
event Profileupdated(
address plantaccountfileid
);
|
event Profilecreated(
address smartcontractid
);
event Profileupdated(
address plantaccountfileid
);
| 43,039 |
32 | // Revert if the new royalty address is the zero address. | if (newInfo.royaltyAddress == address(0)) {
revert RoyaltyAddressCannotBeZeroAddress();
}
| if (newInfo.royaltyAddress == address(0)) {
revert RoyaltyAddressCannotBeZeroAddress();
}
| 12,560 |
9 | // Returns the total supply of token of type `id`./ This is the amount of token of type `id` minted minus the amount burned. id The token id.return The total supply of that token id. / | function totalSupply(uint256 id) public view virtual override returns (uint256) {
return _totalSupplies[id];
}
| function totalSupply(uint256 id) public view virtual override returns (uint256) {
return _totalSupplies[id];
}
| 12,882 |
77 | // action of claiming funds | function claimDividends(address account) external updateAccount(account) returns (uint256) {
uint256 owing = dividendsOwing(account);
return owing;
}
| function claimDividends(address account) external updateAccount(account) returns (uint256) {
uint256 owing = dividendsOwing(account);
return owing;
}
| 29,924 |
189 | // Admin minting to use for giveaways, collabs, and so on... | function claimReserved(address recipient, uint256 amount) external onlyOwner {
require(reservedClaimed != reserved, "All reserved Babyccinos have been claimed");
require(reservedClaimed + amount <= reserved, "Minting would exceed max reserved Babyccinos");
require(recipient != address(0), "C... | function claimReserved(address recipient, uint256 amount) external onlyOwner {
require(reservedClaimed != reserved, "All reserved Babyccinos have been claimed");
require(reservedClaimed + amount <= reserved, "Minting would exceed max reserved Babyccinos");
require(recipient != address(0), "C... | 66,658 |
49 | // See {ICreatorExtensionTokenURI-tokenURI}. / | function tokenURI(address creatorContractAddress, uint256 tokenId) external override view returns(string memory uri) {
uint224 tokenClaim = uint224(_claimTokenIds[creatorContractAddress][tokenId]);
require(tokenClaim > 0, "Token does not exist");
Claim memory claim = _claims[creatorContractA... | function tokenURI(address creatorContractAddress, uint256 tokenId) external override view returns(string memory uri) {
uint224 tokenClaim = uint224(_claimTokenIds[creatorContractAddress][tokenId]);
require(tokenClaim > 0, "Token does not exist");
Claim memory claim = _claims[creatorContractA... | 20,860 |
764 | // increase new representative | uint32 dstRepNum = numCheckpoints[dstRep];
uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint256 dstRepNew = dstRepOld.add(amount);
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
| uint32 dstRepNum = numCheckpoints[dstRep];
uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint256 dstRepNew = dstRepOld.add(amount);
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
| 38,554 |
2 | // the escrow contract backing this Line | function escrow() external returns (IEscrow);
| function escrow() external returns (IEscrow);
| 37,705 |
193 | // View function to see pending SWHs on frontend. | function pendingSandwich(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accSandwichPerShare = pool.accSandwichPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(thi... | function pendingSandwich(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accSandwichPerShare = pool.accSandwichPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(thi... | 40,894 |
275 | // We don't want to reset possible _allowListClaimed numbers. | _allowList[addresses[i]] = false;
| _allowList[addresses[i]] = false;
| 45,288 |
9 | // stake amount of a user at the end of this reward period;if a user doesn't stake/unstake in a reward period,this value will remain 0 (and hasSetStakeAmount will be false)if hasNewStakeAmount is false it means the donorStakeAmountis the same as the last reward period where hasSetStakeAmount is true | mapping(address => uint256) donorStakeAmounts;
| mapping(address => uint256) donorStakeAmounts;
| 23,661 |
3 | // smash piggy == ragequit | function smashPiggy() public {
require(owner == msg.sender, "Only Owner can smash piggy!");
owner.transfer(address(this).balance);
}
| function smashPiggy() public {
require(owner == msg.sender, "Only Owner can smash piggy!");
owner.transfer(address(this).balance);
}
| 17,051 |
1 | // Indicator that this is a BController contract (for inspection) | bool public constant isBController = true;
| bool public constant isBController = true;
| 6,226 |
7 | // MERKLE ROOTS / | bytes32 public merkleRoot = "";
| bytes32 public merkleRoot = "";
| 40,490 |
19 | // Balances for each account | mapping(address => uint256) balances;
| mapping(address => uint256) balances;
| 28,901 |
106 | // recalculate rewardPerBlock | updateRewardPerBlock(UpdateRewardType.UpdateEndOp);
emit UpdateEndBlock(_endBlock);
| updateRewardPerBlock(UpdateRewardType.UpdateEndOp);
emit UpdateEndBlock(_endBlock);
| 22,518 |
8 | // Registers a plugin repository with a subdomain and address./subdomain The subdomain of the PluginRepo./pluginRepo The address of the PluginRepo contract. | function registerPluginRepo(
string calldata subdomain,
address pluginRepo
| function registerPluginRepo(
string calldata subdomain,
address pluginRepo
| 13,335 |
141 | // Add adapters to a list of adapters passed in | function add_adapter(address adapter_address) external override {
require(msg.sender == governance, "add_adapter: must be governance");
adapter_indexes[adapter_address] = adapters.length;
adapters.push(adapter_address);
}
| function add_adapter(address adapter_address) external override {
require(msg.sender == governance, "add_adapter: must be governance");
adapter_indexes[adapter_address] = adapters.length;
adapters.push(adapter_address);
}
| 9,287 |
47 | // 确认必须由旧国库合约调用 | require(msg.sender == legacyTreasury, 'Treasury: on legacy treasury');
| require(msg.sender == legacyTreasury, 'Treasury: on legacy treasury');
| 42,928 |
46 | // Recheck if src/dest amount correct Source | if (etherERC20 == _src) {
assert(address(this).balance == srcAmountBefore.sub(_srcAmount));
} else {
| if (etherERC20 == _src) {
assert(address(this).balance == srcAmountBefore.sub(_srcAmount));
} else {
| 36,694 |
4 | // Define a public mapping 'itemsHistory' that maps the UPC to an array of TxHash, that track its journey through the supply chain -- to be sent from DApp. | mapping (uint => Txblocks) itemsHistory;
| mapping (uint => Txblocks) itemsHistory;
| 13,686 |
113 | // Override fromERC20: We don't allow the users to transfer their wrapped tokens directlyThe tokens must be transffered to or from a signer, not between normal usersONLY the TransferProxy can call this - a safeguard as it already has the exclusive right to be given allowances._from as per ERC20_to as per ERC20_value as... | function transferFrom(address _from, address _to, uint _value) public returns (bool) {
require(isSigner[_to] || isSigner[_from]);
assert(msg.sender == TRANSFER_PROXY_V2);
depositLock[_to] = depositLock[_to] > now ? depositLock[_to] : now + 1 hours;
// Take the corresponding pie from ... | function transferFrom(address _from, address _to, uint _value) public returns (bool) {
require(isSigner[_to] || isSigner[_from]);
assert(msg.sender == TRANSFER_PROXY_V2);
depositLock[_to] = depositLock[_to] > now ? depositLock[_to] : now + 1 hours;
// Take the corresponding pie from ... | 43,281 |
5 | // The following functions are overrides required by Solidity. |
function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal
override(ERC721, ERC721Enumerable)
|
function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal
override(ERC721, ERC721Enumerable)
| 41,137 |
48 | // bytes4(keccak256(bytes("transferFrom(address,address,uint256)"))); | (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), "TH:STF");
| (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), "TH:STF");
| 11,903 |
12 | // Trigger rollback using upgradeTo from the new implementation | rollbackTesting.value = true;
Address.functionDelegateCall(
newImplementation,
abi.encodeWithSignature("upgradeTo(address)", oldImplementation)
);
rollbackTesting.value = false;
| rollbackTesting.value = true;
Address.functionDelegateCall(
newImplementation,
abi.encodeWithSignature("upgradeTo(address)", oldImplementation)
);
rollbackTesting.value = false;
| 921 |
35 | // File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol/ Implementation of the `IERC20` interface. This implementation is agnostic to the way tokens are created. This meansthat a supply mechanism has to be added in a derived contract using `_mint`.For a generic mechanism see `ERC20Mintable`. For a detailed write... | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev Forced transfer from one account to another. Will contain details about AML ... | contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev Forced transfer from one account to another. Will contain details about AML ... | 16,450 |
107 | // returns amount of authorized capital represented by all pools | function getAuthorizedCapital() public constant returns (uint256) {
return calculateAuthorizedCapital(_totalPoolOptions + _totalExtraOptions + _totalBonusOptions);
}
| function getAuthorizedCapital() public constant returns (uint256) {
return calculateAuthorizedCapital(_totalPoolOptions + _totalExtraOptions + _totalBonusOptions);
}
| 44,186 |
57 | // get the address of a random Fed Ape with that alpha score | return dea[i][seed % dea[i].length].owner;
| return dea[i][seed % dea[i].length].owner;
| 3,296 |
44 | // Transaction removeSupplyItem - Remove Supply Item by ID. itemId = Valid Supply Item IDreturn boolean transaction success Must be Supply Node owner or operator, Item may not have active Supply Steps. / | function removeSupplyItem (uint256 itemId) public returns(bool) {
//Check
require (_itemNode[itemId] == 0 || _itemFile[itemId].size != 0, "Invalid item.");
require (_itemStep[itemId] == 0, "Cannot remove item with active steps.");
uint256 nodeId = _itemNode[itemId];
require (... | function removeSupplyItem (uint256 itemId) public returns(bool) {
//Check
require (_itemNode[itemId] == 0 || _itemFile[itemId].size != 0, "Invalid item.");
require (_itemStep[itemId] == 0, "Cannot remove item with active steps.");
uint256 nodeId = _itemNode[itemId];
require (... | 34,275 |
186 | // Weighted average gasprice / | uint256 public constant gasPrice = 10 * 10**9;
| uint256 public constant gasPrice = 10 * 10**9;
| 54,341 |
154 | // Internal function to set allowance owner Token owner's address spender Spender's address value Allowance amount / | function _approve(
address owner,
address spender,
uint256 value
| function _approve(
address owner,
address spender,
uint256 value
| 10,974 |
8 | // Create clone of the template using a nonce./ The nonce is unique for clones with the same initialization calldata./ The nonce can be used to determine the address of the clone before creation./ The callData must be prepended by the function selector of the template's initialize function and include all parameters./c... | function create(bytes memory callData) public returns (address instance) {
// deploy new contract: initialize it & write minimal proxy to runtime.
instance = Spawner._spawn(msg.sender, getTemplate(), callData);
_createHelper(instance, callData);
return instance;
}
| function create(bytes memory callData) public returns (address instance) {
// deploy new contract: initialize it & write minimal proxy to runtime.
instance = Spawner._spawn(msg.sender, getTemplate(), callData);
_createHelper(instance, callData);
return instance;
}
| 45,849 |
1 | // init supply 2 billion | mint(_msgSender(), 2000000000000000000000000000);
| mint(_msgSender(), 2000000000000000000000000000);
| 57,126 |
22 | // performs chained getAmountIn calculations on any number of pairs | function getAmountsIn( uint amountOut, address[] memory path) internal returns (uint[] memory amounts) {
require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
amounts = new uint[](path.length);
amounts[amounts.length - 1] = amountOut;
for (uint i = path.length - 1; i > 0; i--... | function getAmountsIn( uint amountOut, address[] memory path) internal returns (uint[] memory amounts) {
require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
amounts = new uint[](path.length);
amounts[amounts.length - 1] = amountOut;
for (uint i = path.length - 1; i > 0; i--... | 5,629 |
9 | // Burns liquidity stated, amount0Min and amount1Min are the least you get for burning that liquidity (else reverted),/ return amount0 returns how much tokens were added to tokensOwed on position | function _uniWithdraw(Params memory _uniData)
internal
returns (
uint256 amount0,
uint256 amount1
)
| function _uniWithdraw(Params memory _uniData)
internal
returns (
uint256 amount0,
uint256 amount1
)
| 20,791 |
71 | // Benefits in function of his total supply Is important winners balance doesnt reduce, as is frozen during clear. | uint _benefits = winnersBalance.mul(_winnerTokens.length).div(frozenTotalWinnersSupply);
winnersBalanceRedeemed = winnersBalanceRedeemed.add(_benefits); // Keep track
| uint _benefits = winnersBalance.mul(_winnerTokens.length).div(frozenTotalWinnersSupply);
winnersBalanceRedeemed = winnersBalanceRedeemed.add(_benefits); // Keep track
| 23,293 |
39 | // main logic | uint profits;
uint amountToRepay;
if (ethAfterSwap > tokenBorrowBalance[user]) {
profits = ethAfterSwap - tokenBorrowBalance[user];
amountToRepay = tokenBorrowBalance[user];
tokenBorrowBalance[user] = 0;
| uint profits;
uint amountToRepay;
if (ethAfterSwap > tokenBorrowBalance[user]) {
profits = ethAfterSwap - tokenBorrowBalance[user];
amountToRepay = tokenBorrowBalance[user];
tokenBorrowBalance[user] = 0;
| 2,411 |
30 | // curr_order added at the end | if (curr_order.next == best_order) {
best_order = curr_order.id;
| if (curr_order.next == best_order) {
best_order = curr_order.id;
| 4,770 |
6 | // Delegate governance power : AAVE version | IGovernancePowerDelegationToken govToken = IGovernancePowerDelegationToken(underlying);
govToken.delegate(_delegatee);
return true;
| IGovernancePowerDelegationToken govToken = IGovernancePowerDelegationToken(underlying);
govToken.delegate(_delegatee);
return true;
| 51,327 |
69 | // selling handler | else if (recipient == pair) {
require(amount <= maxSellAmount, "TX Limit Exceeded");
setSellFee();
}
| else if (recipient == pair) {
require(amount <= maxSellAmount, "TX Limit Exceeded");
setSellFee();
}
| 28,063 |
212 | // User requests are possible when the exchange is not in maintenance mode, the exchange hasn't been shutdown, and the exchange isn't in withdrawal mode | return !isInMaintenance(S) && !isShutdown(S) && !isInWithdrawalMode(S);
| return !isInMaintenance(S) && !isShutdown(S) && !isInWithdrawalMode(S);
| 26,413 |
28 | // uint128 tokensOwed1 | ) = rainiLpNFT.positions(_tokenId);
require(tickUpper > minTickUpper, "RainiLpv3StakingPool: tickUpper too low");
require(tickLower < maxTickLower, "RainiLpv3StakingPool: tickLower too high");
require((token0 == exchangeTokenAddress && token1 == address(rainiToken)) ||
(token1 ==... | ) = rainiLpNFT.positions(_tokenId);
require(tickUpper > minTickUpper, "RainiLpv3StakingPool: tickUpper too low");
require(tickLower < maxTickLower, "RainiLpv3StakingPool: tickLower too high");
require((token0 == exchangeTokenAddress && token1 == address(rainiToken)) ||
(token1 ==... | 15,276 |
129 | // return Computes the total supply adjustment in response to the exchange rateand the targetRate. / | function computeSupplyDelta(uint256 rate, uint256 targetRate)
private
view
returns (int256)
| function computeSupplyDelta(uint256 rate, uint256 targetRate)
private
view
returns (int256)
| 35,641 |
10 | // Cannot be longer than 25 characters | if (b[0] == 0x20) return false;
| if (b[0] == 0x20) return false;
| 14,969 |
75 | // Implementation of the ERC20Mintable. Extension of {ERC20} that adds a minting behaviour. indicates if minting is finished | bool private _mintingFinished = false;
| bool private _mintingFinished = false;
| 13,347 |
97 | // make sure clerk doesnt exist already | require(item.id != _id);
| require(item.id != _id);
| 45,800 |
93 | // stake visibility is public as overriding LPTokenWrapper's stake() functionRecieves users LP tokens and deposits them to Masterchef contract | function stake(uint256 amount) override public updateReward(msg.sender) {
require(amount > 0, "Cannot stake 0");
super.stake(amount);
lpToken.approve(address(masterChef), amount);
masterChef.deposit(pid, amount);
emit Staked(msg.sender, amount);
}
| function stake(uint256 amount) override public updateReward(msg.sender) {
require(amount > 0, "Cannot stake 0");
super.stake(amount);
lpToken.approve(address(masterChef), amount);
masterChef.deposit(pid, amount);
emit Staked(msg.sender, amount);
}
| 12,378 |
29 | // lab.accreditation = _accreditation; Service Offeringlab.certification = _certification;lab.consulting = _consulting;lab.testing = _testing;lab.manufacturing = _manufacturing;lab.rNd = _rNd;lab.inspection = _inspection;lab.whiteLab = _whiteLab;lab.otherService = _otherService;Company address | lab.address1 = _address1;
| lab.address1 = _address1;
| 30,110 |
18 | // Start stream | ISuperfluid(_host).callAgreement(
_cfa,
abi.encodeWithSelector(
IConstantFlowAgreementV1(_cfa).createFlow.selector,
_daix, // daix or whatever token being streamed, if this doesn't work use ISuperToken type
msg.sender, // plain address
... | ISuperfluid(_host).callAgreement(
_cfa,
abi.encodeWithSelector(
IConstantFlowAgreementV1(_cfa).createFlow.selector,
_daix, // daix or whatever token being streamed, if this doesn't work use ISuperToken type
msg.sender, // plain address
... | 48,934 |
116 | // Swap half earned to token1 | IPancakeRouter02(uniRouterAddress).swapExactTokensForTokensSupportingFeeOnTransferTokens(earnedAmt.div(2), 0, paths[earnedAddress][token1Address], address(this), now + 60);
| IPancakeRouter02(uniRouterAddress).swapExactTokensForTokensSupportingFeeOnTransferTokens(earnedAmt.div(2), 0, paths[earnedAddress][token1Address], address(this), now + 60);
| 15,624 |
17 | // Attempts to execute the `permit` function on the provided token with the sender and contract as parameters.Permit type is determined automatically based on permit calldata (IERC20Permit, IDaiLikePermit, and IPermit2). Wraps `tryPermit` function and forwards revert reason if permit fails. token The IERC20 token to ex... | function safePermit(IERC20 token, bytes calldata permit) internal {
if (!tryPermit(token, msg.sender, address(this), permit)) RevertReasonForwarder.reRevert();
}
| function safePermit(IERC20 token, bytes calldata permit) internal {
if (!tryPermit(token, msg.sender, address(this), permit)) RevertReasonForwarder.reRevert();
}
| 25,933 |
12 | // Emit a MinterAdminAdded event for each account that doesn't already have access to the role | for (uint256 i = 0; i < accounts.length; i++) {
if (!_minterAdmins.has(accounts[i])) {
emit MinterAdminAdded(accounts[i]);
}
| for (uint256 i = 0; i < accounts.length; i++) {
if (!_minterAdmins.has(accounts[i])) {
emit MinterAdminAdded(accounts[i]);
}
| 32,483 |
23 | // Make the swap | uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // Accept any amount of ETH; ignore slippage
path,
taxWallet,
block.timestamp
);
| uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // Accept any amount of ETH; ignore slippage
path,
taxWallet,
block.timestamp
);
| 6,711 |
7 | // Used to compute purchase price | uint prevPeriod;
uint currPeriod;
uint256 price; // in units of ether
| uint prevPeriod;
uint currPeriod;
uint256 price; // in units of ether
| 35,257 |
180 | // GETTERS / | function _baseURI() internal view virtual override returns (string memory) {
return BASE_URI;
}
| function _baseURI() internal view virtual override returns (string memory) {
return BASE_URI;
}
| 54,704 |
15 | // ETH | function withdrawEth(uint _amount) public onlyOwner payable{
require(createAddress == msg.sender, "author no");
msg.sender.transfer(_amount);
}
| function withdrawEth(uint _amount) public onlyOwner payable{
require(createAddress == msg.sender, "author no");
msg.sender.transfer(_amount);
}
| 40,672 |
0 | // Add two uint256 values, throw in case of overflow.x first value to add y second value to addreturn x + y / | function safeAdd (uint256 x, uint256 y)
pure internal
| function safeAdd (uint256 x, uint256 y)
pure internal
| 14,053 |
37 | // Get a deterministics vault./ | function getVault(bytes32 _key) internal view returns (address) {
bytes32 public constant vaultCodeHash = bytes32(0xfa3da1081bc86587310fce8f3a5309785fc567b9b20875900cb289302d6bfa97);
return address(
uint256(
keccak256(
abi.encodePacked(
... | function getVault(bytes32 _key) internal view returns (address) {
bytes32 public constant vaultCodeHash = bytes32(0xfa3da1081bc86587310fce8f3a5309785fc567b9b20875900cb289302d6bfa97);
return address(
uint256(
keccak256(
abi.encodePacked(
... | 51,988 |
320 | // Tries to returns the value associated with `key`.O(1).Does not revert if `key` is not in the map. _Available since v3.4._ / | function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) {
(bool success, bytes32 value) = _tryGet(map._inner, bytes32(key));
return (success, address(uint160(uint256(value))));
}
| function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) {
(bool success, bytes32 value) = _tryGet(map._inner, bytes32(key));
return (success, address(uint160(uint256(value))));
}
| 32,426 |
81 | // Return all kings | function player_getKingsAll() public view returns (address[] _kings) {
uint256 kingsLength = continentKing.length;
address[] memory kings = new address[](kingsLength);
uint256 kingsCounter = 0;
for (uint256 i = 0; i < kingsLength; i++) {
kings[kingsCounter] = continentKing[i];
kingsCounter++; ... | function player_getKingsAll() public view returns (address[] _kings) {
uint256 kingsLength = continentKing.length;
address[] memory kings = new address[](kingsLength);
uint256 kingsCounter = 0;
for (uint256 i = 0; i < kingsLength; i++) {
kings[kingsCounter] = continentKing[i];
kingsCounter++; ... | 37,563 |
11 | // this is the situation when _owners normalized | uint256 id = tokenId;
if (_owners[id] != address(0)) {
return _owners[id];
}
| uint256 id = tokenId;
if (_owners[id] != address(0)) {
return _owners[id];
}
| 36,720 |
165 | // keepCRV stuff | uint256 public keepCRV = 1000; // the percentage of CRV we re-lock for boost (in basis points)
uint256 internal constant FEE_DENOMINATOR = 10000; // this means all of our fee values are in basis points
address public constant voter = 0xF147b8125d2ef93FB6965Db97D6746952a133934; // Yearn's veCRV voter
| uint256 public keepCRV = 1000; // the percentage of CRV we re-lock for boost (in basis points)
uint256 internal constant FEE_DENOMINATOR = 10000; // this means all of our fee values are in basis points
address public constant voter = 0xF147b8125d2ef93FB6965Db97D6746952a133934; // Yearn's veCRV voter
| 8,385 |
168 | // ensures that the fee is valid | modifier validFee(uint32 fee) {
_validFee(fee);
_;
}
| modifier validFee(uint32 fee) {
_validFee(fee);
_;
}
| 16,899 |
23 | // check if the txid is already known | require(!_isMintID(txid), "TFT transacton ID already known");
| require(!_isMintID(txid), "TFT transacton ID already known");
| 4,985 |
156 | // Allows the owner to disable/enable the buying of a token_tokenToken address whos trading permission is to be set_enabledNew token permission/ | function setToken(address _token, bool _enabled) external onlyOwner {
disabledTokens[_token] = _enabled;
}
| function setToken(address _token, bool _enabled) external onlyOwner {
disabledTokens[_token] = _enabled;
}
| 15,047 |
36 | // only transaction system can call / | modifier onlyForPlayerBook(){
// require(msg.sender == playerBookAddress, "Only for palyerBook contract!");
_;
}
| modifier onlyForPlayerBook(){
// require(msg.sender == playerBookAddress, "Only for palyerBook contract!");
_;
}
| 54,193 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.