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 |
|---|---|---|---|---|
41 | // Transfer the specified amounts of tokens to the specified addresses.Be aware that there is no check for duplicate recipients._toAddresses Receiver addresses._amounts Amounts of tokens that will be transferred./ | function multiTransfer(address[] _toAddresses, uint256[] _amounts) public whenNotPaused returns (bool) {
/* Ensures _toAddresses array is less than or equal to 255 */
require(_toAddresses.length <= 255);
/* Ensures _toAddress and _amounts have the same number of entries. */
require(_... | function multiTransfer(address[] _toAddresses, uint256[] _amounts) public whenNotPaused returns (bool) {
/* Ensures _toAddresses array is less than or equal to 255 */
require(_toAddresses.length <= 255);
/* Ensures _toAddress and _amounts have the same number of entries. */
require(_... | 28,900 |
31 | // To implement this library for multiple types with as little code repetition as possible, we write it in terms of a generic Set type with bytes32 values. The Set implementation uses private functions, and user-facing implementations (such as AddressSet) are just wrappers around the underlying Set. This means that we ... |
struct Set {
|
struct Set {
| 23,474 |
2 | // FFDefiInvestors[msg.sender] | investorStruct memory investorD = investorStruct({
addressInvestor: msg.sender,
linkToSlackImage: _linkToSlackImage,
isRegistered: true,
timestamp: block.timestamp
});
| investorStruct memory investorD = investorStruct({
addressInvestor: msg.sender,
linkToSlackImage: _linkToSlackImage,
isRegistered: true,
timestamp: block.timestamp
});
| 44,373 |
9 | // The number as string has length 78, so you do some aritmetic operaions to divide the random number into 2 random dice values | function calcDiceValues() private returns (uint8, uint8) {
uint8 dice1value = (uint8) ((lastRandom % (10**39)) % 6) + 1;
uint8 dice2value = (uint8) ((lastRandom - dice1value)/(10**39) % 6) + 1;
emit DicesForRandomNumber(lastRandom, dice1value, dice2value);
timesRolledTheDices++;
return (dice1value, dice2valu... | function calcDiceValues() private returns (uint8, uint8) {
uint8 dice1value = (uint8) ((lastRandom % (10**39)) % 6) + 1;
uint8 dice2value = (uint8) ((lastRandom - dice1value)/(10**39) % 6) + 1;
emit DicesForRandomNumber(lastRandom, dice1value, dice2value);
timesRolledTheDices++;
return (dice1value, dice2valu... | 37,356 |
508 | // approve 3crv for deposit into pickle | IDetailedERC20(_token).safeApprove(address(vault), uint256(-1));
| IDetailedERC20(_token).safeApprove(address(vault), uint256(-1));
| 27,775 |
27 | // Performs division where if there is a modulo, the value is rounded up/ | function divCeil(uint256 a, uint256 b)
internal
pure
returns(uint256)
| function divCeil(uint256 a, uint256 b)
internal
pure
returns(uint256)
| 44,108 |
26 | // This function is called by a anyone to repay a loan. It can be called at any time after the loan hasbegun and before loan expiry.. The caller will pay a pro-rata portion of their interest if the loan is paid offearly and the loan is pro-rated type, but the complete repayment amount if it is fixed type.The the borrow... | function payBackLoan(uint256 _loanId) external nonReentrant {
LoanChecksAndCalculations.payBackChecks(_loanId, hub);
(
address borrower,
address lender,
LoanTerms memory loan,
IDirectLoanCoordinator loanCoordinator
) = _getPartiesAndData(_loanI... | function payBackLoan(uint256 _loanId) external nonReentrant {
LoanChecksAndCalculations.payBackChecks(_loanId, hub);
(
address borrower,
address lender,
LoanTerms memory loan,
IDirectLoanCoordinator loanCoordinator
) = _getPartiesAndData(_loanI... | 40,276 |
93 | // PUBS | contract PubToken is ERC20("PUB.finance","PUBS"), Ownable {
using BasisPoints for uint;
using SafeMath for uint;
uint public burnBP;
uint public taxBP;
Bartender private bartender;
mapping(address => bool) public taxExempt;
mapping(address => bool) public fromOnlyTaxExempt;
mapping(ad... | contract PubToken is ERC20("PUB.finance","PUBS"), Ownable {
using BasisPoints for uint;
using SafeMath for uint;
uint public burnBP;
uint public taxBP;
Bartender private bartender;
mapping(address => bool) public taxExempt;
mapping(address => bool) public fromOnlyTaxExempt;
mapping(ad... | 70,250 |
14 | // mkusd/fraxbp fee, normalized to 1e18 | uint256 fee = (MKUSD_FRAXP.fee() + 1e10) * 1e8;
| uint256 fee = (MKUSD_FRAXP.fee() + 1e10) * 1e8;
| 38,549 |
74 | // Node details | nodeDetails.nodeAddress = _nodeAddress;
nodeDetails.withdrawalAddress = rocketStorage.getNodeWithdrawalAddress(_nodeAddress);
nodeDetails.pendingWithdrawalAddress = rocketStorage.getNodePendingWithdrawalAddress(_nodeAddress);
nodeDetails.exists = getNodeExists(_nodeAddress);
node... | nodeDetails.nodeAddress = _nodeAddress;
nodeDetails.withdrawalAddress = rocketStorage.getNodeWithdrawalAddress(_nodeAddress);
nodeDetails.pendingWithdrawalAddress = rocketStorage.getNodePendingWithdrawalAddress(_nodeAddress);
nodeDetails.exists = getNodeExists(_nodeAddress);
node... | 34,754 |
26 | // Return the data from the delegate call. | return returnedData;
| return returnedData;
| 37,442 |
104 | // forwardd ether to vault / | function forwardFunds(uint256 toFund) internal {
vault.deposit.value(toFund)(msg.sender);
}
| function forwardFunds(uint256 toFund) internal {
vault.deposit.value(toFund)(msg.sender);
}
| 81,317 |
43 | // Load the assets we have in this vault | uint256 holdings = position.balanceOfUnderlying(address(this));
| uint256 holdings = position.balanceOfUnderlying(address(this));
| 11,983 |
224 | // Transforms the paramMapping value to the index in sub array value/_type Indicated the type of the input | function getSubIndex(uint8 _type) internal pure returns (uint8) {
if (_type < SUB_MIN_INDEX_VALUE){
revert ReturnIndexValueError();
}
return (_type - SUB_MIN_INDEX_VALUE);
}
| function getSubIndex(uint8 _type) internal pure returns (uint8) {
if (_type < SUB_MIN_INDEX_VALUE){
revert ReturnIndexValueError();
}
return (_type - SUB_MIN_INDEX_VALUE);
}
| 3,868 |
334 | // Inserts `_node` into merkle tree Reverts if tree is full _node Element to insert into tree / | function insert(Tree storage _tree, bytes32 _node) internal {
require(_tree.count < MAX_LEAVES, "merkle tree full");
_tree.count += 1;
uint256 size = _tree.count;
for (uint256 i = 0; i < TREE_DEPTH; i++) {
if ((size & 1) == 1) {
_tree.branch[i] = _node;
... | function insert(Tree storage _tree, bytes32 _node) internal {
require(_tree.count < MAX_LEAVES, "merkle tree full");
_tree.count += 1;
uint256 size = _tree.count;
for (uint256 i = 0; i < TREE_DEPTH; i++) {
if ((size & 1) == 1) {
_tree.branch[i] = _node;
... | 19,147 |
8 | // Clear approvalNote that if 0 is not a valid value it will be set to 1. _token erc20 The address of the ERC20 contract _spender The address which will spend the funds. / | function clearApprove(IERC20 _token, address _spender) internal returns (bool) {
bool success = safeApprove(_token, _spender, 0);
if (!success) {
success = safeApprove(_token, _spender, 1);
}
return success;
}
| function clearApprove(IERC20 _token, address _spender) internal returns (bool) {
bool success = safeApprove(_token, _spender, 0);
if (!success) {
success = safeApprove(_token, _spender, 1);
}
return success;
}
| 21,992 |
3 | // This function will start the attack on the vulnerable contract | function attack() external payable {
require(msg.value >= 1 ether);
vulnerableContract.deposit{value: 1 ether}();
vulnerableContract.withdraw();
}
| function attack() external payable {
require(msg.value >= 1 ether);
vulnerableContract.deposit{value: 1 ether}();
vulnerableContract.withdraw();
}
| 5,527 |
9 | // Logs a Sell Drago event./_who Address of who is selling/_targetDrago Address of the target drago/_amount Number of shares purchased/_revenue Value of the transaction in Ether/ return Bool the transaction executed successfully | function sellDrago(
address _who,
address _targetDrago,
uint _amount,
uint _revenue,
bytes _name,
bytes _symbol)
external
approvedDragoOnly(msg.sender)
returns(bool success)
| function sellDrago(
address _who,
address _targetDrago,
uint _amount,
uint _revenue,
bytes _name,
bytes _symbol)
external
approvedDragoOnly(msg.sender)
returns(bool success)
| 34,015 |
3 | // Function signature for encoding ERC1155 assetData./tokenAddress Address of ERC1155 token contract./tokenIds Array of ids of tokens to be transferred./values Array of values that correspond to each token id to be transferred./Note that each value will be multiplied by the amount being filled in the order before trans... | function ERC1155Assets(
address tokenAddress,
uint256[] calldata tokenIds,
uint256[] calldata values,
bytes calldata callbackData
)
external;
| function ERC1155Assets(
address tokenAddress,
uint256[] calldata tokenIds,
uint256[] calldata values,
bytes calldata callbackData
)
external;
| 49,062 |
145 | // claim the tokens | IStaker(staker).withdraw(token);
uint256 activeCount = IRewardFactory(rewardFactory).activeRewardCount(token);
if(activeCount > 1){
| IStaker(staker).withdraw(token);
uint256 activeCount = IRewardFactory(rewardFactory).activeRewardCount(token);
if(activeCount > 1){
| 36,826 |
397 | // When blacklist is updated | event AddedToBlacklist(uint EIN, uint recipientEIN);
event RemovedFromBlacklist(uint EIN, uint recipientEIN);
| event AddedToBlacklist(uint EIN, uint recipientEIN);
event RemovedFromBlacklist(uint EIN, uint recipientEIN);
| 24,717 |
1 | // Token supply | uint256 public supply = 2358;
| uint256 public supply = 2358;
| 60,318 |
23 | // totalstaked = totalstaked.sub(userStakes.stakedAmount); | total = total.sub(userStakes.stakedAmount);
k = initialAmount;
counter++;
| total = total.sub(userStakes.stakedAmount);
k = initialAmount;
counter++;
| 13,311 |
89 | // return true if HarborPresale event has ended | function hasEnded() public constant returns (bool) {
bool capReached = weiRaised >= cap;
return (now > endTime) || capReached ;
}
| function hasEnded() public constant returns (bool) {
bool capReached = weiRaised >= cap;
return (now > endTime) || capReached ;
}
| 29,496 |
96 | // Mint token(s) for public sales / | function mint(
bytes memory signature,
uint256 nonce,
uint256 numberOfTokens,
uint256 maxMintsPerWallet,
address recipient
| function mint(
bytes memory signature,
uint256 nonce,
uint256 numberOfTokens,
uint256 maxMintsPerWallet,
address recipient
| 26,049 |
143 | // withdraw everything from the strategy to accurately check the share value | if (numberOfShares == totalSupply) {
strategy.withdrawAllToVault();
} else {
| if (numberOfShares == totalSupply) {
strategy.withdrawAllToVault();
} else {
| 54,754 |
4 | // Derived from @openzeppelin-contracts/contracts/access/Roles.sol/ Roles Library for managing addresses assigned to a Role. / | library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev Give an account access to this role.
*/
function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true... | library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev Give an account access to this role.
*/
function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true... | 29,834 |
177 | // .add(balanceFulcrumInToken()).add(balanceDydx()).add(balanceAave()) | .add(balance());
| .add(balance());
| 8,016 |
17 | // Whether Flash mint is active | bool isFlashMintActive;
| bool isFlashMintActive;
| 19,769 |
32 | // n.b. DAI can only go to the output conduit | function draw(uint256 wad) external operator {
require(outputConduit != address(0));
bytes32 ilk = gemJoin.ilk();
jug.drip(ilk);
(,uint256 rate,,,) = vat.ilks(ilk);
uint256 dart = divup(mul(RAY, wad), rate);
require(dart <= 2**255 - 1, "RwaUrn/overflow");
vat.... | function draw(uint256 wad) external operator {
require(outputConduit != address(0));
bytes32 ilk = gemJoin.ilk();
jug.drip(ilk);
(,uint256 rate,,,) = vat.ilks(ilk);
uint256 dart = divup(mul(RAY, wad), rate);
require(dart <= 2**255 - 1, "RwaUrn/overflow");
vat.... | 61,035 |
29 | // Sets the management fee for the token _managementFee is the management fee (18 decimals). ex: 21018 = 2% / | function setManagementFee(uint256 _managementFee) external {
_checkOwner();
if (_managementFee > 100 * FEE_MULTIPLIER) revert BadFee();
emit ManagementFeeSet(managementFee, _managementFee);
managementFee = _managementFee;
}
| function setManagementFee(uint256 _managementFee) external {
_checkOwner();
if (_managementFee > 100 * FEE_MULTIPLIER) revert BadFee();
emit ManagementFeeSet(managementFee, _managementFee);
managementFee = _managementFee;
}
| 8,616 |
14 | // mapping(owner address => mapping(channelId uint => nonce uint256))) public canceled; | mapping(address => mapping(uint256 => uint)) public canceled;
string public constant version = '2.0.0';
uint public applyWait = 1 days;
uint public feeRate = 10;
bool public withdrawEnabled = false;
bool public stop = false;
uint256 private DEFAULT_CHANNEL_ID = 0;
bool public depositToEn... | mapping(address => mapping(uint256 => uint)) public canceled;
string public constant version = '2.0.0';
uint public applyWait = 1 days;
uint public feeRate = 10;
bool public withdrawEnabled = false;
bool public stop = false;
uint256 private DEFAULT_CHANNEL_ID = 0;
bool public depositToEn... | 7,595 |
417 | // Implements the permit function as specified in EIP-2612. owner Address of the token owner.spender Address of the spender.value Amount of allowance.deadlineExpiration timestamp for the signature.v Signature param.r Signature param.s Signature param. / | function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
)
external
| function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
)
external
| 36,461 |
12 | // NFTSalesUSDX - NFT sale by stablecoins one type | contract NFTSalesUSDX is ERC1155Holder, Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
struct Token {
bool resolved;
uint256 price;
}
struct Collectible {
uint256 price; // in usd
}
IERC1155Collectible public immutable collection;
address pub... | contract NFTSalesUSDX is ERC1155Holder, Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
struct Token {
bool resolved;
uint256 price;
}
struct Collectible {
uint256 price; // in usd
}
IERC1155Collectible public immutable collection;
address pub... | 11,113 |
18 | // Managing permissions // Getting the current role of the sender in the contractreturn The enum value of Roles associated with the sender of the message A no privileged user is considered a buyer. Owner is not a role in the contract / | function getRole() public view returns(Roles) {
return privilegedUsers[msg.sender] ? roles[msg.sender] : Roles.BUYER;
}
| function getRole() public view returns(Roles) {
return privilegedUsers[msg.sender] ? roles[msg.sender] : Roles.BUYER;
}
| 22,106 |
201 | // 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);
}
| 9,548 |
73 | // Returns The Total Bid Volume Of The Auction SaleIndex The Sale Index To View / | function ViewTotalBidVolume(uint SaleIndex) public view returns (uint)
| function ViewTotalBidVolume(uint SaleIndex) public view returns (uint)
| 19,877 |
3 | // snapshotHistory This array records the number of users synchronized for each snapshot | uint32[] snapshotHistory;
| uint32[] snapshotHistory;
| 2,809 |
15 | // Revert with an error when attempting to fill a basic order that has been partially filled.orderHash The hash of the partially used order. / | error OrderPartiallyFilled(bytes32 orderHash);
| error OrderPartiallyFilled(bytes32 orderHash);
| 22,335 |
38 | // Get ETH able to be committed | if(readAndAgreedToMarketParticipationAgreement == false) {
revertBecauseUserDidNotProvideAgreement();
}
| if(readAndAgreedToMarketParticipationAgreement == false) {
revertBecauseUserDidNotProvideAgreement();
}
| 25,649 |
33 | // Constructor - instantiates token supply and allocates balance ofto the admin (msg.sender)./ | function QuintToken(address _creator) public {
// Mint all tokens to creator
balances[msg.sender] = INITIAL_SUPPLY;
totalSupply_ = INITIAL_SUPPLY;
// Set creator address
creatorAddress = _creator;
}
| function QuintToken(address _creator) public {
// Mint all tokens to creator
balances[msg.sender] = INITIAL_SUPPLY;
totalSupply_ = INITIAL_SUPPLY;
// Set creator address
creatorAddress = _creator;
}
| 39,602 |
511 | // ERC721 Burnable Token ERC721 Token that can be irreversibly burned (destroyed). / | abstract contract ERC721Burnable is Context, ERC721 {
/**
* @dev Burns `tokenId`. See {ERC721-_burn}.
*
* Requirements:
*
* - The caller must own `tokenId` or be an approved operator.
*/
function burn(uint256 tokenId) public virtual {
//solhint-disable-next-line max-line-le... | abstract contract ERC721Burnable is Context, ERC721 {
/**
* @dev Burns `tokenId`. See {ERC721-_burn}.
*
* Requirements:
*
* - The caller must own `tokenId` or be an approved operator.
*/
function burn(uint256 tokenId) public virtual {
//solhint-disable-next-line max-line-le... | 2,884 |
8 | // only owner can switch on public sale | function switchOnPublicSale() external onlyOwner {
isPublicSaleActive = !isPublicSaleActive;
}
| function switchOnPublicSale() external onlyOwner {
isPublicSaleActive = !isPublicSaleActive;
}
| 36,198 |
84 | // buy | removeAllFee();
if(from == uniswapV2Pair){
_taxFee = _addressFees[to]._buyTaxFee;
_liquidityFee = _addressFees[to]._buyLiquidityFee;
}
| removeAllFee();
if(from == uniswapV2Pair){
_taxFee = _addressFees[to]._buyTaxFee;
_liquidityFee = _addressFees[to]._buyLiquidityFee;
}
| 23,284 |
63 | // https:docs.synthetix.io/contracts/source/contracts/mixinresolver | contract MixinResolver {
AddressResolver public resolver;
mapping(bytes32 => address) private addressCache;
constructor(address _resolver) internal {
resolver = AddressResolver(_resolver);
}
/* ========== INTERNAL FUNCTIONS ========== */
function combineArrays(bytes32[] memory first,... | contract MixinResolver {
AddressResolver public resolver;
mapping(bytes32 => address) private addressCache;
constructor(address _resolver) internal {
resolver = AddressResolver(_resolver);
}
/* ========== INTERNAL FUNCTIONS ========== */
function combineArrays(bytes32[] memory first,... | 26,039 |
299 | // Check that the router isnt accidentally locking funds in the contract | require(msg.value == 0, "#P:017");
stableAmount = amount;
amount = 0;
| require(msg.value == 0, "#P:017");
stableAmount = amount;
amount = 0;
| 15,714 |
53 | // Configure a category _categoryCategory to configure _price Price of this category _startingTokenId Starting token ID of the category _supplyNumber of tokens in this category / | function setCategoryDetail(
Category _category,
uint256 _price,
uint256 _startingTokenId,
uint256 _supply
| function setCategoryDetail(
Category _category,
uint256 _price,
uint256 _startingTokenId,
uint256 _supply
| 58,229 |
116 | // RikoToken with Governance. | contract RikoToken is ERC20("RIKO", "RKO"), Ownable {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
... | contract RikoToken is ERC20("RIKO", "RKO"), Ownable {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
... | 9,810 |
159 | // now is to lock into staking pool | Utils.swapTokensForEth(address(pancakeRouter), tokenAmountToBeSwapped);
| Utils.swapTokensForEth(address(pancakeRouter), tokenAmountToBeSwapped);
| 5,666 |
14 | // ===== Permissioned Actions: Governance =====/Delete if you don't need! | function setKeepReward(uint256 _setKeepReward) external {
_onlyGovernance();
}
| function setKeepReward(uint256 _setKeepReward) external {
_onlyGovernance();
}
| 47,684 |
59 | // If the current deadline hasn't expired yet then add the delay to it | swappableReservoirLimitReachesMaxDeadline = uint120(_swappableReservoirLimitReachesMaxDeadline + delay);
| swappableReservoirLimitReachesMaxDeadline = uint120(_swappableReservoirLimitReachesMaxDeadline + delay);
| 35,547 |
5 | // already deposited before | UserInfo storage user = userInfo[msg.sender];
if (user.amount != 0) {
user.pointsDebt = pointsBalance(msg.sender);
}
| UserInfo storage user = userInfo[msg.sender];
if (user.amount != 0) {
user.pointsDebt = pointsBalance(msg.sender);
}
| 37,836 |
85 | // Called by the Prize-Strategy to award external ERC20 prizes/Used to award any arbitrary tokens held by the Prize Pool/to The address of the winner that receives the award/amount The amount of external assets to be awarded/externalToken The address of the external asset token being awarded | function awardExternalERC20(
address to,
address externalToken,
uint256 amount
)
external override
onlyPrizeStrategy
| function awardExternalERC20(
address to,
address externalToken,
uint256 amount
)
external override
onlyPrizeStrategy
| 14,374 |
142 | // And send them the SNX. | synthetix().transfer(msg.sender, synthetixToSend);
emit Exchange("ETH", msg.value, "SNX", synthetixToSend);
return synthetixToSend;
| synthetix().transfer(msg.sender, synthetixToSend);
emit Exchange("ETH", msg.value, "SNX", synthetixToSend);
return synthetixToSend;
| 21,069 |
62 | // Merkle root describing the distribution. | bytes32 merkleRoot;
| bytes32 merkleRoot;
| 70,349 |
67 | // Implements bitcoin's hash256 (double sha2) memView A view of the preimagereturndigest - the Digest / | function hash256(bytes29 memView) internal view returns (bytes32 digest) {
uint256 _loc = loc(memView);
uint256 _len = len(memView);
assembly {
// solium-disable-previous-line security/no-inline-assembly
let ptr := mload(0x40)
pop(staticcall(gas(), 2, _loc... | function hash256(bytes29 memView) internal view returns (bytes32 digest) {
uint256 _loc = loc(memView);
uint256 _len = len(memView);
assembly {
// solium-disable-previous-line security/no-inline-assembly
let ptr := mload(0x40)
pop(staticcall(gas(), 2, _loc... | 38,469 |
124 | // Saves the latest cumulative sum of the holder reward price.By subtracting this value when calculating the next rewards, always withdrawal the difference from the previous time. / | setStorageLastWithdrawnReward(_property, msg.sender, lastPrice);
| setStorageLastWithdrawnReward(_property, msg.sender, lastPrice);
| 34,975 |
37 | // Internal implementation of distribute logic./gaugeAddr Address of the gauge to distribute rewards to | function _distribute(address gaugeAddr) internal {
require(distributionsOn, "not allowed");
(bool success, bytes memory result) = address(controller).call(
abi.encodeWithSignature("gauge_types(address)", gaugeAddr)
);
if (!success || killedGauges[gaugeAddr]) {
return;
}
int128 gaugeType = abi.decode(... | function _distribute(address gaugeAddr) internal {
require(distributionsOn, "not allowed");
(bool success, bytes memory result) = address(controller).call(
abi.encodeWithSignature("gauge_types(address)", gaugeAddr)
);
if (!success || killedGauges[gaugeAddr]) {
return;
}
int128 gaugeType = abi.decode(... | 1,446 |
0 | // Store CandidateRead Candidate | string public candidate;
| string public candidate;
| 11,669 |
63 | // Counter underflow is impossible as _currentIndex does not decrement, and it is initialized to `_startTokenId()` | unchecked {
return _currentIndex - _startTokenId();
}
| unchecked {
return _currentIndex - _startTokenId();
}
| 27,084 |
81 | // safe uint256 | using SafeMath for uint256;
| using SafeMath for uint256;
| 36,220 |
107 | // Token information AaveProvider address on Mainnet: 0x24a42fD28C976A61Df5D00D0599C34c4f90748c8 Kovan Testnet: 0x506B0B2CF20FAA8f38a4E2B524EE43e1f4458Cc5 | address public aaveProviderAddress = 0x24a42fD28C976A61Df5D00D0599C34c4f90748c8;
LendingPoolAddressesProvider aaveProvider;
IERC20 private _underlyingAsset; // Token of the deposited asset
aTokenContract private _aToken; // The aToken returned to this contract by depositing
address public treasuryAd... | address public aaveProviderAddress = 0x24a42fD28C976A61Df5D00D0599C34c4f90748c8;
LendingPoolAddressesProvider aaveProvider;
IERC20 private _underlyingAsset; // Token of the deposited asset
aTokenContract private _aToken; // The aToken returned to this contract by depositing
address public treasuryAd... | 11,230 |
281 | // Maps hash of unique request params {identifier, timestamp, ancillary data} to customizable variables such as reward and bond amounts. | mapping(bytes32 => bytes32) public requests;
| mapping(bytes32 => bytes32) public requests;
| 32,581 |
57 | // Remove minting rights after it has transferred the cDAI funds to `_avatar`Only the Avatar can execute this method / | function end() public {
_onlyAvatar();
// remaining cDAI tokens in the current reserve contract
if (ERC20(cDaiAddress).balanceOf(address(this)) > 0) {
require(
ERC20(cDaiAddress).transfer(
address(avatar),
ERC20(cDaiAddress).balanceOf(address(this))
),
"recover transfer failed"
);
}... | function end() public {
_onlyAvatar();
// remaining cDAI tokens in the current reserve contract
if (ERC20(cDaiAddress).balanceOf(address(this)) > 0) {
require(
ERC20(cDaiAddress).transfer(
address(avatar),
ERC20(cDaiAddress).balanceOf(address(this))
),
"recover transfer failed"
);
}... | 4,882 |
13 | // 最高价的地址 | address private hightAddress;
address owenr;
| address private hightAddress;
address owenr;
| 27,709 |
1 | // 증가하는 카운터의 객체를 만들어서 작동 | function incrementCounter() public {
counter++;
}
| function incrementCounter() public {
counter++;
}
| 17,710 |
104 | // Amount of USDC received in presale | uint256 usdcReceived = 0;
uint256 HardCap = 85000 * 10 ** 18; // 85,000
event TokenBuy(address user, uint256 tokens);
event TokenClaim(address user, uint256 tokens);
constructor(
address _ARBI,
address _USDC
| uint256 usdcReceived = 0;
uint256 HardCap = 85000 * 10 ** 18; // 85,000
event TokenBuy(address user, uint256 tokens);
event TokenClaim(address user, uint256 tokens);
constructor(
address _ARBI,
address _USDC
| 20,959 |
668 | // 336 | entry "giustamente" : ENG_ADVERB
| entry "giustamente" : ENG_ADVERB
| 21,172 |
72 | // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it. Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls. | uint256 nextTokenId = tokenId + 1;
if (_ownerships[nextTokenId].addr == address(0)) {
| uint256 nextTokenId = tokenId + 1;
if (_ownerships[nextTokenId].addr == address(0)) {
| 20,988 |
26 | // Reset token on market - remove | delete market[tokenId];
| delete market[tokenId];
| 27,689 |
12 | // Wrong Send Various Tokens | function returnVariousTokenFromContract(address tokenAddress) public returns (bool success) {
require(msg.sender == owner);
ERC20 tempToken = ERC20(tokenAddress);
tempToken.transfer(msg.sender, tempToken.balanceOf(address(this)));
return true;
}
| function returnVariousTokenFromContract(address tokenAddress) public returns (bool success) {
require(msg.sender == owner);
ERC20 tempToken = ERC20(tokenAddress);
tempToken.transfer(msg.sender, tempToken.balanceOf(address(this)));
return true;
}
| 56,996 |
37 | // Delphy token total supply | uint public constant TOTAL_TOKENS = 100000000 * 10**18; // 1e
| uint public constant TOTAL_TOKENS = 100000000 * 10**18; // 1e
| 30,879 |
208 | // modify the fees applied to a parity of tokens (tokens can be TREX or ERC20)_token1 the address of the base token for the parity `_token1`/`_token2`_token2 the address of the counterpart token for the parity `_token1`/`_token2`_fee1 the fee to apply on `_token1` leg of the DVD transfer per 10^`_feeBase`_fee2 the fee ... | function modifyFee(address _token1, address _token2, uint _fee1, uint _fee2, uint _feeBase, address _fee1Wallet, address _fee2Wallet) external {
require(msg.sender == owner() || isTREXOwner(_token1, msg.sender) || isTREXOwner(_token2, msg.sender), 'Ownable: only owner can call');
require(IERC20(_tok... | function modifyFee(address _token1, address _token2, uint _fee1, uint _fee2, uint _feeBase, address _fee1Wallet, address _fee2Wallet) external {
require(msg.sender == owner() || isTREXOwner(_token1, msg.sender) || isTREXOwner(_token2, msg.sender), 'Ownable: only owner can call');
require(IERC20(_tok... | 71,333 |
463 | // Returns the rate scalar scaled by time to maturity. The rate scalar multiplies/ the ln() portion of the liquidity curve as an inverse so it increases with time to/ maturity. The effect of the rate scalar on slippage must decrease with time to maturity. | function getRateScalar(
CashGroupParameters memory cashGroup,
uint256 marketIndex,
uint256 timeToMaturity
| function getRateScalar(
CashGroupParameters memory cashGroup,
uint256 marketIndex,
uint256 timeToMaturity
| 64,977 |
70 | // Transfer the tokens from the crowdsale supply to the sender | if (tokenReward.transferFrom(tokenReward.owner(), msg.sender, numTokens)) {
FundTransfer(msg.sender, amount, true);
uint balanceToSend = this.balance;
beneficiary.transfer(balanceToSend);
FundTransfer(beneficiary, balanceToSend, false);
| if (tokenReward.transferFrom(tokenReward.owner(), msg.sender, numTokens)) {
FundTransfer(msg.sender, amount, true);
uint balanceToSend = this.balance;
beneficiary.transfer(balanceToSend);
FundTransfer(beneficiary, balanceToSend, false);
| 5,667 |
250 | // Returns the number of decimals used for the token / | function decimals() external view returns (uint8);
| function decimals() external view returns (uint8);
| 19,483 |
125 | // reject buy tokens requestnonce request recorded at this particular noncereason reason for rejection/ | function rejectMint(uint256 nonce, uint256 reason)
external
onlyValidator
checkIsAddressValid(pendingMints[nonce].to)
| function rejectMint(uint256 nonce, uint256 reason)
external
onlyValidator
checkIsAddressValid(pendingMints[nonce].to)
| 30,428 |
2 | // the function to verify merkle leaf tokenDataLeaf_ the abi encoded token parameters bundle_ the encoded transaction bundle with encoded salt originHash_ the keccak256 hash of abi.encodePacked(origin chain name . origin tx hash . event nonce) receiver_ the address who will receive tokens proof_ the abi encoded merkle ... | function verifyMerkleLeaf(
bytes memory tokenDataLeaf_,
IBundler.Bundle calldata bundle_,
bytes32 originHash_,
address receiver_,
bytes calldata proof_
) external;
| function verifyMerkleLeaf(
bytes memory tokenDataLeaf_,
IBundler.Bundle calldata bundle_,
bytes32 originHash_,
address receiver_,
bytes calldata proof_
) external;
| 32,998 |
34 | // Publish restore request to the blockchain. Pass swarm link to the video which will be used to identify requester as owner of this (lost) account./ Pass along with the function call some ether, the amount should be greater then price for a single escrows' vote. | function restoreAccess(string bzzVideo) payable public {
/// Check that passed money is greater than price for a single escrow's vote
require(msg.value >= restoreAccessPrice);
/// Set calling address as restore address to which funds will be transfered upon successful restore.
... | function restoreAccess(string bzzVideo) payable public {
/// Check that passed money is greater than price for a single escrow's vote
require(msg.value >= restoreAccessPrice);
/// Set calling address as restore address to which funds will be transfered upon successful restore.
... | 12,659 |
25 | // Numero aleatorio | uint randNonce = 0;
| uint randNonce = 0;
| 2,146 |
246 | // This function must be called when the ENS Manager contract is replacedand the address of the new Manager should be provided. _newOwner The address of the new ENS manager that will manage the root node. / | function changeRootnodeOwner(address _newOwner) external override onlyOwner {
getENSRegistry().setOwner(rootNode, _newOwner);
emit RootnodeOwnerChange(rootNode, _newOwner);
}
| function changeRootnodeOwner(address _newOwner) external override onlyOwner {
getENSRegistry().setOwner(rootNode, _newOwner);
emit RootnodeOwnerChange(rootNode, _newOwner);
}
| 16,031 |
245 | // Claim all the COMP accrued by holder in all markets | function claimComp(address holder) external;
| function claimComp(address holder) external;
| 18,773 |
191 | // Backup | let temp1 := mload(pos1)
let temp2 := mload(pos2)
let temp3 := mload(pos3)
let temp4 := mload(pos4)
let temp5 := mload(pos5)
| let temp1 := mload(pos1)
let temp2 := mload(pos2)
let temp3 := mload(pos3)
let temp4 := mload(pos4)
let temp5 := mload(pos5)
| 28,675 |
48 | // Note that the owner doesn't get to claim a fee until the game is won. | ownerFee = this.balance - prizePool;
| ownerFee = this.balance - prizePool;
| 11,438 |
469 | // If the position has more than the required collateral it is solvent and the dispute is valid(liquidation is invalid) Note that this check uses the liquidatedCollateral not the lockedCollateral as this considers withdrawals. | bool disputeSucceeded = liquidation.liquidatedCollateral.isGreaterThanOrEqual(requiredCollateral);
liquidation.state = disputeSucceeded ? Status.DisputeSucceeded : Status.DisputeFailed;
emit DisputeSettled(
msg.sender,
sponsor,
liquidation.liquidator,
... | bool disputeSucceeded = liquidation.liquidatedCollateral.isGreaterThanOrEqual(requiredCollateral);
liquidation.state = disputeSucceeded ? Status.DisputeSucceeded : Status.DisputeFailed;
emit DisputeSettled(
msg.sender,
sponsor,
liquidation.liquidator,
... | 12,075 |
22 | // Save the updated NFT back to storage after packing | _poolNFTs[nftAddress][nftId] = fromBigPoolNFT(bigPoolNFT);
| _poolNFTs[nftAddress][nftId] = fromBigPoolNFT(bigPoolNFT);
| 9,082 |
42 | // only by Goldmint contract | function finishIco() public onlyIcoContract {
icoIsFinishedDate = uint64(now);
}
| function finishIco() public onlyIcoContract {
icoIsFinishedDate = uint64(now);
}
| 21,908 |
4 | // lib/dss-interfaces/src/dss/VatAbstract.sol/ pragma solidity >=0.5.12; / https:github.com/makerdao/dss/blob/master/src/vat.sol | interface VatAbstract {
function wards(address) external view returns (uint256);
function rely(address) external;
function deny(address) external;
function can(address, address) external view returns (uint256);
function hope(address) external;
function nope(address) external;
function ilks(b... | interface VatAbstract {
function wards(address) external view returns (uint256);
function rely(address) external;
function deny(address) external;
function can(address, address) external view returns (uint256);
function hope(address) external;
function nope(address) external;
function ilks(b... | 9,882 |
1 | // Add scene | function addScene(address _scene)
public
returns (bool)
{
if (!AddressArray.exist(_scene, scenes))
scenes.push(_scene);
return true;
}
| function addScene(address _scene)
public
returns (bool)
{
if (!AddressArray.exist(_scene, scenes))
scenes.push(_scene);
return true;
}
| 2,468 |
112 | // Verify merkle proof for address and address minting limit / | function verifyMerkleAddress(
bytes32[] calldata merkleProof,
bytes32 _merkleRoot,
address minterAddress,
uint256 walletLimit
| function verifyMerkleAddress(
bytes32[] calldata merkleProof,
bytes32 _merkleRoot,
address minterAddress,
uint256 walletLimit
| 26,064 |
182 | // Price calculation when price is decreased linearly in proportion to time:/`duration` The number of seconds after the start of the auction where the price will hit 0/ Note the internal call to mul multiples by WAD, thereby ensuring that the wmul calculation/ which utilizes startPrice and duration (WAD values) is also... | function price(uint256 startPrice, uint256 time) external view override returns (uint256) {
if (time >= duration) return 0;
return wmul(startPrice, wdiv(sub(duration, time), duration));
}
| function price(uint256 startPrice, uint256 time) external view override returns (uint256) {
if (time >= duration) return 0;
return wmul(startPrice, wdiv(sub(duration, time), duration));
}
| 44,445 |
63 | // Freezable token Add ability froze accounts / | contract FreezableToken is MintableToken {
mapping(address => bool) public frozenAccounts;
event FrozenFunds(address target, bool frozen);
/**
* @dev Freze account
*/
function freezeAccount(address target, bool freeze) public onlyOwnerOrAdmin {
frozenAccounts[target] = freeze;
... | contract FreezableToken is MintableToken {
mapping(address => bool) public frozenAccounts;
event FrozenFunds(address target, bool frozen);
/**
* @dev Freze account
*/
function freezeAccount(address target, bool freeze) public onlyOwnerOrAdmin {
frozenAccounts[target] = freeze;
... | 5,178 |
7 | // per currency, an array of historical balances | mapping(address => Utils.Balance[]) historicalBalance;
| mapping(address => Utils.Balance[]) historicalBalance;
| 30,470 |
17 | // Withdraw ETH to Layer 1 - register withdrawal and transfer ether to sender/_amount Ether amount to withdraw | function withdrawETH(uint128 _amount) external nonReentrant {
registerWithdrawal(0, _amount, msg.sender);
(bool success, ) = msg.sender.call.value(_amount)("");
require(success, "fwe11"); // ETH withdraw failed
}
| function withdrawETH(uint128 _amount) external nonReentrant {
registerWithdrawal(0, _amount, msg.sender);
(bool success, ) = msg.sender.call.value(_amount)("");
require(success, "fwe11"); // ETH withdraw failed
}
| 7,084 |
313 | // Wrapper around {_mintRandomIndex} that incrementally if the collection has not been revealed yet, which also checks the buyer has not exceeded maxMint count/ | function _mintRandom(address buyer, uint256 amount) internal {
require(maxMint == 0 || mintCount[buyer] + amount <= maxMint, "Buyer over mint maximum");
mintCount[buyer] += amount;
if (isRevealed) {
_mintRandomIndex(buyer, amount);
return;
}
| function _mintRandom(address buyer, uint256 amount) internal {
require(maxMint == 0 || mintCount[buyer] + amount <= maxMint, "Buyer over mint maximum");
mintCount[buyer] += amount;
if (isRevealed) {
_mintRandomIndex(buyer, amount);
return;
}
| 38,541 |
16 | // randYish Description: Kind-of-random number generator. Seed based on blockchain conditions: - difficulty - miner's address - gas limit - sender's address - block number - `puppersRemaining` Notes: - https:stackoverflow.com/questions/58188832/solidity-generate-unpredictable-random-number-that-does-not-depend-on-input | function randYish() public view returns (uint256 ret) {
uint256 seed = uint256(keccak256(abi.encodePacked(
block.timestamp + block.difficulty +
((uint256(keccak256(abi.encodePacked(block.coinbase)))) / (block.timestamp)) +
block.gaslimit +
((ui... | function randYish() public view returns (uint256 ret) {
uint256 seed = uint256(keccak256(abi.encodePacked(
block.timestamp + block.difficulty +
((uint256(keccak256(abi.encodePacked(block.coinbase)))) / (block.timestamp)) +
block.gaslimit +
((ui... | 66,935 |
13 | // EIP2981 standard Interface return. Adds to ERC721 and ERC165 Interface returns. | function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC721, IERC165)
returns (bool)
| function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC721, IERC165)
returns (bool)
| 22,586 |
55 | // Indicating if unstaking early is allowed or not This is used to upgrade liquidity to uniswap v3 | bool public override unstakeEarlyAllowed;
| bool public override unstakeEarlyAllowed;
| 10,321 |
0 | // the following variables need to be here for scoping to properly freeze normal transfers after migration has started migrationStart flag | bool public migrationStart;
| bool public migrationStart;
| 46,129 |
118 | // Validates the fallback withdrawal data and updates state to reflect the transfer _partition Source partition of the withdrawal _operator Address that is invoking the transfer _value Number of tokens to be transferred _operatorData Contains the fallback withdrawal authorization data / | function _executeFallbackWithdrawal(
bytes32 _partition,
address _operator,
uint256 _value,
bytes memory _operatorData
| function _executeFallbackWithdrawal(
bytes32 _partition,
address _operator,
uint256 _value,
bytes memory _operatorData
| 9,183 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.