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 |
|---|---|---|---|---|
27 | // Transfer token to a specified address. to The address to transfer to. value The amount to be transferred. / | function transfer(address to, uint256 value) public override returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
| function transfer(address to, uint256 value) public override returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
| 34,574 |
2 | // Returns the role-member from a list of members for a role, at a given index. Returns `member` who has `role`, at `index` of role-members list. See struct {RoleMembers}, and mapping {roleMembers} role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")indexIndex in list of current members for the role.return ... | function getRoleMember(bytes32 role, uint256 index) external view override returns (address member) {
uint256 currentIndex = roleMembers[role].index;
uint256 check;
for (uint256 i = 0; i < currentIndex; i += 1) {
if (roleMembers[role].members[i] != address(0)) {
... | function getRoleMember(bytes32 role, uint256 index) external view override returns (address member) {
uint256 currentIndex = roleMembers[role].index;
uint256 check;
for (uint256 i = 0; i < currentIndex; i += 1) {
if (roleMembers[role].members[i] != address(0)) {
... | 16,635 |
6 | // Returns the asset price in ETH. symbol. Asset symbol. For ex. "DAI".return Price in ETH with 8 decimal digits. / | function tokEthPrice(string calldata symbol) external returns (uint256);
| function tokEthPrice(string calldata symbol) external returns (uint256);
| 52,244 |
230 | // Remove the fee set for an app_appId App identifier/ | function unsetAppFee(bytes32 _appId) external;
| function unsetAppFee(bytes32 _appId) external;
| 38,787 |
2 | // todo: validate |
_requestId = oracleRequests.length;
oracleRequests.push();
|
_requestId = oracleRequests.length;
oracleRequests.push();
| 22,946 |
11 | // The AO set the NameTAOPosition Address _nameTAOPositionAddress The address of NameTAOPosition / | function setNameTAOPositionAddress(address _nameTAOPositionAddress) public onlyTheAO {
require (_nameTAOPositionAddress != address(0));
nameTAOPositionAddress = _nameTAOPositionAddress;
}
| function setNameTAOPositionAddress(address _nameTAOPositionAddress) public onlyTheAO {
require (_nameTAOPositionAddress != address(0));
nameTAOPositionAddress = _nameTAOPositionAddress;
}
| 16,125 |
127 | // Create lock using permit | function createLockWithPermit(
uint256 _value,
uint256 _unlockTime,
uint256 _deadline,
uint8 _v,
bytes32 _r,
bytes32 _s
) external returns (uint256 lockId);
| function createLockWithPermit(
uint256 _value,
uint256 _unlockTime,
uint256 _deadline,
uint8 _v,
bytes32 _r,
bytes32 _s
) external returns (uint256 lockId);
| 59,906 |
23 | // There is only 100m Orion tokens, fits i64 | require(_orionAmount == int64(_orionAmount), "E11");
int192 onBalanceOrion = assetBalances[user][orionTokenAddress];
require(onBalanceOrion >= _orionAmount, "E10");
assetBalances[user][orionTokenAddress] -= _orionAmount;
assetBalances[liquidator][orionTokenAddress] += _orionAmou... | require(_orionAmount == int64(_orionAmount), "E11");
int192 onBalanceOrion = assetBalances[user][orionTokenAddress];
require(onBalanceOrion >= _orionAmount, "E10");
assetBalances[user][orionTokenAddress] -= _orionAmount;
assetBalances[liquidator][orionTokenAddress] += _orionAmou... | 19,466 |
75 | // Expose vault function that decrement user's balance in the vaultOnly available to system modules. _tokensThe addresses of the ERC20 tokens_owner The address of the token owner_quantitiesThe numbers of tokens to attribute to owner / | function batchDecrementTokenOwnerModule(
| function batchDecrementTokenOwnerModule(
| 18,115 |
53 | // PRDZ token contract address | address public constant tokenAddress = 0x4e085036A1b732cBe4FfB1C12ddfDd87E7C3664d;
address public constant burnAddress = 0x0000000000000000000000000000000000000000;
| address public constant tokenAddress = 0x4e085036A1b732cBe4FfB1C12ddfDd87E7C3664d;
address public constant burnAddress = 0x0000000000000000000000000000000000000000;
| 3,049 |
11 | // ==========Events========== |
event Deposit(address indexed user, uint256 indexed pid, uint256 amount, address indexed to);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount, address indexed to);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount, address indexed to);
event Harvest(addr... |
event Deposit(address indexed user, uint256 indexed pid, uint256 amount, address indexed to);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount, address indexed to);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount, address indexed to);
event Harvest(addr... | 71,170 |
112 | // Updates the pending claim start variable,the lowest claim id with a pending decision/payout. / | function setpendingClaimStart(uint _start) external onlyInternal {
require(pendingClaimStart <= _start);
pendingClaimStart = _start;
}
| function setpendingClaimStart(uint _start) external onlyInternal {
require(pendingClaimStart <= _start);
pendingClaimStart = _start;
}
| 82,010 |
60 | // Check if there&39;s an active campaign | function active() public view returns(bool) {
if(campaigns.length == 0) {
return false;
} else {
return campaigns[lastCampaignID].deadline >= now;
}
}
| function active() public view returns(bool) {
if(campaigns.length == 0) {
return false;
} else {
return campaigns[lastCampaignID].deadline >= now;
}
}
| 39,016 |
7 | // Function called by the sender, receiver or a delegate, with all the neededsignatures to close the channel immediately. receiver The address that receives tokens. blockNumber The block number at which a channel was created. balance The amount of tokens owed by the sender to the receiver. senderBalanceSign The sender'... | function closeChannel(address receiver, uint32 blockNumber, uint192 balance, bytes calldata senderBalanceSign, bytes calldata receiverBalanceSign) external {
address senderAddr = extractBalanceProofSignature(
receiver,
blockNumber,
balance,
senderBala... | function closeChannel(address receiver, uint32 blockNumber, uint192 balance, bytes calldata senderBalanceSign, bytes calldata receiverBalanceSign) external {
address senderAddr = extractBalanceProofSignature(
receiver,
blockNumber,
balance,
senderBala... | 21,505 |
206 | // A onchain reference to accounts which have been lost/hacked etc | mapping(address => bool) public reportedArtistAccounts;
| mapping(address => bool) public reportedArtistAccounts;
| 23,024 |
415 | // lockdays are passed as seconds | function deleteLockMultiplier(uint256 lockDays) external onlyOwner {
delete lockMultipliers[lockDays];
}
| function deleteLockMultiplier(uint256 lockDays) external onlyOwner {
delete lockMultipliers[lockDays];
}
| 52,936 |
7 | // cash | Operator(cash).transferOperator(target);
Operator(cash).transferOwnership(target);
ICustomERC20(cash).transfer(
target,
ICustomERC20(cash).balanceOf(address(this))
);
| Operator(cash).transferOperator(target);
Operator(cash).transferOwnership(target);
ICustomERC20(cash).transfer(
target,
ICustomERC20(cash).balanceOf(address(this))
);
| 24,945 |
36 | // mask out the bit relevant for Dice game | mask = gameOptions & GAME_OPTIONS_DICE_MASK_BITS;
| mask = gameOptions & GAME_OPTIONS_DICE_MASK_BITS;
| 37,363 |
112 | // Triggers stopped state Only possible when contract not paused. / | function pause() external onlyAdmin whenNotPaused {
_pause();
emit Pause();
}
| function pause() external onlyAdmin whenNotPaused {
_pause();
emit Pause();
}
| 28,845 |
176 | // As a winner, check price (wei) to pay for the artworknftId - nftId of the artwork / | function getArtworkPrice(uint nftId) public view returns (uint) {
require(
_winners[nftId] == msg.sender,
"Caller does not have Winner Access"
);
uint eth_eur = getThePrice_eth_eur();
uint wei2pay = 1e18 wei * _winnerCostsEuroCents[nftId] / ( eth_eur * 100 );
... | function getArtworkPrice(uint nftId) public view returns (uint) {
require(
_winners[nftId] == msg.sender,
"Caller does not have Winner Access"
);
uint eth_eur = getThePrice_eth_eur();
uint wei2pay = 1e18 wei * _winnerCostsEuroCents[nftId] / ( eth_eur * 100 );
... | 50,034 |
27 | // check uint in claimable mapping for msg.sender and transfer erc20 to msg.sender | require(
presaleContract.claimable(msg.sender) > 0,
"No tokens to be claimed"
);
require(isClaimed[msg.sender] == false, "Tokens already claimed");
uint256 amount = presaleContract.claimable(msg.sender);
isClaimed[msg.sender] = true;
token.transfer... | require(
presaleContract.claimable(msg.sender) > 0,
"No tokens to be claimed"
);
require(isClaimed[msg.sender] == false, "Tokens already claimed");
uint256 amount = presaleContract.claimable(msg.sender);
isClaimed[msg.sender] = true;
token.transfer... | 14,271 |
29 | // Get current bonus rate. Override the base function from StandardTokenCrowdsale _weiAmount Value in wei to be converted into bonus tokensreturn Number of bonus tokens that will be awarded for a purchase of _weiAmount / | function _getBonusTokenAmount(uint256 _weiAmount) internal view returns (uint256)
| function _getBonusTokenAmount(uint256 _weiAmount) internal view returns (uint256)
| 22,307 |
165 | // creates a Token.Instance record and initializes the ElasticGovernanceToken. _controller the address which can control the core DAO functions _name name of the token _symbol symbol of the token _eByL initial ETH/token ratio _elasticity the percentage by which capitalDelta should increase _k a constant, initially set ... | function _buildToken(
address _controller,
string memory _name,
string memory _symbol,
uint256 _eByL,
uint256 _elasticity,
uint256 _k,
uint256 _maxLambdaPurchase,
Ecosystem.Instance memory _ecosystem
| function _buildToken(
address _controller,
string memory _name,
string memory _symbol,
uint256 _eByL,
uint256 _elasticity,
uint256 _k,
uint256 _maxLambdaPurchase,
Ecosystem.Instance memory _ecosystem
| 15,552 |
44 | // NOTE: move event up here, avoid stack too deep if too many approved tokens | emit SummonComplete(_summoner, _approvedTokens, block.timestamp, _periodDuration, _votingPeriodLength, _gracePeriodLength, _proposalDeposit, _dilutionBound, _processingReward);
for (uint256 i = 0; i < _approvedTokens.length; i++) {
require(_approvedTokens[i] != address(0), "_approvedToken ... | emit SummonComplete(_summoner, _approvedTokens, block.timestamp, _periodDuration, _votingPeriodLength, _gracePeriodLength, _proposalDeposit, _dilutionBound, _processingReward);
for (uint256 i = 0; i < _approvedTokens.length; i++) {
require(_approvedTokens[i] != address(0), "_approvedToken ... | 10,114 |
108 | // do withdraw | _withdraw(cut, value, spenders);
| _withdraw(cut, value, spenders);
| 9,073 |
36 | // signsee{Sign}./ Requirements- owner sign verification failed when signture was mismatched. / |
function verifySign(
string memory _tokenURI,
address caller,
Sign memory sign
) internal view {
bytes32 hash = keccak256(
abi.encodePacked(this, caller, _tokenURI, sign.nonce)
);
require(
|
function verifySign(
string memory _tokenURI,
address caller,
Sign memory sign
) internal view {
bytes32 hash = keccak256(
abi.encodePacked(this, caller, _tokenURI, sign.nonce)
);
require(
| 15,225 |
0 | // BurnableTokenInterface for Basic ERC20 interactions and allowing burningof tokens (c) Philip Louw / Zero Carbon Project 2018. The MIT Licence. / | contract ERC20Burnable is ERC20Basic {
function burn(uint256 _value) public;
} | contract ERC20Burnable is ERC20Basic {
function burn(uint256 _value) public;
} | 20,236 |
18 | // Public grant tokens administrative function / | function tokenGrantVestedTokens(
address _token,
address _to,
uint256 _value,
uint64 _start,
uint64 _cliff,
uint64 _vesting,
bool _revokable,
bool _burnsOnRevoke
) public
| function tokenGrantVestedTokens(
address _token,
address _to,
uint256 _value,
uint64 _start,
uint64 _cliff,
uint64 _vesting,
bool _revokable,
bool _burnsOnRevoke
) public
| 18,998 |
40 | // ------------------------------------------------------------------------ Transfer the balance from owner's account to another account, with a check that the crowdsale is finalised ------------------------------------------------------------------------ | function transfer(address _to, uint _amount) returns (bool success) {
// Cannot transfer before crowdsale ends or cap reached
require(now > ENDDATE || totalEthers == CAP);
// Standard transfer
return super.transfer(_to, _amount);
}
| function transfer(address _to, uint _amount) returns (bool success) {
// Cannot transfer before crowdsale ends or cap reached
require(now > ENDDATE || totalEthers == CAP);
// Standard transfer
return super.transfer(_to, _amount);
}
| 9,738 |
67 | // Access for adding deposit. | mapping(address => bool) private depositAccess;
| mapping(address => bool) private depositAccess;
| 2,057 |
1 | // max size of voucher metadata memory range 32(2^16) bytes | uint256 constant VOUCHER_METADATA_LOG2_SIZE = 21;
| uint256 constant VOUCHER_METADATA_LOG2_SIZE = 21;
| 49,736 |
202 | // Load the 32 bytes word from memory with the address on the lower 20 bytes, and mask those. | sender := and(
mload(add(array, index)),
0xffffffffffffffffffffffffffffffffffffffff
)
| sender := and(
mload(add(array, index)),
0xffffffffffffffffffffffffffffffffffffffff
)
| 22,752 |
23 | // Transfer token for a specified addressto The address to transfer to.value The amount to be transferred./ | function transfer(address to, uint256 value) public virtual override returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
| function transfer(address to, uint256 value) public virtual override returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
| 66,054 |
76 | // Sell the balance accumulated from taxes. / | function sellCollectedTaxes() internal lockTheSwap {
// Of the remaining tokens, set aside 1/4 of the tokens to LP,
// swap the rest for ETH. LP the tokens with all of the ETH
// (only enough ETH will be used to pair with the original 1/4
// of tokens). Send the remaining ETH (about ... | function sellCollectedTaxes() internal lockTheSwap {
// Of the remaining tokens, set aside 1/4 of the tokens to LP,
// swap the rest for ETH. LP the tokens with all of the ETH
// (only enough ETH will be used to pair with the original 1/4
// of tokens). Send the remaining ETH (about ... | 6,193 |
103 | // max amount to be withdrawn is the releasable amount, excess stays in lock-up, unless all lock-ups have ended solium-disable-next-line security/no-block-members | if(balances[msg.sender] >= unreleased && lockupEndTime[lockupEndTime.length-1] > now)
{
tobeReleased = unreleased;
}
| if(balances[msg.sender] >= unreleased && lockupEndTime[lockupEndTime.length-1] > now)
{
tobeReleased = unreleased;
}
| 47,065 |
46 | // Returns whether the specified token exists _tokenId uint ID of the token to query the existence ofreturn whether the token exists / | function exists(uint _tokenId) public view returns (bool) {
address owner = core.tokenToOwner(tokenIsChamp,_tokenId);
return owner != address(0);
}
| function exists(uint _tokenId) public view returns (bool) {
address owner = core.tokenToOwner(tokenIsChamp,_tokenId);
return owner != address(0);
}
| 38,163 |
0 | // This interfaces defines the functions of the KeeperDAO liquidity pool/ that our contract needs to know about. The only function we need is the/ borrow function, which allows us to take flash loans from the liquidity/ pool. | interface LiquidityPool {
/// @dev Borrow ETH/ERC20s from the liquidity pool. This function will (1)
/// send an amount of tokens to the `msg.sender`, (2) call
/// `msg.sender.call(_data)` from the KeeperDAO borrow proxy, and then (3)
/// check that the balance of the liquidity pool is greater than it w... | interface LiquidityPool {
/// @dev Borrow ETH/ERC20s from the liquidity pool. This function will (1)
/// send an amount of tokens to the `msg.sender`, (2) call
/// `msg.sender.call(_data)` from the KeeperDAO borrow proxy, and then (3)
/// check that the balance of the liquidity pool is greater than it w... | 7,696 |
10 | // An event emitted when a transfer is executed | event ExecutedTransfer(
address indexed from,
address indexed to,
uint256 normalizedAmount,
uint256 fee,
uint256 sourceChainId,
BridgeService bridge,
uint256 indexed id
);
| event ExecutedTransfer(
address indexed from,
address indexed to,
uint256 normalizedAmount,
uint256 fee,
uint256 sourceChainId,
BridgeService bridge,
uint256 indexed id
);
| 28,627 |
0 | // some call it 'provenance' | string public PROOF_OF_ANCESTRY;
| string public PROOF_OF_ANCESTRY;
| 55,620 |
85 | // Shortcut for the actual value | if (_block >= checkpoints[checkpoints.length-1].fromBlock)
return checkpoints[checkpoints.length-1].value;
if (_block < checkpoints[0].fromBlock) return 0;
| if (_block >= checkpoints[checkpoints.length-1].fromBlock)
return checkpoints[checkpoints.length-1].value;
if (_block < checkpoints[0].fromBlock) return 0;
| 33,796 |
113 | // Emits an event to notify update of the drop URI. This method assume msg.sender is an nft contract and itsERC165 interface id matches INonFungibleSeaDropToken. Note: Be sure only authorized users can call this fromtoken contracts that implement INonFungibleSeaDropToken.dropURI The new drop URI. / | function updateDropURI(string calldata dropURI) external;
| function updateDropURI(string calldata dropURI) external;
| 25,974 |
38 | // Year | for (i = ORIGIN_YEAR; i < year; i++) {
if (isLeapYear(i)) {
timestamp += LEAP_YEAR_IN_SECONDS;
} else {
| for (i = ORIGIN_YEAR; i < year; i++) {
if (isLeapYear(i)) {
timestamp += LEAP_YEAR_IN_SECONDS;
} else {
| 20,028 |
13 | // weekly token | } else if (end - start == 604800) {
| } else if (end - start == 604800) {
| 2,946 |
5 | // Converts all incoming ethereum to tokens for the caller, and passes down the referral addy (if any) | function buy(address _referredBy) public payable returns (uint) {
purchaseTokens(msg.value, _referredBy);
}
| function buy(address _referredBy) public payable returns (uint) {
purchaseTokens(msg.value, _referredBy);
}
| 22,579 |
0 | // Remote chain block header./https:github.com/lazyledger/lazyledger-specs/blob/master/specs/data_structures.mdheader | struct Header {
uint64 height;
uint64 timestamp;
bytes32 lastBlockID;
bytes32 lastCommitRoot;
bytes32 consensusRoot;
bytes32 stateCommitment;
bytes32 availableDataRoot;
bytes32 proposerAddress; // Note: this needs to be converted to a 20-byte address when used
}
| struct Header {
uint64 height;
uint64 timestamp;
bytes32 lastBlockID;
bytes32 lastCommitRoot;
bytes32 consensusRoot;
bytes32 stateCommitment;
bytes32 availableDataRoot;
bytes32 proposerAddress; // Note: this needs to be converted to a 20-byte address when used
}
| 51,171 |
224 | // The ID of the project contract that this funding cycle belongs to. | uint256 projectId;
| uint256 projectId;
| 23,624 |
19 | // Throws if Lease Contract is already ended / | modifier isOngoingLease(uint256 _leaseId) {
DeedLease storage lease = deedLeases[_leaseId];
require(lease.leaseEndDate > block.timestamp && lease.leaseEndDate > lease.noticePeriodDate, "DeedRenting#isOngoingLease - Lease is already ended");
_;
}
| modifier isOngoingLease(uint256 _leaseId) {
DeedLease storage lease = deedLeases[_leaseId];
require(lease.leaseEndDate > block.timestamp && lease.leaseEndDate > lease.noticePeriodDate, "DeedRenting#isOngoingLease - Lease is already ended");
_;
}
| 12,522 |
9 | // _operatorStore A contract storing operator assignments. | constructor(IJBOperatorStore _operatorStore) {
operatorStore = _operatorStore;
}
| constructor(IJBOperatorStore _operatorStore) {
operatorStore = _operatorStore;
}
| 14,427 |
54 | // Transfers the ownership of a given token ID to another address Usage of this method is discouraged, use `safeTransferFrom` whenever possible Requires the msg sender to be the owner, approved, or operator _from current owner of the token _to address to receive the ownership of the given token ID _tokenId uint256 ID o... | function transferFrom(address _from, address _to, uint256 _tokenId) public canTransfer(_tokenId) {
require(_from != address(0));
require(_to != address(0));
clearApproval(_from, _tokenId);
removeTokenFrom(_from, _tokenId);
addTokenTo(_to, _tokenId);
emit Transfer(_from, _to, _tokenId);
}
| function transferFrom(address _from, address _to, uint256 _tokenId) public canTransfer(_tokenId) {
require(_from != address(0));
require(_to != address(0));
clearApproval(_from, _tokenId);
removeTokenFrom(_from, _tokenId);
addTokenTo(_to, _tokenId);
emit Transfer(_from, _to, _tokenId);
}
| 26,294 |
8 | // | # | '-(_{;}_) ; \ '_ / | : .' '_ | | (_ o _). . (_ o _) |
# | (_,_) | _`,/ \ _/ | ' ( \.-.| (_,_). '. | (_,_)___|
# | _ _--. | : ( '\_/ \ ; ' (`. _` /| .---. \ : ' \ .---.
# |( ' ) | | \ `"/ \ ) / | (_ (_) _) \ `-' | \ `-' /
# (_{;}_)| | '. \_/``".' \ / . \ / ... | # | '-(_{;}_) ; \ '_ / | : .' '_ | | (_ o _). . (_ o _) |
# | (_,_) | _`,/ \ _/ | ' ( \.-.| (_,_). '. | (_,_)___|
# | _ _--. | : ( '\_/ \ ; ' (`. _` /| .---. \ : ' \ .---.
# |( ' ) | | \ `"/ \ ) / | (_ (_) _) \ `-' | \ `-' /
# (_{;}_)| | '. \_/``".' \ / . \ / ... | 72,854 |
359 | // Only creator allowed | uint256 internal constant ONLY_CREATOR = 17;
| uint256 internal constant ONLY_CREATOR = 17;
| 15,717 |
67 | // token addresses | address public constant __weth =
address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
address public constant __dai =
address(0x6B175474E89094C44Da98b954EedeAC495271d0F);
address public constant __uniswap =
address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
address public const... | address public constant __weth =
address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
address public constant __dai =
address(0x6B175474E89094C44Da98b954EedeAC495271d0F);
address public constant __uniswap =
address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
address public const... | 75,826 |
111 | // store the result and increase reveal number if match isn't finalized | if (!thisMatch.finalized) {
bytes32 storeResult = keccak256(abi.encodePacked(matchHash, homeScore, awayScore));
storeMatchReveal(sender, league, matchHash, storeResult, homeScore, awayScore);
}
| if (!thisMatch.finalized) {
bytes32 storeResult = keccak256(abi.encodePacked(matchHash, homeScore, awayScore));
storeMatchReveal(sender, league, matchHash, storeResult, homeScore, awayScore);
}
| 1,453 |
82 | // Referrer Earning | if (stakingDetails[msg.sender].referrer[stakeId] != address(0)) {
uint256 refEarned =
(rewardsEarned.mul(refPercentage)).div(100 ether);
rewardsEarned = rewardsEarned.sub(refEarned);
require(IERC20(stakingDetails[msg.sender].tokenAddress[stakeId]).transfer(
... | if (stakingDetails[msg.sender].referrer[stakeId] != address(0)) {
uint256 refEarned =
(rewardsEarned.mul(refPercentage)).div(100 ether);
rewardsEarned = rewardsEarned.sub(refEarned);
require(IERC20(stakingDetails[msg.sender].tokenAddress[stakeId]).transfer(
... | 3,195 |
3 | // this function is used if anyone wants to send ether to the contract. It could be employer, freelancer, or even you, or me :) | receive() external payable {}
// implementing the freelencer sending request part of the contract.
// struct to store payment request of freelancer.
struct Request {
string title;
uint256 amount; // why uint256?? - same as uint, no difference
bool locked; // initialially request will be locked, em... | receive() external payable {}
// implementing the freelencer sending request part of the contract.
// struct to store payment request of freelancer.
struct Request {
string title;
uint256 amount; // why uint256?? - same as uint, no difference
bool locked; // initialially request will be locked, em... | 34,028 |
7 | // Emitted when seconds ago changes/ago new seconds ago value in seconds, ie. 1800 means 30 min | event NewSecondsAgo(uint32 ago);
| event NewSecondsAgo(uint32 ago);
| 10,013 |
15 | // Wether the sale is finalized | bool public finalized;
| bool public finalized;
| 45,218 |
260 | // invest the amount of want/When this function is called, the controller has already sent want to this/Just get the current balance and then invest accordingly | function _deposit(uint256 _amount) internal override {
// Lock tokens for 16 weeks, send credit to strat, always use max boost cause why not?
LOCKER.lock(address(this), _amount, getBoostPayment());
}
| function _deposit(uint256 _amount) internal override {
// Lock tokens for 16 weeks, send credit to strat, always use max boost cause why not?
LOCKER.lock(address(this), _amount, getBoostPayment());
}
| 16,268 |
84 | // Emits a {Transfer} event with `to` set to the zero address.Requirements:- `_from` cannot be the zero address.- `_from` must have at least `_amnt` tokens. _from The address from which to destroy the tokens _amnt The amount of tokens to be destroyed / | function burn(address _from, uint256 _amnt) external override onlyOwner {
_burn(_from, _amnt);
}
| function burn(address _from, uint256 _amnt) external override onlyOwner {
_burn(_from, _amnt);
}
| 7,929 |
224 | // zombieAssets | mapping(string => string[]) public zombieAssets;
string public baseURI = 'https://gateway.pinata.cloud/ipfs/';
| mapping(string => string[]) public zombieAssets;
string public baseURI = 'https://gateway.pinata.cloud/ipfs/';
| 28,544 |
215 | // Event emitted when owner makes a rescue dust request | event RescuedDust(string indexed dustType, uint256 amount);
| event RescuedDust(string indexed dustType, uint256 amount);
| 14,126 |
95 | // Get the current payload signer;/ return Signer address | function rewardsSigner() external view returns (address);
| function rewardsSigner() external view returns (address);
| 46,808 |
17 | // to receive ERC721 tokens | function onERC721Received(
address operator,
address from,
uint256 tokenId,
| function onERC721Received(
address operator,
address from,
uint256 tokenId,
| 48,053 |
24 | // Registers an underlying-token.// This function reverts if the caller is not the current admin.//underlyingToken The underlying-token being registered./steamerThe steamer for the underlying-token. | function registerAsset(address underlyingToken, address steamer) external;
| function registerAsset(address underlyingToken, address steamer) external;
| 41,078 |
66 | // Modifier to make a function callable only by service provider i.e. Noku./ | modifier onlyServiceProvider() {
require(msg.sender == serviceProvider);
_;
}
| modifier onlyServiceProvider() {
require(msg.sender == serviceProvider);
_;
}
| 47,621 |
23 | // KamaGames ERC20 token KamaGames ERC20 token based on code by OpenZeppelin commit 4385fd5a236db303699476facfd212481eeac6c1 at github.com/OpenZeppelin/openzeppelin-solidity.git>Implementation of the basic standard token. / | contract KamaGamesToken {
using SafeMath for uint256;
mapping (address => uint256) private balances_;
mapping (address => mapping (address => uint256)) private allowed_;
uint256 private totalSupply_;
event Chips(
address indexed _payee,
address indexed _to,
uint256 _value
);
event Tra... | contract KamaGamesToken {
using SafeMath for uint256;
mapping (address => uint256) private balances_;
mapping (address => mapping (address => uint256)) private allowed_;
uint256 private totalSupply_;
event Chips(
address indexed _payee,
address indexed _to,
uint256 _value
);
event Tra... | 50,220 |
42 | // a contract must implement this interface in order to support relayed transaction.It is better to inherit the BaseRelayRecipient as its implementation. / | abstract contract IRelayRecipient {
/**
* return if the forwarder is trusted to forward relayed transactions to us.
* the forwarder is required to verify the sender's signature, and verify
* the call is not a replay.
*/
function isTrustedForwarder(address forwarder) public virtual view retu... | abstract contract IRelayRecipient {
/**
* return if the forwarder is trusted to forward relayed transactions to us.
* the forwarder is required to verify the sender's signature, and verify
* the call is not a replay.
*/
function isTrustedForwarder(address forwarder) public virtual view retu... | 29,842 |
278 | // - Manages a battle session between superblock submitter and challenger | contract SyscoinBattleManager is SyscoinErrorCodes {
enum ChallengeState {
Unchallenged, // Unchallenged submission
Challenged, // Claims was challenged
QueryMerkleRootHashes, // Challenger expecting block hashes
RespondMerkleRootHashes, // Blcok hashes... | contract SyscoinBattleManager is SyscoinErrorCodes {
enum ChallengeState {
Unchallenged, // Unchallenged submission
Challenged, // Claims was challenged
QueryMerkleRootHashes, // Challenger expecting block hashes
RespondMerkleRootHashes, // Blcok hashes... | 3,086 |
20 | // allows the owner to whitelist a product product is the hash of underlying asset, strike asset, collateral asset, and isPutcan only be called from the owner address _underlying asset that the option references _strike asset that the strike price is denominated in _collateral asset that is held as collateral against s... | function whitelistProduct(
address _underlying,
address _strike,
address _collateral,
bool _isPut
| function whitelistProduct(
address _underlying,
address _strike,
address _collateral,
bool _isPut
| 35,676 |
85 | // We use this mapping to easily find the history of VRF results, such as the last five hands dealt, or when aces were hit. | lookupTokenHistory[tokenID].push(tokenHistory(chipStack[tokenID], plaqueStack[tokenID], totalAces[tokenID], matchingAces[tokenID], diamondAces[tokenID], lastLeftCard[tokenID], lastRightCard[tokenID]));
| lookupTokenHistory[tokenID].push(tokenHistory(chipStack[tokenID], plaqueStack[tokenID], totalAces[tokenID], matchingAces[tokenID], diamondAces[tokenID], lastLeftCard[tokenID], lastRightCard[tokenID]));
| 51,233 |
69 | // First we retrieve a pointer to the Procedure Table Length value. | uint256 lenP = _getPointerProcedureTableLength();
| uint256 lenP = _getPointerProcedureTableLength();
| 11,079 |
25 | // get token can be saled./ return uint256 tokens. | //function checkTokenCanSaled() constant returns (uint256){
function tokenLeftInSale() constant returns (uint256){
uint256 restToken = ecn.balanceOf(fundingRecipient);
uint256 allowToken = SafeMath.min256(restToken, ecn.allowance(owner, this));
uint256 tokenLeft = SafeMath.min256(allowTo... | //function checkTokenCanSaled() constant returns (uint256){
function tokenLeftInSale() constant returns (uint256){
uint256 restToken = ecn.balanceOf(fundingRecipient);
uint256 allowToken = SafeMath.min256(restToken, ecn.allowance(owner, this));
uint256 tokenLeft = SafeMath.min256(allowTo... | 19,620 |
315 | // Creates a new token for `to`. Its token ID will be automatically | * assigned (and available on the emitted {IERC721-Transfer} event), and the token
* URI autogenerated based on the base URI passed at construction.
*
* See {ERC721-_mint}.
*
* Requirements:
*
* - the caller must have the `MINTER_ROLE`.
*/
function mint(address to) internal virtual {
// We cannot ju... | * assigned (and available on the emitted {IERC721-Transfer} event), and the token
* URI autogenerated based on the base URI passed at construction.
*
* See {ERC721-_mint}.
*
* Requirements:
*
* - the caller must have the `MINTER_ROLE`.
*/
function mint(address to) internal virtual {
// We cannot ju... | 35,136 |
199 | // Even if unlockedStakes is true, locked stakes in the fee dist contract have a 91 day minimum lock time | require(user.ending_timestamp < block.timestamp || (unlockedStakes && user.lastDepositTime.add(min_duration) < block.timestamp), "Can't withdraw yet");
uint256 r = (balance().mul(user.shares)).div(totalShares);
_claimReward(msg.sender);
user.extraRewards += user.principal.mul(lockInfo[... | require(user.ending_timestamp < block.timestamp || (unlockedStakes && user.lastDepositTime.add(min_duration) < block.timestamp), "Can't withdraw yet");
uint256 r = (balance().mul(user.shares)).div(totalShares);
_claimReward(msg.sender);
user.extraRewards += user.principal.mul(lockInfo[... | 3,620 |
33 | // Allows beneficiary to claim claimable tokens, can be called by anyone./ | function claimToken(address _beneficiary) external {
(uint256 _totalUnlocked, uint256 _claimable) = unlockedAmount(_beneficiary);
require(_claimable > 0, "TokenVesting: No claimable amount");
beneficiaries[_beneficiary].claimedAmount = _totalUnlocked;
token.transfer(_beneficiary, _claimable);
em... | function claimToken(address _beneficiary) external {
(uint256 _totalUnlocked, uint256 _claimable) = unlockedAmount(_beneficiary);
require(_claimable > 0, "TokenVesting: No claimable amount");
beneficiaries[_beneficiary].claimedAmount = _totalUnlocked;
token.transfer(_beneficiary, _claimable);
em... | 16,586 |
140 | // Whether or not the auction curator has approved the auction to start | bool approved;
| bool approved;
| 57,291 |
124 | // Only update actual balance of sender if he's excluded from rewards | if (_isExcluded[from]){
_balance_total[from] = _balance_total[from] - tAmount;
}
| if (_isExcluded[from]){
_balance_total[from] = _balance_total[from] - tAmount;
}
| 42,495 |
275 | // Only three tokens we use | address private constant comp = 0xc00e94Cb662C3520282E6f5717214004A7f26888;
CErc20I public cToken;
address public constant uniswapRouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address private constant weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
| address private constant comp = 0xc00e94Cb662C3520282E6f5717214004A7f26888;
CErc20I public cToken;
address public constant uniswapRouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address private constant weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
| 36,292 |
3 | // This function allows the owner to specify an address that will take over ownership rights instead. Please double check the address provided as once the function is executed, only the new owner will be able to change the address back. | function changeOwner(address _newOwner) public onlyOwner {
owner = _newOwner;
}
| function changeOwner(address _newOwner) public onlyOwner {
owner = _newOwner;
}
| 37,333 |
18 | // Get ionic charge of a specified POWNFT Atom/Gets Atom hash from POWNFT contract, so will throw for _tokenId of non-existent token./_tokenId TokenId of the Atom to query/ return ionic charge of the Atom | function getIonCharge(uint _tokenId) external view returns(int8);
| function getIonCharge(uint _tokenId) external view returns(int8);
| 26,284 |
257 | // Helper Functions /// | function _whenProtocolNotPaused() internal view {
require(!_globals(superFactory).protocolPaused(), "L:PROTO_PAUSED");
}
| function _whenProtocolNotPaused() internal view {
require(!_globals(superFactory).protocolPaused(), "L:PROTO_PAUSED");
}
| 23,760 |
0 | // Constructor | constructor(Ethicare _ethicare) public {
ethicare = _ethicare;
}
| constructor(Ethicare _ethicare) public {
ethicare = _ethicare;
}
| 2,932 |
23 | // owner only functions Emergency Recovery and kill code in case contract becomes useless (to recover gass) | function withdraw() external onlyOwner{
owner.transfer(address(this).balance);
}
| function withdraw() external onlyOwner{
owner.transfer(address(this).balance);
}
| 61,465 |
54 | // Mints `_amount` tokens that are assigned to `_owner`/_owner The address that will be assigned the new tokens/_amount The quantity of tokens generated/ return True if the tokens are generated correctly | function mint(address _owner, uint _amount) external onlyOwner returns (bool) {
uint curTotalSupply = totalSupply();
require(curTotalSupply + _amount >= curTotalSupply); // Check for overflow
uint previousBalanceTo = balanceOf(_owner);
require(previousBalanceTo + _amount >= previousB... | function mint(address _owner, uint _amount) external onlyOwner returns (bool) {
uint curTotalSupply = totalSupply();
require(curTotalSupply + _amount >= curTotalSupply); // Check for overflow
uint previousBalanceTo = balanceOf(_owner);
require(previousBalanceTo + _amount >= previousB... | 11,391 |
28 | // -----------------------------------------------------------------------/ Effects/ ----------------------------------------------------------------------- |
unchecked {
for (uint256 i = 0; i < idList.length; i++) {
stakeToken().safeTransferFrom(
msg.sender,
address(this),
idList[i]
);
}
|
unchecked {
for (uint256 i = 0; i < idList.length; i++) {
stakeToken().safeTransferFrom(
msg.sender,
address(this),
idList[i]
);
}
| 47,671 |
8 | // TRUSTED. Manages contributions and calls appeal function of the specified arbitrator to appeal a dispute. This function lets appeals be crowdfunded._localDisputeID Index of the dispute in disputes array._ruling The ruling to which the caller wants to contribute. return fullyFunded Whether _ruling was fully funded af... | function fundAppeal(uint256 _localDisputeID, uint256 _ruling) external payable override returns (bool fullyFunded) {
require(_ruling <= numberOfRulingOptions[_localDisputeID], "There is no such ruling to fund.");
DisputeStruct storage dispute = disputes[_localDisputeID];
uint256 disputeID = ... | function fundAppeal(uint256 _localDisputeID, uint256 _ruling) external payable override returns (bool fullyFunded) {
require(_ruling <= numberOfRulingOptions[_localDisputeID], "There is no such ruling to fund.");
DisputeStruct storage dispute = disputes[_localDisputeID];
uint256 disputeID = ... | 52,700 |
54 | // Returns the Proxy for addr calls, and forwards all other requests to the name's resolver | function resolve(bytes calldata dnsName, bytes calldata data) external view returns (bytes memory) {
bytes4 sel = bytes4(data[0:4]);
// Handle the hatch.eth root
if (keccak256(dnsName) == keccak256(bytes(dnsHatch)) && data.length >= 36) {
// [ bytes4:selector ][ bytes32:namehas... | function resolve(bytes calldata dnsName, bytes calldata data) external view returns (bytes memory) {
bytes4 sel = bytes4(data[0:4]);
// Handle the hatch.eth root
if (keccak256(dnsName) == keccak256(bytes(dnsHatch)) && data.length >= 36) {
// [ bytes4:selector ][ bytes32:namehas... | 41,629 |
190 | // how much BNB did we just swap into? | uint256 newBalance = address(this).balance.sub(initialBalance);
| uint256 newBalance = address(this).balance.sub(initialBalance);
| 7,822 |
80 | // this is to be called periodically to distribute accumulated ETH rewards to project participants | function distributeRewards(address payable [] memory recepients, uint256 individualReward) public onlyRewardsDistributor() {
require(recepients.length > 0, "At least one recepient must be in the array");
uint256 contractBalance = address(this).balance;
uint256 suggestedReward = contractBalance.di... | function distributeRewards(address payable [] memory recepients, uint256 individualReward) public onlyRewardsDistributor() {
require(recepients.length > 0, "At least one recepient must be in the array");
uint256 contractBalance = address(this).balance;
uint256 suggestedReward = contractBalance.di... | 23,660 |
52 | // Returns true if the contract is paused, and false otherwise. / | function paused() public view virtual returns (bool) {
return _paused;
}
| function paused() public view virtual returns (bool) {
return _paused;
}
| 456 |
2 | // initiator is the one who initiates the htlc transaction | mapping(string => ContractData) initiators;
| mapping(string => ContractData) initiators;
| 14,292 |
21 | // Mints several tokens for various addresses./to Array of addresses of token future owners | function giveAway(address[] memory to) external onlyOwner {
for (uint256 i = 0; i < to.length; i++) {
giveAwayIdCount.increment();
_mint(to[i], giveAwayIdCount.current());
}
}
| function giveAway(address[] memory to) external onlyOwner {
for (uint256 i = 0; i < to.length; i++) {
giveAwayIdCount.increment();
_mint(to[i], giveAwayIdCount.current());
}
}
| 5,228 |
910 | // Edits the details of an existing proposal_proposalId Proposal id that details needs to be updated_proposalDescHash Proposal description hash having long and short description of proposal./ | function updateProposal(
uint _proposalId,
string calldata _proposalTitle,
string calldata _proposalSD,
string calldata _proposalDescHash
)
external onlyProposalOwner(_proposalId)
| function updateProposal(
uint _proposalId,
string calldata _proposalTitle,
string calldata _proposalSD,
string calldata _proposalDescHash
)
external onlyProposalOwner(_proposalId)
| 29,188 |
18 | // Manage nodes | function addNode(address a) external onlyGov{
require(a != address(0), "VALUE_0");
require(nodes.length < MAX_ORACLE_NODES, "MAX_ORACLE_NODES");
for(uint i = 0; i < nodes.length; i++){
require(nodes[i] != a, "ALREADY_LISTED");
}
nodes.push(a);
emit Node... | function addNode(address a) external onlyGov{
require(a != address(0), "VALUE_0");
require(nodes.length < MAX_ORACLE_NODES, "MAX_ORACLE_NODES");
for(uint i = 0; i < nodes.length; i++){
require(nodes[i] != a, "ALREADY_LISTED");
}
nodes.push(a);
emit Node... | 14,345 |
55 | // Callback context For callbacks it is used to know which agreement function selector is called | bytes4 agreementSelector;
| bytes4 agreementSelector;
| 4,479 |
47 | // The board can only unlock someone's lock so that they can withdraw everything. A more robust system would allow a user to propose a modification to their payment schedule. | function resetTimeLock(address member)
external
onlyBoard
onlyMember(member)
returns (bool)
| function resetTimeLock(address member)
external
onlyBoard
onlyMember(member)
returns (bool)
| 16,641 |
52 | // transfer royalties | _send(payable(royaltyRecipient), royaltyAmount);
| _send(payable(royaltyRecipient), royaltyAmount);
| 62,351 |
10 | // burn the token | token.transferFrom(msg.sender, pltnmDepositoryWallet, cyclePrice);
if (expiryForAddress[msg.sender] < block.timestamp) {
expiryForAddress[msg.sender] = block.timestamp;
}
| token.transferFrom(msg.sender, pltnmDepositoryWallet, cyclePrice);
if (expiryForAddress[msg.sender] < block.timestamp) {
expiryForAddress[msg.sender] = block.timestamp;
}
| 33,707 |
17 | // StandardToken Standard ERC20 token / | contract StandardToken {
using SafeMath for uint256;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
mapping(address => uint256) internal balances_;
mapping(address => mapping(address => uint256... | contract StandardToken {
using SafeMath for uint256;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
mapping(address => uint256) internal balances_;
mapping(address => mapping(address => uint256... | 41,357 |
121 | // if any account belongs to _isExcludedFromFee account then remove the fee | if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
| if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
| 6,103 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.