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 |
|---|---|---|---|---|
26 | // @inheritdoc IPrizePool | function awardBalance() external view override returns (uint256) {
return _currentAwardBalance;
}
| function awardBalance() external view override returns (uint256) {
return _currentAwardBalance;
}
| 29,725 |
52 | // Restore the cached values overwritten by selector, digest and signature head. | mstore(wordBeforeSignaturePtr, cachedWordBeforeSignature)
mstore(selectorPtr, cachedWordOverwrittenBySelector)
mstore(
sub(
signature,
EIP1271_isValidSignature_digest_negativeOffset
),... | mstore(wordBeforeSignaturePtr, cachedWordBeforeSignature)
mstore(selectorPtr, cachedWordOverwrittenBySelector)
mstore(
sub(
signature,
EIP1271_isValidSignature_digest_negativeOffset
),... | 20,384 |
350 | // File: contracts/CryptoAvatarz.sol |
pragma solidity ^0.8.4;
|
pragma solidity ^0.8.4;
| 18,092 |
481 | // Subtract paid out margin from p2pVault | _decreaseP2PVault(derivativeHash, payout);
| _decreaseP2PVault(derivativeHash, payout);
| 34,464 |
3 | // Gets the expiry time for the current sale/ return The expiry time, as a unix epoch | function getExpiryTime() external view returns (uint256) {
return _expiryTime;
}
| function getExpiryTime() external view returns (uint256) {
return _expiryTime;
}
| 29,422 |
151 | // Tokens can be minted only before minting finished. / | modifier canMint() {
require(!_mintingFinished, "ERC20Mintable: minting is finished");
_;
}
| modifier canMint() {
require(!_mintingFinished, "ERC20Mintable: minting is finished");
_;
}
| 26,644 |
266 | // remove the inverse mapping. | delete pynthToInversePynth[pynths[i]];
emit ShortablePynthRemoved(pynths[i]);
| delete pynthToInversePynth[pynths[i]];
emit ShortablePynthRemoved(pynths[i]);
| 700 |
19 | // Mints `tokenId`, transfers it to `creator`, sets `tokenURI` and initializes asset state. _arweaveId Arweave ID used for tokenURI _ipfsMetadataHash IPFS CID hash of metadata _creator Address of artist who created the asset _taxCollector Address of tax collector accountreturn newTokenId of the newly created token Requ... | * Emits a {Mint & Transfer} event.
*/
function mintAsset(
string memory _arweaveId,
string memory _ipfsMetadataHash,
address _creator,
address _taxCollector
) external onlyAdmin returns (uint256 newTokenId) {
_tokenIds.increment();
newTokenId = _tokenIds... | * Emits a {Mint & Transfer} event.
*/
function mintAsset(
string memory _arweaveId,
string memory _ipfsMetadataHash,
address _creator,
address _taxCollector
) external onlyAdmin returns (uint256 newTokenId) {
_tokenIds.increment();
newTokenId = _tokenIds... | 13,689 |
299 | // Gets the managers./ return The list of managers. | function managers()
public
view
returns (address[] memory)
{
return addressesInSet(MANAGER);
}
| function managers()
public
view
returns (address[] memory)
{
return addressesInSet(MANAGER);
}
| 3,674 |
79 | // Returns whether the specified token exists. tokenId uint256 ID of the token to query the existence ofreturn bool whether the token exists / | function _exists(uint256 tokenId) internal view returns (bool) {
address owner = _tokenOwner[tokenId];
return owner != address(0);
}
| function _exists(uint256 tokenId) internal view returns (bool) {
address owner = _tokenOwner[tokenId];
return owner != address(0);
}
| 1,651 |
131 | // Decode a string value from a Witnet.Result as a `string` value./_result An instance of Witnet.Result./ return The `string` decoded from the Witnet.Result. | function asString(Witnet.Result memory _result)
external pure
returns(string memory)
| function asString(Witnet.Result memory _result)
external pure
returns(string memory)
| 82,283 |
24 | // clear the remained coin-days |
uint amountToHedgeOwner = uint(vault.hedgeValue) * 10 ** 18 / price;
if (isCloseout) {
amountToHedgeOwner = amountToHedgeOwner * (10 ** 18 + vault.closeoutPenalty) / 10 ** 18;
}
|
uint amountToHedgeOwner = uint(vault.hedgeValue) * 10 ** 18 / price;
if (isCloseout) {
amountToHedgeOwner = amountToHedgeOwner * (10 ** 18 + vault.closeoutPenalty) / 10 ** 18;
}
| 27,561 |
4 | // Returns the address of the config contract. | function config() external view returns (address);
| function config() external view returns (address);
| 38,895 |
31 | // Checks if a specific account is marked as a "whale". This function allows you to verify whether an account is considered a "whale" in the context of this contract.The status of an account (whale or not) should be set by the contract based on the implemented logic.The function only returns the current status and does... | function isWhale(address account) public view returns (bool) {
return _isWhale[account];
}
| function isWhale(address account) public view returns (bool) {
return _isWhale[account];
}
| 12,106 |
55 | // Modern ERC20 Token interface | interface IERC20 {
function transfer(address to, uint amount) external returns (bool);
function transferFrom(address from, address to, uint amount) external returns (bool);
}
| interface IERC20 {
function transfer(address to, uint amount) external returns (bool);
function transferFrom(address from, address to, uint amount) external returns (bool);
}
| 24,858 |
37 | // Burn pass | _burn(msg.sender, _passId, 1);
| _burn(msg.sender, _passId, 1);
| 1,129 |
9 | // start of the sale | uint256 public startTime;
| uint256 public startTime;
| 3,551 |
1 | // Chuyển tiền cho một tài khoản khác | function transfer(address to, uint256 amount) public override returns (bool) {
require(to != address(0), "Invalid address");
return super.transfer(to, amount);
}
| function transfer(address to, uint256 amount) public override returns (bool) {
require(to != address(0), "Invalid address");
return super.transfer(to, amount);
}
| 17,147 |
364 | // issueId => [tokenId] | mapping (uint256 => uint256[]) public lotteryInfo;
| mapping (uint256 => uint256[]) public lotteryInfo;
| 37,889 |
53 | // then remove the liqudity from the pool, will get want back | uint256 usdn3crv = _getMetaPoolLpToken().balanceOf(address(this));
usdnMetaPool.remove_liquidity_one_coin(usdn3crv, 1, uint256(0));
uint256 _3crv = _getTriPoolLpToken().balanceOf(address(this));
ICurveDepositTrio(address(curvePool)).remove_liquidity_one_coin(_3crv, wantThreepoolIndex, 0);
return _ba... | uint256 usdn3crv = _getMetaPoolLpToken().balanceOf(address(this));
usdnMetaPool.remove_liquidity_one_coin(usdn3crv, 1, uint256(0));
uint256 _3crv = _getTriPoolLpToken().balanceOf(address(this));
ICurveDepositTrio(address(curvePool)).remove_liquidity_one_coin(_3crv, wantThreepoolIndex, 0);
return _ba... | 70,456 |
47 | // Get royalty recipients and amounts | (address payable[] memory recipients, uint256[] memory amounts) = RoyaltyPaymentsLogic(address(this))
.getRoyalty(_targetAuction.assetContract, _targetAuction.tokenId, _totalPayoutAmount);
uint256 royaltyRecipientCount = recipients.length;
if (royaltyRecipientCount ... | (address payable[] memory recipients, uint256[] memory amounts) = RoyaltyPaymentsLogic(address(this))
.getRoyalty(_targetAuction.assetContract, _targetAuction.tokenId, _totalPayoutAmount);
uint256 royaltyRecipientCount = recipients.length;
if (royaltyRecipientCount ... | 15,699 |
283 | // private sale has 50% off | if(privateSaleIsActive) {
price = price.div(2);
}
| if(privateSaleIsActive) {
price = price.div(2);
}
| 6,222 |
28 | // Register a future flight for insuring./ | function setFlightStatus (address _airline_address,
uint32 _flight_id,
uint32 _departure_time,
uint32 _status)
internal
requireIsOperational
| function setFlightStatus (address _airline_address,
uint32 _flight_id,
uint32 _departure_time,
uint32 _status)
internal
requireIsOperational
| 17,824 |
98 | // user's staked information | function getUserStaked(address user)
external
view
returns (
uint256 amount,
uint256 claimedBlock,
uint256 claimedAmount,
uint256 releasedBlock,
uint256 releasedAmount,
uint256 releasedTOSAmount,
| function getUserStaked(address user)
external
view
returns (
uint256 amount,
uint256 claimedBlock,
uint256 claimedAmount,
uint256 releasedBlock,
uint256 releasedAmount,
uint256 releasedTOSAmount,
| 28,238 |
11 | // Check token balances | if ( frameToken.balanceOf(_account) < _amount || frameToken.accountLocked(_account) ) {
return false;
}
| if ( frameToken.balanceOf(_account) < _amount || frameToken.accountLocked(_account) ) {
return false;
}
| 26,645 |
19 | // FIXME: is block.number right? | balances[msg.sender][x].lastInterestBlock = block.number;
return interest;
| balances[msg.sender][x].lastInterestBlock = block.number;
return interest;
| 35,229 |
38 | // Values 0-10,000 map to 0%-100% Author's share from the owner cut. | uint256 public authorShare;
| uint256 public authorShare;
| 27,681 |
44 | // use burn() instead | && _to != 0x0)
{
piecesOwned[msg.sender] -= _amount;
piecesOwned[_to] += _amount;
Transfer(msg.sender, _to, _amount);
return true;
}
| && _to != 0x0)
{
piecesOwned[msg.sender] -= _amount;
piecesOwned[_to] += _amount;
Transfer(msg.sender, _to, _amount);
return true;
}
| 31,784 |
48 | // Nonce to ensure that old vouchers cannot be reused | uint256 nonce;
| uint256 nonce;
| 68,884 |
85 | // Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],but performing a static call. _Available since v3.3._ / | function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
| function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
| 1,419 |
329 | // Update endpoint mapping | serviceProviderEndpointToId[keccak256(bytes(_endpoint))] = newServiceProviderID;
| serviceProviderEndpointToId[keccak256(bytes(_endpoint))] = newServiceProviderID;
| 38,451 |
478 | // calculates and returns the borrow balances of the user_reserve the address of the reserve_user the address of the user return the principal borrow balance, the compounded balance and the balance increase since the last borrow/repay/swap/rebalance/ | {
CoreLibrary.UserReserveData storage user = usersReserveData[_user][_reserve];
if (user.principalBorrowBalance == 0) {
return (0, 0, 0);
}
uint256 principal = user.principalBorrowBalance;
uint256 compoundedBalance = CoreLibrary.getCompoundedBorrowBalance(
... | {
CoreLibrary.UserReserveData storage user = usersReserveData[_user][_reserve];
if (user.principalBorrowBalance == 0) {
return (0, 0, 0);
}
uint256 principal = user.principalBorrowBalance;
uint256 compoundedBalance = CoreLibrary.getCompoundedBorrowBalance(
... | 16,354 |
108 | // Return Staking interfacereturn Staking contract registered with Controller / | function staking() internal view returns (IStaking) {
return IStaking(controller.getContractProxy(keccak256("Staking")));
}
| function staking() internal view returns (IStaking) {
return IStaking(controller.getContractProxy(keccak256("Staking")));
}
| 81,666 |
1 | // Errors | error AlpacaFeeder02_InvalidToken();
error AlpacaFeeder02_InvalidRewardToken();
error AlpacaFeeder02_Deposited();
| error AlpacaFeeder02_InvalidToken();
error AlpacaFeeder02_InvalidRewardToken();
error AlpacaFeeder02_Deposited();
| 24,817 |
100 | // Sets new supply according to buy or sell | if(_buy) {
newSupply = this.totalSupply() + _tokens;
| if(_buy) {
newSupply = this.totalSupply() + _tokens;
| 2,127 |
26 | // Pause the contract. | function pause() external only(pauser) {
paused = true;
emit Paused(pauser);
}
| function pause() external only(pauser) {
paused = true;
emit Paused(pauser);
}
| 51,054 |
8 | // Current Treasury Fee | uint16 public treasuryFee;
| uint16 public treasuryFee;
| 73,263 |
101 | // used by vault cash back | function getMyVoteForCurrentMilestoneRelease(address _voter) public view returns (bool) {
// find proposal id for current milestone
uint8 recordId = MilestonesEntity.currentRecord();
bytes32 hash = getHash( getActionType("MILESTONE_DEADLINE"), bytes32( recordId ), 0 );
uint256 propos... | function getMyVoteForCurrentMilestoneRelease(address _voter) public view returns (bool) {
// find proposal id for current milestone
uint8 recordId = MilestonesEntity.currentRecord();
bytes32 hash = getHash( getActionType("MILESTONE_DEADLINE"), bytes32( recordId ), 0 );
uint256 propos... | 43,982 |
249 | // This caches the `round` variable used in shareBalances | uint256 currentRound = vaultState.round;
Vault.Withdrawal storage withdrawal = withdrawals[msg.sender];
bool withdrawalIsSameRound = withdrawal.round == currentRound;
emit InitiateWithdraw(msg.sender, numShares, currentRound);
uint256 existingShares = uint256(withdrawal.shares... | uint256 currentRound = vaultState.round;
Vault.Withdrawal storage withdrawal = withdrawals[msg.sender];
bool withdrawalIsSameRound = withdrawal.round == currentRound;
emit InitiateWithdraw(msg.sender, numShares, currentRound);
uint256 existingShares = uint256(withdrawal.shares... | 17,358 |
361 | // Deletes a sponsor's position and updates global counters. Does not make any external transfers. | function _deleteSponsorPosition(address sponsor) internal returns (FixedPoint.Unsigned memory) {
PositionData storage positionToLiquidate = _getPositionData(sponsor);
FixedPoint.Unsigned memory startingGlobalCollateral = _getFeeAdjustedCollateral(rawTotalPositionCollateral);
// Remove the ... | function _deleteSponsorPosition(address sponsor) internal returns (FixedPoint.Unsigned memory) {
PositionData storage positionToLiquidate = _getPositionData(sponsor);
FixedPoint.Unsigned memory startingGlobalCollateral = _getFeeAdjustedCollateral(rawTotalPositionCollateral);
// Remove the ... | 30,830 |
55 | // internal function | function _canOperate(address _tokenOwner) constant internal {
require(_tokenOwner == msg.sender || ownerToOperators[_tokenOwner][msg.sender]);
}
| function _canOperate(address _tokenOwner) constant internal {
require(_tokenOwner == msg.sender || ownerToOperators[_tokenOwner][msg.sender]);
}
| 12,517 |
3 | // The Erc20 asset that backs the borrows of this fyToken. / | Erc20Interface public collateral;
| Erc20Interface public collateral;
| 40,484 |
38 | // Creates a TokenVault contract that stores a token distribution. _token The address of the ERC20 token the vault is for _tokensToBeAllocated The amount of tokens that will be allocatedprior to locking _vestingPeriod The amount of time, in seconds, that must passafter locking in the allocations and then unlocking the ... | constructor(
ERC20Basic _token,
uint256 _tokensToBeAllocated,
uint256 _vestingPeriod
)
public
| constructor(
ERC20Basic _token,
uint256 _tokensToBeAllocated,
uint256 _vestingPeriod
)
public
| 45,706 |
65 | // SuperRare Hint taken from Manifold's RoyaltyEngine(https:github.com/manifoldxyz/royalty-registry-solidity/blob/main/contracts/RoyaltyEngineV1.sol) To be quite honest, SuperRare is a closed marketplace. They're working on opening it up but looks like they want to use private smart contracts. We'll just leave this her... | function tokenCreator(
address, /* contractAddress*/
uint256 tokenId
| function tokenCreator(
address, /* contractAddress*/
uint256 tokenId
| 17,604 |
78 | // The (older) MasterChef contract gives out a constant number of SYNAPSE tokens per block./ It is the only address with minting rights for SYNAPSE./ The idea for this MasterChef V2 (MCV2) contract is therefore to be the owner of a dummy token/ that is deposited into the MasterChef V1 (MCV1) contract./ The allocation p... | contract MiniChefV2 is BoringOwnable, BoringBatchable {
using BoringMath for uint256;
using BoringMath128 for uint128;
using BoringERC20 for IERC20;
using SignedSafeMath for int256;
/// @notice Info of each MCV2 user.
/// `amount` LP token amount the user has provided.
/// `rewardDebt` The ... | contract MiniChefV2 is BoringOwnable, BoringBatchable {
using BoringMath for uint256;
using BoringMath128 for uint128;
using BoringERC20 for IERC20;
using SignedSafeMath for int256;
/// @notice Info of each MCV2 user.
/// `amount` LP token amount the user has provided.
/// `rewardDebt` The ... | 38,943 |
64 | // Structure representing the signature parts. r ECDSA signature parameter r. s ECDSA signature parameter s. v ECDSA signature parameter v. kind Type of signature. / | struct SignatureData
| struct SignatureData
| 42,019 |
219 | // user needs to contribute proportional amount of fees to pool, which ensures they are only earning fees generated after they have deposited | if (totalSupply() > 0) {
| if (totalSupply() > 0) {
| 36,393 |
193 | // ========== Internal Inheritance ========== // ========== Internal Interfaces ========== /// | contract SigmaIndexPoolV1 is BToken, BMath, IIndexPool {
/* ========== Modifiers ========== */
modifier _lock_ {
require(!_mutex, "ERR_REENTRY");
_mutex = true;
_;
_mutex = false;
}
modifier _viewlock_() {
require(!_mutex, "ERR_REENTRY");
_;
}
modifier _control_ {
require(msg.... | contract SigmaIndexPoolV1 is BToken, BMath, IIndexPool {
/* ========== Modifiers ========== */
modifier _lock_ {
require(!_mutex, "ERR_REENTRY");
_mutex = true;
_;
_mutex = false;
}
modifier _viewlock_() {
require(!_mutex, "ERR_REENTRY");
_;
}
modifier _control_ {
require(msg.... | 12,447 |
5 | // True when token URI contract can no longer be changed | bool public tokenURIFrozen;
| bool public tokenURIFrozen;
| 7,875 |
84 | // DOTX lib mainly uses for Chainlink | dotxLibAddress = dotxLibAddr;
dotxLib = IDoTxLib(dotxLibAddress);
if(setupAddressInLib){
dotxLib.setDoTxGame(address(this));
}
| dotxLibAddress = dotxLibAddr;
dotxLib = IDoTxLib(dotxLibAddress);
if(setupAddressInLib){
dotxLib.setDoTxGame(address(this));
}
| 12,169 |
20 | // return the balance of the tokens being held. / | function balance() public view returns (uint256) {
return _token.balanceOf(address(this));
}
| function balance() public view returns (uint256) {
return _token.balanceOf(address(this));
}
| 15,349 |
70 | // Emitted after reward added | event RewardAdded(address indexed rewardToken, uint256 reward, uint256 rewardDuration);
| event RewardAdded(address indexed rewardToken, uint256 reward, uint256 rewardDuration);
| 28,856 |
3 | // solium-disable-next-line security/no-assign-params | function uint2str(uint256 _i) internal pure returns (string memory) {
if (_i == 0) {
return "0";
}
uint256 j = _i;
uint256 len;
while (j != 0) {
len++;
j /= 10;
}
bytes memory bstr = new bytes(len);
uint256 k = len -... | function uint2str(uint256 _i) internal pure returns (string memory) {
if (_i == 0) {
return "0";
}
uint256 j = _i;
uint256 len;
while (j != 0) {
len++;
j /= 10;
}
bytes memory bstr = new bytes(len);
uint256 k = len -... | 30,537 |
13 | // number token we are going to provide in one ethereum | uint256 public tokenPerEth = 5000;
| uint256 public tokenPerEth = 5000;
| 33,363 |
199 | // mark the tokenURI token as minted | mintedTokens[uriHash] = true;
| mintedTokens[uriHash] = true;
| 32,353 |
126 | // StakedToken Contract to stake Roya token, tokenize the position and get rewards, inheriting from a distribution manager contract Roya / | contract StakedToken is IStakedRoya, ERC20WithSnapshot, VersionedInitializable, RoyaDistributionManager {
using SafeERC20 for IERC20;
uint256 public constant REVISION = 1;
IERC20 public immutable STAKED_TOKEN;
IERC20 public immutable REWARD_TOKEN;
uint256 public immutable COOLDOWN_SECONDS;
/// @notice Se... | contract StakedToken is IStakedRoya, ERC20WithSnapshot, VersionedInitializable, RoyaDistributionManager {
using SafeERC20 for IERC20;
uint256 public constant REVISION = 1;
IERC20 public immutable STAKED_TOKEN;
IERC20 public immutable REWARD_TOKEN;
uint256 public immutable COOLDOWN_SECONDS;
/// @notice Se... | 24,990 |
156 | // - extract Merkle root field from a raw Dogecoin block header_blockHeader - Dogecoin block header bytespos - where to start reading root from return - block's Merkle root in big endian format | function getHeaderMerkleRoot(bytes memory _blockHeader, uint pos) public pure returns (uint) {
uint merkle;
assembly {
merkle := mload(add(add(_blockHeader, 0x44), pos))
}
return flip32Bytes(merkle);
}
| function getHeaderMerkleRoot(bytes memory _blockHeader, uint pos) public pure returns (uint) {
uint merkle;
assembly {
merkle := mload(add(add(_blockHeader, 0x44), pos))
}
return flip32Bytes(merkle);
}
| 38,127 |
17 | // allow the seller to send funds in the offer they may also send funds directly to the contract (fallback function) | self.accountLib.depositToSeller();
| self.accountLib.depositToSeller();
| 37,937 |
32 | // DAAContract, TicketContract, CitizenContract | function joinNetwork(address[3] _contract)
public
| function joinNetwork(address[3] _contract)
public
| 10,316 |
41 | // welp you are here now, only have high card? boring | output[0]=1;
currcard=1;
for (i=13;i>=1;i--){
if (CardTracker[i]>0){
output[currcard]=i;
currcard++;
if (currcard==6){
return output;
}
| output[0]=1;
currcard=1;
for (i=13;i>=1;i--){
if (CardTracker[i]>0){
output[currcard]=i;
currcard++;
if (currcard==6){
return output;
}
| 42,979 |
22 | // Update the rewards of caller, and harvests if needed | function _updateUserReward(uint256 _pid, bool _shouldHarvest) internal {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount == 0) {
user.lastPawPerShare = pool.accPawPerShare;
}
uin... | function _updateUserReward(uint256 _pid, bool _shouldHarvest) internal {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount == 0) {
user.lastPawPerShare = pool.accPawPerShare;
}
uin... | 12,974 |
35 | // ´:°•.°+.•´.:˚.°.˚•´.°:°•.°•.•´.:˚.°.˚•´.°:°•.°+.•´.:// READ LOGIC //.•°:°.´+˚.°.˚:.´•.+°.•°:´.´•.•°.•°:°.´:•˚°.°.˚:.´+°.•//Returns all the `data` from the bytecode of the storage contract at `pointer`. | function read(address pointer) internal view returns (bytes memory data) {
/// @solidity memory-safe-assembly
assembly {
let pointerCodesize := extcodesize(pointer)
if iszero(pointerCodesize) {
// Store the function selector of `InvalidPointer()`.
... | function read(address pointer) internal view returns (bytes memory data) {
/// @solidity memory-safe-assembly
assembly {
let pointerCodesize := extcodesize(pointer)
if iszero(pointerCodesize) {
// Store the function selector of `InvalidPointer()`.
... | 40,995 |
65 | // Constant flow agreement v1 library Superfluid for working with the constant flow agreement within solidity the first set of functions are each for callAgreement() the second set of functions are each for use in callAgreementWithContext() / | library CFAv1Library {
/**
* @dev Initialization data
* @param host Superfluid host for calling agreements
* @param cfa Constant Flow Agreement contract
*/
struct InitData {
ISuperfluid host;
IConstantFlowAgreementV1 cfa;
}
/**
* @dev Create flow without userDa... | library CFAv1Library {
/**
* @dev Initialization data
* @param host Superfluid host for calling agreements
* @param cfa Constant Flow Agreement contract
*/
struct InitData {
ISuperfluid host;
IConstantFlowAgreementV1 cfa;
}
/**
* @dev Create flow without userDa... | 23,074 |
20 | // The refundCompleted function updates the campaign status after the refunds are processed.If the reason is "DELETED", the campaign status is set to "DELETED".If the reason is "REVERTING", the campaign status is updated based on the remaining active backers. _id The ID of the campaign. _reason The reason for the refun... | function refundCompleted(uint _id, string memory _reason) internal {
if (keccak256(bytes(_reason)) == keccak256(bytes("DELETED"))) {
campaigns[_id].campaignStatus = campaignStatusEnum.DELETED;
numberOfCampaignsExcludeRefund -= 1; // dời ra ngoài vì sau khi refund hết backers của 1 ca... | function refundCompleted(uint _id, string memory _reason) internal {
if (keccak256(bytes(_reason)) == keccak256(bytes("DELETED"))) {
campaigns[_id].campaignStatus = campaignStatusEnum.DELETED;
numberOfCampaignsExcludeRefund -= 1; // dời ra ngoài vì sau khi refund hết backers của 1 ca... | 23,009 |
29 | // Confirm new address is signed by current address | bytes32 _currentAddressDigest = signingLogic.generateAddAddressSchemaHash(_newAddress, _nonce);
require(_sender == signingLogic.recoverSigner(_currentAddressDigest, _senderSig));
| bytes32 _currentAddressDigest = signingLogic.generateAddAddressSchemaHash(_newAddress, _nonce);
require(_sender == signingLogic.recoverSigner(_currentAddressDigest, _senderSig));
| 12,301 |
1 | // The OpenSea operator filter registry. | address internal constant _OPERATOR_FILTER_REGISTRY = 0x000000000000AAeB6D7670E522A718067333cd4E;
| address internal constant _OPERATOR_FILTER_REGISTRY = 0x000000000000AAeB6D7670E522A718067333cd4E;
| 22,366 |
38 | // Player has won their wager back | profit = spin.tokenValue;
emit ReturnBet(target);
| profit = spin.tokenValue;
emit ReturnBet(target);
| 8,948 |
1 | // Address of the accepted token for ReplyTicket payment (i.e. ReplyCoin) | address _tokenContract;
| address _tokenContract;
| 7,319 |
3 | // Transfers ownership of the contract to a new account (`newOwner`). This caninclude renouncing ownership by transferring to the zero address.Can only be called by the current owner. / | function transferOwnership(address newOwner) external;
| function transferOwnership(address newOwner) external;
| 29,928 |
8 | // Modifier allows functions calls only when contract is not initialized. / | modifier whenNotInitialized() {
require(!initialized, "Nexus is already initialized");
_;
}
| modifier whenNotInitialized() {
require(!initialized, "Nexus is already initialized");
_;
}
| 31,923 |
72 | // Originating wallet for yield payments | address internal yieldWallet;
| address internal yieldWallet;
| 36,356 |
19 | // Get the number of available Noun `glasses`. / | function glassesCount() external view override returns (uint256) {
return art.getGlassesTrait().storedImagesCount;
}
| function glassesCount() external view override returns (uint256) {
return art.getGlassesTrait().storedImagesCount;
}
| 39,381 |
212 | // encode data for FL | bytes memory recipeData = abi.encode(_currRecipe, address(this));
IFlashLoanBase.FlashLoanParams memory params = abi.decode(
_currRecipe.callData[0],
(IFlashLoanBase.FlashLoanParams)
);
params.recipeData = recipeData;
_currRecipe.callData[0] = abi.encode(p... | bytes memory recipeData = abi.encode(_currRecipe, address(this));
IFlashLoanBase.FlashLoanParams memory params = abi.decode(
_currRecipe.callData[0],
(IFlashLoanBase.FlashLoanParams)
);
params.recipeData = recipeData;
_currRecipe.callData[0] = abi.encode(p... | 12,438 |
3 | // requestVolumeData(rand_a, rand_b); |
qlist[Qcount].title=coinlist[rand_a].title;
qlist[Qcount].story=coinlist[rand_a].story;
qlist[Qcount].question=Qtopic[rand_b];
qlist[Qcount].revealTime=now;
qlist[Qcount].lifeLength=7;
qlist[Qcount].property="Crypto";
|
qlist[Qcount].title=coinlist[rand_a].title;
qlist[Qcount].story=coinlist[rand_a].story;
qlist[Qcount].question=Qtopic[rand_b];
qlist[Qcount].revealTime=now;
qlist[Qcount].lifeLength=7;
qlist[Qcount].property="Crypto";
| 14,001 |
198 | // Return job info _jobId Job identifier / | function getJob(
uint256 _jobId
)
public
view
returns (string streamId, string transcodingOptions, uint256 maxPricePerSegment, address broadcasterAddress, address transcoderAddress, uint256 creationRound, uint256 creationBlock, uint256 endBlock, uint256 escrow, uint256 totalClaim... | function getJob(
uint256 _jobId
)
public
view
returns (string streamId, string transcodingOptions, uint256 maxPricePerSegment, address broadcasterAddress, address transcoderAddress, uint256 creationRound, uint256 creationBlock, uint256 endBlock, uint256 escrow, uint256 totalClaim... | 50,919 |
30 | // already joined | return Error.NO_ERROR;
| return Error.NO_ERROR;
| 16,353 |
24 | // All Aave math performed in RAY (1e27). | return liquidityRate / 1e9;
| return liquidityRate / 1e9;
| 29,681 |
168 | // Add | uint256 id = authorizedContractList.push(false);
authorizedContractIds[_contract] = id;
authorizedContracts[id] = AuthorizedContract(_name, _contract);
| uint256 id = authorizedContractList.push(false);
authorizedContractIds[_contract] = id;
authorizedContracts[id] = AuthorizedContract(_name, _contract);
| 68,095 |
103 | // If you somehow manage to free yourself from that Rat Trap, you may go on living. | function removeRatTrap(address account) public onlyOwner {
inRatTrap[account] = false;
emit RatReleased(account);
}
| function removeRatTrap(address account) public onlyOwner {
inRatTrap[account] = false;
emit RatReleased(account);
}
| 39,615 |
30 | // Note that this pool has no minter key of BpEUR (rewards). Instead, the governance will call BpEUR distributeReward method and send reward to this pool at the beginning. | contract bpEURRewardPool {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// governance
address public operator;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation bel... | contract bpEURRewardPool {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// governance
address public operator;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation bel... | 40,383 |
66 | // Private implementation of staking methods. staker User address who deposits tokens to stake. beneficiary User address who gains credit for this stake operation. amount Number of deposit tokens to stake. / | function _stakeFor(address staker, address beneficiary, uint256 amount) private {
require(amount > 0, 'SwingySeesaw: stake amount is zero');
require(beneficiary != address(0), 'SwingySeesaw: beneficiary is zero address');
require(totalStakingShares == 0 || totalStaked() > 0,
... | function _stakeFor(address staker, address beneficiary, uint256 amount) private {
require(amount > 0, 'SwingySeesaw: stake amount is zero');
require(beneficiary != address(0), 'SwingySeesaw: beneficiary is zero address');
require(totalStakingShares == 0 || totalStaked() > 0,
... | 14,364 |
335 | // harvest must be a controlled function b/c engages with uniswap in mean time, can gain sushi rewards via xsushi on sushi gained from depositing into masterchef mid term | function midTermDepositLp(IERC20 pool, uint256 _lpTokens) internal {
PoolData storage poolData = pools[address(pool)];
uint256 sushiAmt = sushiToken.balanceOf(address(this));
pool.ondoSafeIncreaseAllowance(address(masterChef), _lpTokens);
masterChef.deposit(pools[address(pool)].pid, _lpTokens);
su... | function midTermDepositLp(IERC20 pool, uint256 _lpTokens) internal {
PoolData storage poolData = pools[address(pool)];
uint256 sushiAmt = sushiToken.balanceOf(address(this));
pool.ondoSafeIncreaseAllowance(address(masterChef), _lpTokens);
masterChef.deposit(pools[address(pool)].pid, _lpTokens);
su... | 81,194 |
262 | // Tells the proxy type (EIP 897)return proxyTypeId Proxy type, 2 for forwarding proxy / | function proxyType() public pure override returns (uint256 proxyTypeId) {
return 2;
}
| function proxyType() public pure override returns (uint256 proxyTypeId) {
return 2;
}
| 20,812 |
22 | // It should either call `exampleExternalContract.complete{value: address(this).balance}()` to send all the value Send ETH to external contract |
require(address(this).balance >= threshold, "Not enough ETH staked");
|
require(address(this).balance >= threshold, "Not enough ETH staked");
| 7,112 |
205 | // returns the ether KTY price on uniswap, that is, how many KTYs for 1 ether / | function ETH_KTY_price() public view returns (uint256) {
uint256 _amountETH = 1e18; // 1 KTY
(uint256 _reserveKTY, uint256 _reserveETH) = getReserve(kittieFightTokenAddr, wethAddr, ktyWethPair);
return UniswapV2Library.getAmountIn(_amountETH, _reserveKTY, _reserveETH);
}
| function ETH_KTY_price() public view returns (uint256) {
uint256 _amountETH = 1e18; // 1 KTY
(uint256 _reserveKTY, uint256 _reserveETH) = getReserve(kittieFightTokenAddr, wethAddr, ktyWethPair);
return UniswapV2Library.getAmountIn(_amountETH, _reserveKTY, _reserveETH);
}
| 44,181 |
163 | // How long each inflation period is before mint can be called | uint public constant MINT_PERIOD_DURATION = 1 weeks;
uint public constant INFLATION_START_DATE = 1551830400; // 2019-03-06T00:00:00+00:00
uint public constant MINT_BUFFER = 1 days;
uint8 public constant SUPPLY_DECAY_START = 40; // Week 40
uint8 public constant SUPPLY_DECAY_END = 234; // Supply Dec... | uint public constant MINT_PERIOD_DURATION = 1 weeks;
uint public constant INFLATION_START_DATE = 1551830400; // 2019-03-06T00:00:00+00:00
uint public constant MINT_BUFFER = 1 days;
uint8 public constant SUPPLY_DECAY_START = 40; // Week 40
uint8 public constant SUPPLY_DECAY_END = 234; // Supply Dec... | 4,872 |
314 | // Resolves an offset stored at `cdPtr` to a calldata pointer./`cdPtr` must point to some parent object with a dynamic type as its | /// first member, e.g. `struct { bytes data; }`
function pptr(
CalldataPointer cdPtr
) internal pure returns (CalldataPointer cdPtrChild) {
cdPtrChild = cdPtr.offset(cdPtr.readUint256() & OffsetOrLengthMask);
}
| /// first member, e.g. `struct { bytes data; }`
function pptr(
CalldataPointer cdPtr
) internal pure returns (CalldataPointer cdPtrChild) {
cdPtrChild = cdPtr.offset(cdPtr.readUint256() & OffsetOrLengthMask);
}
| 40,218 |
214 | // ORACLIZE IMPLEMENTATION //Converts 'uint' to 'string' / | function uint2str(uint256 i) internal pure returns(string) {
if (i == 0) return "0";
uint256 j = i;
uint256 len;
while (j != 0){
len++;
j /= 10;
}
bytes memory bstr = new bytes(len);
uint256 k = len - 1;
while (i != 0){
... | function uint2str(uint256 i) internal pure returns(string) {
if (i == 0) return "0";
uint256 j = i;
uint256 len;
while (j != 0){
len++;
j /= 10;
}
bytes memory bstr = new bytes(len);
uint256 k = len - 1;
while (i != 0){
... | 26,045 |
106 | // Usually a temp variable when compounding | mapping(address => uint256) pendingRewards;
| mapping(address => uint256) pendingRewards;
| 34,161 |
394 | // Standard implementation of ERC20's transferFrom()./ Overridden to allow arbitrary logic in ComptrollerProxy prior to transfer. | function transferFrom(
address _sender,
address _recipient,
uint256 _amount
) public override returns (bool success_) {
__invokePreTransferSharesHook(_sender, _recipient, _amount);
return super.transferFrom(_sender, _recipient, _amount);
}
| function transferFrom(
address _sender,
address _recipient,
uint256 _amount
) public override returns (bool success_) {
__invokePreTransferSharesHook(_sender, _recipient, _amount);
return super.transferFrom(_sender, _recipient, _amount);
}
| 38,842 |
7 | // address owner, | string memory MedicineName,
uint256 NationalDrugCode,
string[] memory Conditions,
address Manufacturer,
string memory Quantity,
string memory status,
string[] memory Ingredients,
string[] memory sideEffects,
string memory ExpiryDate,
| string memory MedicineName,
uint256 NationalDrugCode,
string[] memory Conditions,
address Manufacturer,
string memory Quantity,
string memory status,
string[] memory Ingredients,
string[] memory sideEffects,
string memory ExpiryDate,
| 18,357 |
289 | // reverse iteration since we're removing from the list | for (uint256 i = length; i > 0; i--) {
uint256 index = i - 1;
if (expirationTimes[index] > time()) {
continue;
}
| for (uint256 i = length; i > 0; i--) {
uint256 index = i - 1;
if (expirationTimes[index] > time()) {
continue;
}
| 33,942 |
50 | // check if timestamp is falling in the range | bool validTimestamp = startingTimestamp <= block.timestamp && endingTimestamp >= block.timestamp;
| bool validTimestamp = startingTimestamp <= block.timestamp && endingTimestamp >= block.timestamp;
| 42,438 |
267 | // Purchase senior token through delegacy to get fidu inside the delegacy _amount the amount of usdc to purchase by / | function purchaseSeniorTokens(uint256 _amount) external onlyOwner {
require(_amount > 0, "Must deposit more than zero");
goldfinchDelegacy.purchaseSeniorTokens(_amount);
emit PurchaseSenior(_amount);
}
| function purchaseSeniorTokens(uint256 _amount) external onlyOwner {
require(_amount > 0, "Must deposit more than zero");
goldfinchDelegacy.purchaseSeniorTokens(_amount);
emit PurchaseSenior(_amount);
}
| 38,696 |
15 | // CPD | {
(EventType eventType, uint256 scheduleTimeOffset) = decodeEvent(ICERTFEngine(asset.engine).computeNextCyclicEvent(
terms,
asset.schedule.lastScheduleTimeOfCyclicEvent[EventType.CPD],
EventType.CPD
));
if (
(ne... | {
(EventType eventType, uint256 scheduleTimeOffset) = decodeEvent(ICERTFEngine(asset.engine).computeNextCyclicEvent(
terms,
asset.schedule.lastScheduleTimeOfCyclicEvent[EventType.CPD],
EventType.CPD
));
if (
(ne... | 40,025 |
21 | // only addresses/roles configured with functionHash are allowed to call/internally it calls canPerform()/_functionStr functioHash | modifier authFunctionHash(string _functionStr) {
require(msg.sender == address(this) || canPerform(msg.sender, _functionStr));
_;
}
| modifier authFunctionHash(string _functionStr) {
require(msg.sender == address(this) || canPerform(msg.sender, _functionStr));
_;
}
| 20,927 |
55 | // Give the contract crowdsale amount | balances[this] = CROWDSALE_AMOUNT;
| balances[this] = CROWDSALE_AMOUNT;
| 23,406 |
135 | // Modifies an assetClassSets the immutable data on an ACNodeRequires that:caller holds ACtokenACnode is managementType 255 (unconfigured) / | function updateACImmutable(
| function updateACImmutable(
| 34,204 |
8 | // ============ Internal functions ============/ Return true if the given domain / router is the address of a remote xApp Router _domain The domain of the potential remote xApp Router _router The address of the potential remote xApp Router / | function _isRemoteRouter(uint32 _domain, bytes32 _router)
internal
view
returns (bool)
| function _isRemoteRouter(uint32 _domain, bytes32 _router)
internal
view
returns (bool)
| 31,021 |
11 | // sets the base uri used by tokenURI() | function setBaseURI(string calldata _uri) external onlyOwner
| function setBaseURI(string calldata _uri) external onlyOwner
| 57,368 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.