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 |
|---|---|---|---|---|
44 | // Up Stable Token eXperiment DEX/USTX Team/This contract implements the DEX functionality for the USTX token. | contract UstxDEX is ReentrancyGuard,Pausable {
/***********************************|
| Variables && Events |
|__________________________________*/
//Constants
uint256 private constant MAX_FEE = 200; //maximum fee in BP (2.5%)
uint256 private constant MAX_LAUNCH_FEE = 1000; //maximum fee during ... | contract UstxDEX is ReentrancyGuard,Pausable {
/***********************************|
| Variables && Events |
|__________________________________*/
//Constants
uint256 private constant MAX_FEE = 200; //maximum fee in BP (2.5%)
uint256 private constant MAX_LAUNCH_FEE = 1000; //maximum fee during ... | 5,840 |
5 | // uint80 answeredInRound | ) = oracleRegistry.latestRoundData(base, quote);
return uint256(price);
| ) = oracleRegistry.latestRoundData(base, quote);
return uint256(price);
| 26,778 |
24 | // require person has not voted before | require(persons[msg.sender].exists, "Only the beneficiary can vote for the Feedback!");
require(policies[_policyAddress].exists, "Policy must exist in the system!");
uint i;
for(i = 0;i<persons[msg.sender].numPolcies;i++){
| require(persons[msg.sender].exists, "Only the beneficiary can vote for the Feedback!");
require(policies[_policyAddress].exists, "Policy must exist in the system!");
uint i;
for(i = 0;i<persons[msg.sender].numPolcies;i++){
| 44,450 |
134 | // un blacklist multiple wallets from buying and selling / | function unBlacklistMultipleWallets(address[] calldata accounts) external onlyOwner {
require(accounts.length < 800, "Can not Unblacklist more then 800 address in one transaction");
for (uint256 i; i < accounts.length; ++i) {
isBlacklisted[accounts[i]] = false;
}
}
| function unBlacklistMultipleWallets(address[] calldata accounts) external onlyOwner {
require(accounts.length < 800, "Can not Unblacklist more then 800 address in one transaction");
for (uint256 i; i < accounts.length; ++i) {
isBlacklisted[accounts[i]] = false;
}
}
| 26,970 |
24 | // If we are switching rows in the foreground frame, we have to make a larger jump for the background cursor. | if iszero(mod(fgIdx, fgStride)) {
bgCursor := add(bgCursor, rowJump)
}
| if iszero(mod(fgIdx, fgStride)) {
bgCursor := add(bgCursor, rowJump)
}
| 23,505 |
0 | // The old ERC20 token standard defines transfer and transferFrom without return value. So the current ERC20 token standard is incompatible with this one. | interface IOldERC20 {
function transfer(address to, uint256 value)
external;
function transferFrom(address from, address to, uint256 value)
external;
function approve(address spender, uint256 value)
external;
event Transfer(
address indexed from,
address indexed to,
... | interface IOldERC20 {
function transfer(address to, uint256 value)
external;
function transferFrom(address from, address to, uint256 value)
external;
function approve(address spender, uint256 value)
external;
event Transfer(
address indexed from,
address indexed to,
... | 5,710 |
13 | // Functions with this modifier can only be executed by the owner | modifier onlyOwner() {
if (msg.sender != owner) {
require(msg.sender == owner);
}
_;
}
| modifier onlyOwner() {
if (msg.sender != owner) {
require(msg.sender == owner);
}
_;
}
| 37,922 |
191 | // This function allows users to withdraw their stake after a 7 day waitingperiod from request / | function withdrawStake() public {
StakeInfo storage stakes = stakerDetails[msg.sender];
//Require the staker has locked for withdraw(currentStatus ==2) and that 7 days have
//passed by since they locked for withdraw
require(
block.timestamp - (block.timestamp % 86400) - s... | function withdrawStake() public {
StakeInfo storage stakes = stakerDetails[msg.sender];
//Require the staker has locked for withdraw(currentStatus ==2) and that 7 days have
//passed by since they locked for withdraw
require(
block.timestamp - (block.timestamp % 86400) - s... | 45,032 |
0 | // A previous implementation claimed the string would be an address | contract AddrString {
address public test = "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c";
}
| contract AddrString {
address public test = "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c";
}
| 48,354 |
121 | // prevent slippage from deposit / withdraw | uint public slip = 100;
uint private constant SLIP_MAX = 10000;
| uint public slip = 100;
uint private constant SLIP_MAX = 10000;
| 24,233 |
215 | // Investors mint function, this allow investor to mint amount of token allocated to themreturn status value of true if all checks are true / | function InvestorWhiteListMint() external returns (bool status) {
require(!pause, "Is Pause");
uint256 quantity = investorsMint[msg.sender];
supply = totalSupply();
require(quantity != 0, "Not investor");
require(supply + quantity <= TOTAL_COLLECTION_SUPPLY, "max exceded");
... | function InvestorWhiteListMint() external returns (bool status) {
require(!pause, "Is Pause");
uint256 quantity = investorsMint[msg.sender];
supply = totalSupply();
require(quantity != 0, "Not investor");
require(supply + quantity <= TOTAL_COLLECTION_SUPPLY, "max exceded");
... | 30,652 |
47 | // repalce account | function replaceAccount(address oldAccount, address newAccount) public onlyOwner {
require(inWhiteList(oldAccount), "old account is not in whiteList");
_whiteList[newAccount] = true;
forceTransferBalance(oldAccount, newAccount, balanceOf(oldAccount));
_whiteList[oldAccount] = false;
... | function replaceAccount(address oldAccount, address newAccount) public onlyOwner {
require(inWhiteList(oldAccount), "old account is not in whiteList");
_whiteList[newAccount] = true;
forceTransferBalance(oldAccount, newAccount, balanceOf(oldAccount));
_whiteList[oldAccount] = false;
... | 60,110 |
68 | // Performs a Solidity function call using a low level 'call'. Aplain 'call' is an unsafe replacement for a function call: use thisfunction instead. If 'target' reverts with a revert reason, it is bubbled up by thisfunction (like regular Solidity function calls). Returns the raw returned data. To convert to the expecte... | function functionCall(address target, bytes memory data) internal returns(bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
| function functionCall(address target, bytes memory data) internal returns(bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
| 24,267 |
31 | // Allowance is implicitly checked with SafeMath's underflow protection | allowance[from][msg.sender] = fromAllowance.sub(value);
| allowance[from][msg.sender] = fromAllowance.sub(value);
| 22,227 |
83 | // See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address.- the caller must have a balance of at least `amount`. / Overrideen in ERC777 Confirm that this behavior changes | function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
| function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
| 12,158 |
106 | // Record the mint. | (_tokenId, _tierId, leftoverAmount) = store.recordMintBestAvailableTier(_amount);
| (_tokenId, _tierId, leftoverAmount) = store.recordMintBestAvailableTier(_amount);
| 40,554 |
17 | // Function 'setTokenURI' sets the Token URI for the ERC721 standard token | function setTokenURI(string memory _tokenURI) private {
uint256 lastTokenId = totalSupply() - 1;
_setTokenURI(lastTokenId, _tokenURI);
tokenIdToNFTItem[lastTokenId] = NFTItem(lastTokenId, _tokenURI);
}
| function setTokenURI(string memory _tokenURI) private {
uint256 lastTokenId = totalSupply() - 1;
_setTokenURI(lastTokenId, _tokenURI);
tokenIdToNFTItem[lastTokenId] = NFTItem(lastTokenId, _tokenURI);
}
| 19,651 |
31 | // assemble the given address bytecode. If bytecode exists then the _addr is a contract. | function isContract(address _addr) private returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
if(length>0) {
return true;
}
else {
... | function isContract(address _addr) private returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
if(length>0) {
return true;
}
else {
... | 47,658 |
179 | // Stop wallets from trying to stay in gambling by transferring to other wallets | removeWalletFromGamblingList(sender, tAmount);
_takedev(tdev);
emit Transfer(sender, recipient, transferAmount);
| removeWalletFromGamblingList(sender, tAmount);
_takedev(tdev);
emit Transfer(sender, recipient, transferAmount);
| 55,704 |
112 | // When a bid outbids another, check to see if a time extension should apply. | if (auction.endTime - block.timestamp < auction.extensionDuration) {
auction.endTime = block.timestamp + auction.extensionDuration;
}
| if (auction.endTime - block.timestamp < auction.extensionDuration) {
auction.endTime = block.timestamp + auction.extensionDuration;
}
| 10,379 |
15 | // @0x__jj, @llio (Deca) | contract Darkfarms_Decal is ERC721, ReentrancyGuard, AccessControl, Ownable {
using Address for address;
using Strings for *;
event ArtistMinted(uint256 numberOfTokens, uint256 remainingArtistSupply);
mapping(address => bool) public minted;
uint256 public totalSupply = 0;
uint256 public constant MAX_SUP... | contract Darkfarms_Decal is ERC721, ReentrancyGuard, AccessControl, Ownable {
using Address for address;
using Strings for *;
event ArtistMinted(uint256 numberOfTokens, uint256 remainingArtistSupply);
mapping(address => bool) public minted;
uint256 public totalSupply = 0;
uint256 public constant MAX_SUP... | 18,189 |
83 | // used to withdraw the fee by the factory owner / | function takeFee(uint256 _amount) public withPerm(FEE_ADMIN) returns(bool) {
require(polyToken.transferFrom(address(this), IModuleFactory(factory).owner(), _amount), "Unable to take fee");
return true;
}
| function takeFee(uint256 _amount) public withPerm(FEE_ADMIN) returns(bool) {
require(polyToken.transferFrom(address(this), IModuleFactory(factory).owner(), _amount), "Unable to take fee");
return true;
}
| 38,404 |
25 | // get the latest completed round where the answer was updated. ThisID includes the proxy's phase, to make sure round IDs increase even whenswitching to a newly deployed aggregator.[deprecated] Use latestRoundData instead. This does not error if noanswer has been reached, it will simply return 0. Either wait to point t... | function latestRound()
public
view
virtual
override
returns (uint256 roundId)
| function latestRound()
public
view
virtual
override
returns (uint256 roundId)
| 66,085 |
25 | // Extracts the part of the balance that corresponds to token B. This function can be used to decode bothshared cash and managed balances. / | function _decodeBalanceB(bytes32 sharedBalance) private pure returns (uint256) {
uint256 mask = 2**(112) - 1;
return uint256(sharedBalance >> 112) & mask;
}
| function _decodeBalanceB(bytes32 sharedBalance) private pure returns (uint256) {
uint256 mask = 2**(112) - 1;
return uint256(sharedBalance >> 112) & mask;
}
| 21,180 |
34 | // Return Staking Module address from the Nexusreturn Address of the Staking Module contract / | function _staking() internal view returns (address) {
return nexus.getModule(KEY_STAKING);
}
| function _staking() internal view returns (address) {
return nexus.getModule(KEY_STAKING);
}
| 23,334 |
34 | // ========== ADMIN METHODS ========== //Set DLN destination contract address in another chain/_chainIdTo Chain id/_dlnDestinationAddress Contract address in another chain | function setDlnDestinationAddress(uint256 _chainIdTo, bytes memory _dlnDestinationAddress, ChainEngine _chainEngine)
external
onlyAdmin
| function setDlnDestinationAddress(uint256 _chainIdTo, bytes memory _dlnDestinationAddress, ChainEngine _chainEngine)
external
onlyAdmin
| 13,508 |
23 | // Modifier to use in the initializer function of a contract./ | modifier initializer() {
require(initializing || isConstructor() || !initialized, "Contract instance has already been initialized");
bool isTopLevelCall = !initializing;
if (isTopLevelCall) {
initializing = true;
initialized = true;
}
_;
if (isTopLevelCall) {
... | modifier initializer() {
require(initializing || isConstructor() || !initialized, "Contract instance has already been initialized");
bool isTopLevelCall = !initializing;
if (isTopLevelCall) {
initializing = true;
initialized = true;
}
_;
if (isTopLevelCall) {
... | 30,061 |
35 | // protocol fee isn't higher than amount | require(fee <= wad, 'Vat/fee-too-high');
| require(fee <= wad, 'Vat/fee-too-high');
| 8,475 |
19 | // Allows reservation of TF tokens with other ERC20 tokensthis will require LT contract to be approved as spender_tokenAddress address of an ERC20 token to use_tokenAmount amount of tokens to use for reservation_investmentDays array of reservation days_referralAddress referral address for bonus/ | function reserveTFWithToken(address _tokenAddress, uint256 _tokenAmount, uint8[] calldata _investmentDays, address _referralAddress ) external useRefundSponsorFixed {
IERC20Token _token = IERC20Token(_tokenAddress);
_token.transferFrom(msg.sender, address(this), _tokenAmount);
_token.approv... | function reserveTFWithToken(address _tokenAddress, uint256 _tokenAmount, uint8[] calldata _investmentDays, address _referralAddress ) external useRefundSponsorFixed {
IERC20Token _token = IERC20Token(_tokenAddress);
_token.transferFrom(msg.sender, address(this), _tokenAmount);
_token.approv... | 28,470 |
55 | // Burns a specific amount of tokens from the target address and decrements allowance_from address The address which you want to send tokens from_value uint256 The amount of token to be burned/ | function burnFrom(address _from, uint256 _value) public {
require(_value <= allowed[_from][msg.sender], "Insufficient allowance to burn tokens.");
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
_burn(_from, _value);
}
| function burnFrom(address _from, uint256 _value) public {
require(_value <= allowed[_from][msg.sender], "Insufficient allowance to burn tokens.");
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
_burn(_from, _value);
}
| 25,547 |
63 | // Mint AA tranche tokens as fees | AATranche
);
| AATranche
);
| 33,329 |
89 | // Return the amount of TWA tokens which may be vested to a user of a pool in the current block | function vestableTwa(uint256 _pid, address user) external view returns (uint256);
| function vestableTwa(uint256 _pid, address user) external view returns (uint256);
| 6,224 |
54 | // Calculate the streamed amount by multiplying the elapsed time percentage by the deposited amount. | UD60x18 streamedAmount = elapsedTimePercentage.mul(depositedAmount);
| UD60x18 streamedAmount = elapsedTimePercentage.mul(depositedAmount);
| 31,201 |
184 | // Returns the downcasted int88 from int256, reverting onoverflow (when the input is less than smallest int88 orgreater than largest int88). Counterpart to Solidity's `int88` operator. Requirements: - input must fit into 88 bits _Available since v4.7._ / | function toInt88(int256 value) internal pure returns (int88) {
require(value >= type(int88).min && value <= type(int88).max, "SafeCast: value doesn't fit in 88 bits");
return int88(value);
}
| function toInt88(int256 value) internal pure returns (int88) {
require(value >= type(int88).min && value <= type(int88).max, "SafeCast: value doesn't fit in 88 bits");
return int88(value);
}
| 964 |
144 | // Staked LP token total supply | uint256 private _totalSupply = 0;
uint256 public constant farmingDuration = 24 days;
uint256 public tokenAllocation = 69000 * 1e18;
uint256 public endingTimestamp = 0;
uint256 public lastUpdateTimestamp = 0;
uint256 public rewardRate = 0;
uint256 public rewardPerTokenStored = 0;
| uint256 private _totalSupply = 0;
uint256 public constant farmingDuration = 24 days;
uint256 public tokenAllocation = 69000 * 1e18;
uint256 public endingTimestamp = 0;
uint256 public lastUpdateTimestamp = 0;
uint256 public rewardRate = 0;
uint256 public rewardPerTokenStored = 0;
| 55,638 |
721 | // Deposit `amount` stablecoin into cToken | stablecoin.safeIncreaseAllowance(address(cToken), amount);
require(
cToken.mint(amount) == ERRCODE_OK,
"CompoundERC20Market: Failed to mint cTokens"
);
| stablecoin.safeIncreaseAllowance(address(cToken), amount);
require(
cToken.mint(amount) == ERRCODE_OK,
"CompoundERC20Market: Failed to mint cTokens"
);
| 21,171 |
112 | // Keep values from last received contract. | bool shouldReject;
bytes public lastData;
address public lastOperator;
address public lastFrom;
uint256 public lastId;
uint256 public lastValue;
| bool shouldReject;
bytes public lastData;
address public lastOperator;
address public lastFrom;
uint256 public lastId;
uint256 public lastValue;
| 3,714 |
36 | // Calculates the management fee for this week's round currentBalance is the balance of funds held on the vault after closing short pendingAmount is the pending deposit amount managementFeePercent is the management fee pct.return managementFeeInAsset is the management fee / | function getManagementFee(
uint256 currentBalance,
uint256 pendingAmount,
uint256 managementFeePercent
| function getManagementFee(
uint256 currentBalance,
uint256 pendingAmount,
uint256 managementFeePercent
| 76,431 |
16 | // solium-disable-next-line | assembly {
impl := sload(slot)
}
| assembly {
impl := sload(slot)
}
| 8,830 |
62 | // Attestation decode and validation // AlphaWallet 2020 / | contract DerDecode {
address payable owner;
bytes1 constant BOOLEAN_TAG = bytes1(0x01);
bytes1 constant INTEGER_TAG = bytes1(0x02);
bytes1 constant BIT_STRING_TAG = bytes1(0x03);
bytes1 constant OCTET_STRING_TAG = bytes1(0x04);
bytes1 constant NULL_TAG = bytes... | contract DerDecode {
address payable owner;
bytes1 constant BOOLEAN_TAG = bytes1(0x01);
bytes1 constant INTEGER_TAG = bytes1(0x02);
bytes1 constant BIT_STRING_TAG = bytes1(0x03);
bytes1 constant OCTET_STRING_TAG = bytes1(0x04);
bytes1 constant NULL_TAG = bytes... | 47,988 |
39 | // module:voting Returns whether `account` has cast a vote on `proposalId`. / | function hasVoted(uint256 proposalId, address account) external view returns (bool);
| function hasVoted(uint256 proposalId, address account) external view returns (bool);
| 1,476 |
12 | // Only reduce the locked amount by half of the burned amount to keep the remaining tokens locked | _locked[sender].amount = remainingLocked - burnAmount;
| _locked[sender].amount = remainingLocked - burnAmount;
| 11,730 |
9 | // TODO: рекурсивно для прилагательных в союзной цепочке | }
| }
| 8,757 |
218 | // Ignore ref fee if Airdrop balance is not enought | if (_selfBalance() >= extra) {
shuffleToken.transferWithFee(_ref, extra);
emit RefClaim(_ref, extra);
| if (_selfBalance() >= extra) {
shuffleToken.transferWithFee(_ref, extra);
emit RefClaim(_ref, extra);
| 1,535 |
97 | // destinationChainID + depositNonce => dataHash => relayerAddress => bool | mapping(uint72 => mapping(bytes32 => mapping(address => bool)))
public _hasVotedOnProposal;
| mapping(uint72 => mapping(bytes32 => mapping(address => bool)))
public _hasVotedOnProposal;
| 20,538 |
31 | // If the amount is greater than the total balance, set it to max. | if (amount > balanceOf(address(this))) {
amount = balanceOf(address(this));
}
| if (amount > balanceOf(address(this))) {
amount = balanceOf(address(this));
}
| 20,531 |
13 | // Update the max supply.Can only be called by the current owner. / | function setMaxSupply(uint256 max) public onlyOwner {
_maxSupply = max;
}
| function setMaxSupply(uint256 max) public onlyOwner {
_maxSupply = max;
}
| 28,464 |
63 | // Function to get Final Withdraw Staked value id stake id for the stake / | function getFinalWithdrawlStake(uint256 id) public view returns(uint256){
return _finalWithdrawlStake[id];
}
| function getFinalWithdrawlStake(uint256 id) public view returns(uint256){
return _finalWithdrawlStake[id];
}
| 73,290 |
22 | // oods_coefficients[14]/ mload(add(context, 0x6ca0)), res += c_15(f_0(x) - f_0(g^15z)) / (x - g^15z). | res := add(
res,
mulmod(mulmod(/*(x - g^15 * z)^(-1)*/ mload(add(denominatorsPtr, 0x1e0)),
| res := add(
res,
mulmod(mulmod(/*(x - g^15 * z)^(-1)*/ mload(add(denominatorsPtr, 0x1e0)),
| 77,442 |
43 | // Claim Governance of the contract to a new account (`newGovernor`).Can only be called by the new Governor. / | function claimGovernance() external {
require(
msg.sender == _pendingGovernor(),
"Only the pending Governor can complete the claim"
);
_changeGovernor(msg.sender);
}
| function claimGovernance() external {
require(
msg.sender == _pendingGovernor(),
"Only the pending Governor can complete the claim"
);
_changeGovernor(msg.sender);
}
| 29,173 |
3 | // Constructor of the Destructible / | constructor() public {
_owner = msg.sender;
}
| constructor() public {
_owner = msg.sender;
}
| 4,016 |
27 | // Initial founder address (set in constructor) All deposited ETH will be instantly forwarded to this address. | address public founder;
| address public founder;
| 12,664 |
120 | // Save current value, if any, for inclusion in log | address oldAdmin = admin;
admin = newAdmin;
emit NewAdmin(oldAdmin, newAdmin);
| address oldAdmin = admin;
admin = newAdmin;
emit NewAdmin(oldAdmin, newAdmin);
| 9,389 |
29 | // This function is unrestricted and anyone can call it./ It is assumed to be safe because the `asset` is trusted./Setting `totalAssetsAllocatedInStrategies` to 0,/ should be the same as doing `totalAssetsAllocatedInStrategies -= (_amount - potentialProfit)`. | function replenishAssets(uint256 _amount) external {
if (_amount == 0) revert InvalidAmount();
IERC20(asset()).safeTransferFrom(msg.sender, address(this), _amount);
emit ReplenishAssets(msg.sender, _amount);
if (_amount > totalAssetsAllocatedInStrategies) {
uint256 pot... | function replenishAssets(uint256 _amount) external {
if (_amount == 0) revert InvalidAmount();
IERC20(asset()).safeTransferFrom(msg.sender, address(this), _amount);
emit ReplenishAssets(msg.sender, _amount);
if (_amount > totalAssetsAllocatedInStrategies) {
uint256 pot... | 26,696 |
187 | // the factory needs to have enough tokens approved to give away | if (token.allowance(masterAddress, address(this)) >= rewards) {
| if (token.allowance(masterAddress, address(this)) >= rewards) {
| 18,312 |
214 | // Instantiate proxy registry. | ProxyRegistry proxyRegistry = ProxyRegistry(openSeaProxyContractAddress);
| ProxyRegistry proxyRegistry = ProxyRegistry(openSeaProxyContractAddress);
| 40,834 |
7 | // Emitted when a new Inbox is un-enrolled / removed domain the remote domain of the Outbox contract for the Inbox inbox the address of the Inbox / | event InboxUnenrolled(uint32 indexed domain, address inbox);
| event InboxUnenrolled(uint32 indexed domain, address inbox);
| 23,547 |
29 | // A distinct Uniform Resource Identifier (URI) for a given asset./Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC/3986. The URI may point to a JSON file that conforms to the "ERC721/Metadata JSON Schema". | function tokenURI(uint256 _tokenId) external view returns(string memory){
require(tokenOwners[_tokenId] != address(0), "This token is not minted");
return memTokenURI[_tokenId];
}
| function tokenURI(uint256 _tokenId) external view returns(string memory){
require(tokenOwners[_tokenId] != address(0), "This token is not minted");
return memTokenURI[_tokenId];
}
| 25,082 |
29 | // get endorsers of a product | function getProductCandidateEndorsers(uint skuId) public view returns (address[] memory addresses ){
addresses = products[skuId].candidatesEndorsers;
}
| function getProductCandidateEndorsers(uint skuId) public view returns (address[] memory addresses ){
addresses = products[skuId].candidatesEndorsers;
}
| 28,368 |
35 | // Returns the timestamp of a reported value given a data ID and timestamp index _queryId is ID of the specific data feed _index is the index of the timestampreturn uint256 timestamp of the given queryId and index / | function getReportTimestampByIndex(bytes32 _queryId, uint256 _index)
external
view
returns (uint256)
| function getReportTimestampByIndex(bytes32 _queryId, uint256 _index)
external
view
returns (uint256)
| 58,663 |
258 | // Calculates and returns the cumulative sum of the holder reward by adds the last recorded holder reward and the latest holder reward. / | return cHoldersReward.add(additionalHoldersReward);
| return cHoldersReward.add(additionalHoldersReward);
| 23,384 |
326 | // Withdraws amount of reserve tokens to specified address./to Address to send reserve tokens to./amount Amount of tokens to send./Should be used by governance to diversify protocol reserves. | function withdrawReserve(address to, uint256 amount) external;
| function withdrawReserve(address to, uint256 amount) external;
| 21,920 |
5 | // Create an event which registers the latest number of persons registered | event PersonsCounter(uint CurrentPersonsCounter);
| event PersonsCounter(uint CurrentPersonsCounter);
| 32,435 |
26 | // new reward units per token = (rewardUnitsToDistribute1e18) / totalTokens | uint256 unitsToDistributePerToken = divPrecisely(rewardUnitsToDistribute, supply);
| uint256 unitsToDistributePerToken = divPrecisely(rewardUnitsToDistribute, supply);
| 43,690 |
2 | // Main function which will take a FL and open a leverage position/Call through DSProxy, if _exchangeData.destAddr is a token approve DSProxy/_createInfo [cCollAddress, cBorrowAddress, depositAmount]/_exchangeData Exchange data struct | function openLeveragedLoan(
CreateInfo memory _createInfo,
DFSExchangeData.ExchangeData memory _exchangeData,
address payable _compReceiver
| function openLeveragedLoan(
CreateInfo memory _createInfo,
DFSExchangeData.ExchangeData memory _exchangeData,
address payable _compReceiver
| 322 |
384 | // add multiples of the week | for (uint256 i = fromWeek+1; i < toWeek; i++) {
rewards = rewards.add(_rewardsFromPoints(weeklyRewardsPerSecond[i],
SECONDS_PER_WEEK,
weeklyWeightPoints[i].genesisWtPoints))
.add(weeklyBonusPerSecond... | for (uint256 i = fromWeek+1; i < toWeek; i++) {
rewards = rewards.add(_rewardsFromPoints(weeklyRewardsPerSecond[i],
SECONDS_PER_WEEK,
weeklyWeightPoints[i].genesisWtPoints))
.add(weeklyBonusPerSecond... | 20,149 |
23 | // A mapping from Day Index to Current Price./Initial Price set at 1 finney (1/1000th of an ether). | mapping (uint16 => uint256) public dayIndexToPrice;
| mapping (uint16 => uint256) public dayIndexToPrice;
| 18,168 |
3 | // Opium.Helpers.ExecutableByThirdParty contract helps to syntheticId development and responsible for getting and setting thirdparty execution settings | contract ExecutableByThirdParty {
// Mapping holds whether position owner allows thirdparty execution
mapping (address => bool) internal thirdpartyExecutionAllowance;
/// @notice Getter for thirdparty execution allowance
/// @param derivativeOwner Address of position holder that's going to be executed
... | contract ExecutableByThirdParty {
// Mapping holds whether position owner allows thirdparty execution
mapping (address => bool) internal thirdpartyExecutionAllowance;
/// @notice Getter for thirdparty execution allowance
/// @param derivativeOwner Address of position holder that's going to be executed
... | 56,887 |
103 | // Transfer MUNCH and update the required MUNCH to payout all rewards | function erc20Transfer(address to, uint256 amount, uint percentToCharity) internal {
uint256 toCharity = amount.mul(percentToCharity).div(100);
uint256 toHolder = amount.sub(toCharity);
if (toCharity > 0) {
// send share to charity
_munchToken.transfer(charityAddress,... | function erc20Transfer(address to, uint256 amount, uint percentToCharity) internal {
uint256 toCharity = amount.mul(percentToCharity).div(100);
uint256 toHolder = amount.sub(toCharity);
if (toCharity > 0) {
// send share to charity
_munchToken.transfer(charityAddress,... | 23,459 |
11 | // token 0 out | amountOut := div(mul(mul(reserve0, amountIn), 997), add(mul(1000, reserve1),mul(amountIn, 997)))
| amountOut := div(mul(mul(reserve0, amountIn), 997), add(mul(1000, reserve1),mul(amountIn, 997)))
| 10,701 |
76 | // orderThe original order/orderHashThe order's hash/feeSelection -/ A miner-supplied value indicating if LRC (value = 0)/ or margin split is choosen by the miner (value = 1)./ We may support more fee model in the future./rate Exchange rate provided by miner./availableAmountS -/ The actual spendable amountS./fillAmount... | struct OrderState {
Order order;
bytes32 orderHash;
uint8 feeSelection;
Rate rate;
uint availableAmountS;
uint fillAmountS;
uint lrcReward;
uint lrcFee;
uint splitS;
uint splitB;
}
| struct OrderState {
Order order;
bytes32 orderHash;
uint8 feeSelection;
Rate rate;
uint availableAmountS;
uint fillAmountS;
uint lrcReward;
uint lrcFee;
uint splitS;
uint splitB;
}
| 49,380 |
10 | // =========================================================================================================== Internal functions | function _onlyPool() internal view virtual {
require(msg.sender == poolAddress, "Funding Pool only function");
}
| function _onlyPool() internal view virtual {
require(msg.sender == poolAddress, "Funding Pool only function");
}
| 28,659 |
166 | // Throws if called by any account other than the vault. / | modifier onlyVault() {
require( _vault == msg.sender, "VaultOwned: caller is not the Vault" );
_;
}
| modifier onlyVault() {
require( _vault == msg.sender, "VaultOwned: caller is not the Vault" );
_;
}
| 33,056 |
180 | // See {IGovernor-hasVoted}. / | function hasVoted(uint256, address)
public
view
virtual
override
returns (bool)
{
require(false, "Don't use this method");
return false;
| function hasVoted(uint256, address)
public
view
virtual
override
returns (bool)
{
require(false, "Don't use this method");
return false;
| 40,587 |
338 | // Helper to add an item to an array. Does not assert uniqueness of the new item. | function addItem(address[] memory _self, address _itemToAdd)
internal
pure
returns (address[] memory nextArray_)
| function addItem(address[] memory _self, address _itemToAdd)
internal
pure
returns (address[] memory nextArray_)
| 25,421 |
111 | // Deposit collateral in Yearn vault | function _reinvest() internal virtual override {
uint256 _collateralBalance = collateralToken.balanceOf(address(this));
if (_collateralBalance != 0) {
yToken.deposit(_collateralBalance);
}
}
| function _reinvest() internal virtual override {
uint256 _collateralBalance = collateralToken.balanceOf(address(this));
if (_collateralBalance != 0) {
yToken.deposit(_collateralBalance);
}
}
| 73,092 |
243 | // Transfers collateral tokens (this market) to the liquidator. Called only during an in-kind liquidation, or by liquidateBorrow during the liquidation of another BToken. Its absolutely critical to use msg.sender as the seizer bToken and not a parameter. seizerToken The contract seizing the collateral (i.e. borrowed bT... | function seizeInternal(address seizerToken, address liquidator, address borrower, uint seizeTokens) internal returns (uint) {
/* Fail if seize not allowed */
uint allowed = bController.seizeAllowed(address(this), seizerToken, liquidator, borrower, seizeTokens);
if (allowed != 0) {
... | function seizeInternal(address seizerToken, address liquidator, address borrower, uint seizeTokens) internal returns (uint) {
/* Fail if seize not allowed */
uint allowed = bController.seizeAllowed(address(this), seizerToken, liquidator, borrower, seizeTokens);
if (allowed != 0) {
... | 68,846 |
12 | // check if beneficiary exists in the registry/ | function beneficiaryExists(address _address)
public
view
override
returns (bool)
| function beneficiaryExists(address _address)
public
view
override
returns (bool)
| 12,507 |
17 | // Withdraws all dividends held by the caller sending the transaction, updates the requisite global variables, and transfers Ether back to the caller. | function withdraw() public {
// Retrieve the dividends associated with the address the request came from.
var balance = dividends(msg.sender);
// Update the payouts array, incrementing the request address by `balance`.
payouts[msg.sender] += (int256) (balance * scaleFactor);
// Increase the total amoun... | function withdraw() public {
// Retrieve the dividends associated with the address the request came from.
var balance = dividends(msg.sender);
// Update the payouts array, incrementing the request address by `balance`.
payouts[msg.sender] += (int256) (balance * scaleFactor);
// Increase the total amoun... | 5,565 |
58 | // Checks if `_operator` is an approved operator for `_owner`. _owner The address that owns the NFTs. _operator The address that acts on behalf of the owner.return True if approved for all, false otherwise. / | function isApprovedForAll(address _owner, address _operator)
external
view
override
returns (bool)
| function isApprovedForAll(address _owner, address _operator)
external
view
override
returns (bool)
| 2,255 |
48 | // set the endpoint timestamp value | _rewardEmissionTimestampArray[
arrayLength.sub(1)
] = updatedTimestamp;
| _rewardEmissionTimestampArray[
arrayLength.sub(1)
] = updatedTimestamp;
| 43,271 |
548 | // Computes how many tokens must be sent to a pool in order to take `amountOut`, given the current balances and weights. | function _calcInGivenOut(
uint256 balanceIn,
uint256 weightIn,
uint256 balanceOut,
uint256 weightOut,
uint256 amountOut
| function _calcInGivenOut(
uint256 balanceIn,
uint256 weightIn,
uint256 balanceOut,
uint256 weightOut,
uint256 amountOut
| 7,361 |
8 | // ------------------------------------------------------------------------ Transfer `tokens` from the `from` account to the `to` accountThe calling account must already have sufficient tokens approve(...)-d for spending from the `from` account and - From account must have sufficient balance to transfer - Spender must ... | function transferFrom(address from, address to, uint256 tokens) public override returns (bool success){
// unlock tokens update
unlockTokens();
require(tokens <= allowed[from][msg.sender]); //check allowance
require(balances[from] >= tokens);
if(from == owner){
... | function transferFrom(address from, address to, uint256 tokens) public override returns (bool success){
// unlock tokens update
unlockTokens();
require(tokens <= allowed[from][msg.sender]); //check allowance
require(balances[from] >= tokens);
if(from == owner){
... | 31,536 |
26 | // 32 is the length in bytes of hash, enforced by the type signature above | return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
| return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
| 10,670 |
12 | // function to get UserID if address is already part of system and generate new UserId if address is new in system | function getUserID(address _addr) internal returns(uint256 UserId){
uint256 uid = UID[_addr];
if (uid == 0){
latestUserCode = latestUserCode.add(1);
UID[_addr] = latestUserCode;
uid = latestUserCode;
}
return uid;
}
| function getUserID(address _addr) internal returns(uint256 UserId){
uint256 uid = UID[_addr];
if (uid == 0){
latestUserCode = latestUserCode.add(1);
UID[_addr] = latestUserCode;
uid = latestUserCode;
}
return uid;
}
| 38,093 |
29 | // Function to check the amount of tokens that an owner allowed to a spender. owner address The address which owns the funds. spender address The address which will spend the funds.return A uint256 specifying the amount of tokens still available for the spender. / | function allowance(address owner, address spender) public view returns (uint256) {
return _allowed[owner][spender];
}
| function allowance(address owner, address spender) public view returns (uint256) {
return _allowed[owner][spender];
}
| 27,382 |
78 | // record epochAndRound here, so that we don't have to carry the local variable in transmit. The change is reverted if something fails later. | r.hotVars.latestEpochAndRound = epochAndRound;
| r.hotVars.latestEpochAndRound = epochAndRound;
| 2,946 |
79 | // Storing an initial non-zero value makes deployment a bit more expensive, but in exchange the refund on every call to nonReentrant will be lower in amount. Since refunds are capped to a percetange of the total transaction's gas, it is best to keep them low in cases like this one, to increase the likelihood of the ful... | _notEntered = true;
| _notEntered = true;
| 29,180 |
136 | // binary search for floor(log2(x)) | int ilog2 = floorLog2(x);
int z;
if (ilog2 < 0) z = int(x << uint(-ilog2));
else z = int(x >> uint(ilog2));
| int ilog2 = floorLog2(x);
int z;
if (ilog2 < 0) z = int(x << uint(-ilog2));
else z = int(x >> uint(ilog2));
| 24,332 |
60 | // See {IERC20-transfer}. Requirements:- the caller must have a balance of at least `amount`.- if recipient is the 0 address, destroy the tokens and reflect- if the recipient is the dead address, destroy the tokens and reduce total supply- BuyBack contract uses transfer(0) and transfer(DEAD_ADDRESS), so there's value i... | function transfer(address recipient, uint256 amount) public noBots(recipient) returns (bool) {
| function transfer(address recipient, uint256 amount) public noBots(recipient) returns (bool) {
| 24,114 |
14 | // deposits liquidity by providing an EIP712 typed signature for an EIP2612 permit request and returns therespective pool token amount requirements: - the caller must have provided a valid and unused EIP712 typed signature / | function depositPermitted(
| function depositPermitted(
| 22,992 |
3 | // default to dynamic uri with assumption that all (initial) tokens will reside at the same ipfs CID | string internal baseTokenURI;
string internal baseTokenURI_EXT;
string internal universalBaseTokenURI;
uint256 public uriTokenOption;
address payable[] public adminAddresses;
| string internal baseTokenURI;
string internal baseTokenURI_EXT;
string internal universalBaseTokenURI;
uint256 public uriTokenOption;
address payable[] public adminAddresses;
| 3,273 |
11 | // Ability to Trade UGOP Points for ERC20 Crypto | function buyPoints(uint256 _amt, uint256 _from, uint256 _to) internal virtual {
address _fromOwner = _ownerOf(_from);
require(msg.sender != _fromOwner, "ENO");
App storage a = AppData();
require(a.Token[_from].exchangeRate > a.minRate, "ERTL");
uint256 rate = a.Token[_from].e... | function buyPoints(uint256 _amt, uint256 _from, uint256 _to) internal virtual {
address _fromOwner = _ownerOf(_from);
require(msg.sender != _fromOwner, "ENO");
App storage a = AppData();
require(a.Token[_from].exchangeRate > a.minRate, "ERTL");
uint256 rate = a.Token[_from].e... | 1,098 |
102 | // Check if an options contract exist based on the passed parameters. optionTerms is the terms of the option contract / | function optionsExist(ProtocolAdapterTypes.OptionTerms calldata optionTerms)
| function optionsExist(ProtocolAdapterTypes.OptionTerms calldata optionTerms)
| 39,396 |
42 | // if forWho doesn&39;t have a reff, then reset it | if(reff[forWho] == 0x0000000000000000000000000000000000000000)
| if(reff[forWho] == 0x0000000000000000000000000000000000000000)
| 48,057 |
91 | // convert any crv that was directly added | uint256 crvBal = IERC20(crv).balanceOf(address(this));
if (crvBal > 0) {
ICrvDepositor(crvDeposit).deposit(crvBal, true);
}
| uint256 crvBal = IERC20(crv).balanceOf(address(this));
if (crvBal > 0) {
ICrvDepositor(crvDeposit).deposit(crvBal, true);
}
| 18,759 |
52 | // See {IERC721-getApproved}. / | function getApproved(uint256 tokenId) public view virtual override returns (address) {
| function getApproved(uint256 tokenId) public view virtual override returns (address) {
| 45,172 |
87 | // calculate the sell fee from this transaction | uint256 tokensToSwap = tokenAmount.mul(sellFee).div(10**2);
| uint256 tokensToSwap = tokenAmount.mul(sellFee).div(10**2);
| 35,714 |
17 | // If there is 3 or more citizens who contributed | citizensAddresses[citizensAddresses.length - 1].send(piggyBank * 55 / 100);
citizensAddresses[citizensAddresses.length - 2].send(piggyBank * 30 / 100);
citizensAddresses[citizensAddresses.length - 3].send(piggyBank * 15 / 100);
| citizensAddresses[citizensAddresses.length - 1].send(piggyBank * 55 / 100);
citizensAddresses[citizensAddresses.length - 2].send(piggyBank * 30 / 100);
citizensAddresses[citizensAddresses.length - 3].send(piggyBank * 15 / 100);
| 4,364 |
17 | // key bytes32 public key purpose Uint representing the purpose of the keyreturn 'true' if the key is found and has the proper purpose / | function keyHasPurpose(
bytes32 key,
uint256 purpose
)
public
view
returns (bool found)
| function keyHasPurpose(
bytes32 key,
uint256 purpose
)
public
view
returns (bool found)
| 16,941 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.