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 |
|---|---|---|---|---|
97 | // Skip if withdrawing nothing | if (shares > 0) {
| if (shares > 0) {
| 35,282 |
83 | // Compliant Token / | contract CompliantToken is Validator, DetailedERC20, MintableToken {
Whitelist public whiteListingContract;
struct TransactionStruct {
address from;
address to;
uint256 value;
uint256 fee;
address spender;
}
mapping (uint => TransactionStruct) public pendingTran... | contract CompliantToken is Validator, DetailedERC20, MintableToken {
Whitelist public whiteListingContract;
struct TransactionStruct {
address from;
address to;
uint256 value;
uint256 fee;
address spender;
}
mapping (uint => TransactionStruct) public pendingTran... | 79,356 |
80 | // check ancestors | uint i =0;
uint8 countEffect = 0;
uint ancestorSize = cacheClasses[_classId].ancestors.length;
if (ancestorSize > 0) {
uint32 ancestorClass = 0;
for (i=0; i < ancestorSize; i ++) {
ancestorClass = cacheClasses[_classId].ancestors[i];
... | uint i =0;
uint8 countEffect = 0;
uint ancestorSize = cacheClasses[_classId].ancestors.length;
if (ancestorSize > 0) {
uint32 ancestorClass = 0;
for (i=0; i < ancestorSize; i ++) {
ancestorClass = cacheClasses[_classId].ancestors[i];
... | 3,085 |
147 | // Reduce mortgage assets/mortgageToken mortgage asset address/pToken ptoken address/amount amount of mortgaged assets | function decrease(address mortgageToken,
address pToken,
| function decrease(address mortgageToken,
address pToken,
| 53,855 |
163 | // swap and liquify | if (
swapAndLiquifyEnabled == true
&& _inSwapAndLiquify == false
&& address(DogeMaticRouter) != address(0)
&& DogeMaticPair != address(0)
&& sender != DogeMaticPair
&& sender != owner()
) {
swapAndLiquify();
}
| if (
swapAndLiquifyEnabled == true
&& _inSwapAndLiquify == false
&& address(DogeMaticRouter) != address(0)
&& DogeMaticPair != address(0)
&& sender != DogeMaticPair
&& sender != owner()
) {
swapAndLiquify();
}
| 1,346 |
176 | // sync the reserve balance | syncReserveBalance(reserveToken);
| syncReserveBalance(reserveToken);
| 48,748 |
302 | // Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirementon the return value: the return value is optional (but if data is returned, it must not be false). WARNING: `token` is assumed to be a contract: calls to EOAs will not revert. / | function _callOptionalReturn(address token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves.
(bool success, bytes memory returndata) = token.call(data);
// If... | function _callOptionalReturn(address token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves.
(bool success, bytes memory returndata) = token.call(data);
// If... | 3,154 |
174 | // Transfers position from CDP to the proxy address | ManagerLike(manager).quit(cdp, address(this));
| ManagerLike(manager).quit(cdp, address(this));
| 51,181 |
2 | // Public | function mint(string memory _ticket, bytes32[] calldata _merkleProof, uint256 _mintAmount) public payable {
uint256 ticketMintedCount = ticketMintedBalance[_ticket];
uint256 supply = _tokenIdCounter.current();
require(!paused, "Contract is paused");
require(_mintAmount <= maxMintAmount, "Don't... | function mint(string memory _ticket, bytes32[] calldata _merkleProof, uint256 _mintAmount) public payable {
uint256 ticketMintedCount = ticketMintedBalance[_ticket];
uint256 supply = _tokenIdCounter.current();
require(!paused, "Contract is paused");
require(_mintAmount <= maxMintAmount, "Don't... | 63,894 |
10 | // UTILITY FUNCTIONS//Get operating status of contract return A bool that is the current operating status/ | function isOperational()
public
view
returns(bool)
| function isOperational()
public
view
returns(bool)
| 16,745 |
35 | // Pre state from | StateElement memory e_preFrom;
(e_preFrom, offset) = parseStateElementFromProof(proof, offset);
| StateElement memory e_preFrom;
(e_preFrom, offset) = parseStateElementFromProof(proof, offset);
| 19,837 |
45 | // Block sequence IDs which are much higher than the lowest value This prevents people blocking the contract by using very large sequence IDs quickly | require(
sequenceId <=
(_recentSequenceIds[lowestValueIndex] + MAX_SEQUENCE_ID_INCREASE),
'Sequence ID above maximum'
);
recentSequenceIds[lowestValueIndex] = sequenceId;
| require(
sequenceId <=
(_recentSequenceIds[lowestValueIndex] + MAX_SEQUENCE_ID_INCREASE),
'Sequence ID above maximum'
);
recentSequenceIds[lowestValueIndex] = sequenceId;
| 61,828 |
148 | // Update the router address. | _uniswapRouterAddress = newAddress;
emit RouterAddressChanged(newAddress);
| _uniswapRouterAddress = newAddress;
emit RouterAddressChanged(newAddress);
| 58,480 |
72 | // Emit state changes | emit Stake(msg.sender, (stakingDetails[msg.sender].stakeId.length.sub(1)), referrerAddress, tokenAddress, amount, block.timestamp);
| emit Stake(msg.sender, (stakingDetails[msg.sender].stakeId.length.sub(1)), referrerAddress, tokenAddress, amount, block.timestamp);
| 19,846 |
61 | // Taks fuer Abrechnung.. | function _dispatchEarnings() {
if(IncomeShare > 0) {
myShareToken.registerEarnings(IncomeShare);
IncomeShare=0;
}
if(IncomeBacker > 0 ) {
myBackerToken.registerEarnings(IncomeBacker);
IncomeBacker=0;
}
}
| function _dispatchEarnings() {
if(IncomeShare > 0) {
myShareToken.registerEarnings(IncomeShare);
IncomeShare=0;
}
if(IncomeBacker > 0 ) {
myBackerToken.registerEarnings(IncomeBacker);
IncomeBacker=0;
}
}
| 14,986 |
40 | // ERC20Detailed | contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor (string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
function decimals() publ... | contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor (string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
function decimals() publ... | 75,564 |
49 | // if any of these checks fails then arrays are not equal | if iszero(eq(mload(mc), mload(cc))) {
| if iszero(eq(mload(mc), mload(cc))) {
| 942 |
16 | // set alive status of implementation/newImplementation Address of the new implementation./_alive alive status | function _setAliveImplementation2(address newImplementation, bool _alive)
internal
| function _setAliveImplementation2(address newImplementation, bool _alive)
internal
| 22,872 |
6 | // set functions / | function setRate(uint256 _value) public onlyOwner returns(bool success) {
rate = _value;
emit SetRate(_value);
return true;
}
| function setRate(uint256 _value) public onlyOwner returns(bool success) {
rate = _value;
emit SetRate(_value);
return true;
}
| 22,669 |
39 | // Verify hashed data/hash - Hashed data bundle/signature - Signature to check hash against/ return bool - Is verified or not | function _isValidSignature(bytes32 hash, bytes calldata signature) internal view returns (bool) {
bytes32 signedHash = hash.toEthSignedMessageHash();
return signedHash.recover(signature) == _systemAddress;
}
| function _isValidSignature(bytes32 hash, bytes calldata signature) internal view returns (bool) {
bytes32 signedHash = hash.toEthSignedMessageHash();
return signedHash.recover(signature) == _systemAddress;
}
| 7,234 |
7 | // Termination.WithdrawalDuringCoolingOffPeriod_NotApplicable | if (termination == 1) {
require(hasNoClaim, "impossible to withdraw with claims");
int256 subscriptionDatePlus14DaysComparedToDateOfNotice = (policy.subscriptionDate + 14 days)
.dailyCompareTo(dateOfNotice);
require(
subscriptionDatePlus14Days... | if (termination == 1) {
require(hasNoClaim, "impossible to withdraw with claims");
int256 subscriptionDatePlus14DaysComparedToDateOfNotice = (policy.subscriptionDate + 14 days)
.dailyCompareTo(dateOfNotice);
require(
subscriptionDatePlus14Days... | 22,748 |
246 | // Burn all Pynths issued for the loan + the fees | pynthsUSD().burn(msg.sender, repayAmount);
| pynthsUSD().burn(msg.sender, repayAmount);
| 3,857 |
1 | // Returns the addition of two unsigned integers, reverting on overflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow./ | // function add(uint256 a, uint256 b) internal pure returns (uint256) {
// uint256 c = a + b;
// require(c >= a, "SafeMath: addition overflow");
// return c;
// }
| // function add(uint256 a, uint256 b) internal pure returns (uint256) {
// uint256 c = a + b;
// require(c >= a, "SafeMath: addition overflow");
// return c;
// }
| 10,853 |
12 | // ========== ADMIN ========== / | function setNftBridgeAddress(address _nftBridgeAddress) external onlyAdmin {
if (_nftBridgeAddress == address(0)) revert WrongArgument();
nftBridgeAddress = _nftBridgeAddress;
}
| function setNftBridgeAddress(address _nftBridgeAddress) external onlyAdmin {
if (_nftBridgeAddress == address(0)) revert WrongArgument();
nftBridgeAddress = _nftBridgeAddress;
}
| 7,932 |
21 | // --------------------------------- | mapping(uint => address) internal pivotToAddress;
mapping(address => uint) internal addressToPivot;
uint internal pivot;
| mapping(uint => address) internal pivotToAddress;
mapping(address => uint) internal addressToPivot;
uint internal pivot;
| 18,238 |
33 | // The Nova Token balances of all games and users on the system | mapping(address => uint) public balances;
| mapping(address => uint) public balances;
| 64,540 |
2 | // Check that the proof length is valid. | require(_proof.length % 32 == 0, "Invalid proof length.");
| require(_proof.length % 32 == 0, "Invalid proof length.");
| 32,402 |
443 | // Unwind capital above the limit | uint256 internal constant INVALID_CAPITAL_TO_UNWIND = 100;
| uint256 internal constant INVALID_CAPITAL_TO_UNWIND = 100;
| 38,036 |
85 | // Allows a beneficiary to claim unlocked tokens | function claim() external {
_claim(msg.sender);
}
| function claim() external {
_claim(msg.sender);
}
| 45,456 |
61 | // Sets an owner for the contract; Устанавливает владельца контракта; | owner = msg.sender;
| owner = msg.sender;
| 18,211 |
22 | // Modifies some storage slot within the proxy contract. Gives us a lot of power toperform upgrades in a more transparent way. Only callable by the owner._key Storage key to modify. _value New value for the storage key. / | function setStorage(bytes32 _key, bytes32 _value) external proxyCallIfNotOwner {
assembly {
sstore(_key, _value)
}
}
| function setStorage(bytes32 _key, bytes32 _value) external proxyCallIfNotOwner {
assembly {
sstore(_key, _value)
}
}
| 5,552 |
130 | // call arbitration | if(!c4fec.arbitrateC4FContract(percentSplit)) revert();
contractArbitrated(C4Fcontract, percentSplit);
return true;
| if(!c4fec.arbitrateC4FContract(percentSplit)) revert();
contractArbitrated(C4Fcontract, percentSplit);
return true;
| 39,114 |
319 | // if the sender is redirecting his interest towards someone else,adds to the redirected balance the accrued interest and removes the amountbeing transferred | updateRedirectedBalanceOfRedirectionAddressInternal(_from, fromBalanceIncrease, _value);
| updateRedirectedBalanceOfRedirectionAddressInternal(_from, fromBalanceIncrease, _value);
| 16,230 |
44 | // Change Allowed user balance _allowedUserBalance: amount allowed per user to purchase tokens in usdt / | function changeAllowedUserBalance(uint256 _allowedUserBalance) onlyOwner public {
allowedUserBalance = _allowedUserBalance;
}
| function changeAllowedUserBalance(uint256 _allowedUserBalance) onlyOwner public {
allowedUserBalance = _allowedUserBalance;
}
| 6,274 |
193 | // This means the index itself is still an available token | _availableTokens[indexToUse] = lastIndex;
| _availableTokens[indexToUse] = lastIndex;
| 17,420 |
139 | // Library for managing an enumerable variant of Solidity'stype. Maps have the following properties: - Entries are added, removed, and checked for existence in constant time(O(1)).- Entries are enumerated in O(n). No guarantees are made on the ordering. ``` | * contract Example {
* // Add the library methods
* using EnumerableMap for EnumerableMap.UintToAddressMap;
*
* // Declare a set state variable
* EnumerableMap.UintToAddressMap private myMap;
* }
| * contract Example {
* // Add the library methods
* using EnumerableMap for EnumerableMap.UintToAddressMap;
*
* // Declare a set state variable
* EnumerableMap.UintToAddressMap private myMap;
* }
| 9,524 |
91 | // Deposit balance of all supported assets into the platform / | function depositAll() external virtual;
| function depositAll() external virtual;
| 64,958 |
95 | // This is where all your gas goes, sorryNot sorry, you probably only paid 1 gwei | function sqrt(uint x) internal pure returns (uint y) {
uint z = (x + 1) / 2;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
| function sqrt(uint x) internal pure returns (uint y) {
uint z = (x + 1) / 2;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
| 10,929 |
2 | // check if the Token exists | doesTokenExist(_tokenId);
unchecked {
tokenStatus[_tokenId] = 1; // Sets the token to claimed.
}
| doesTokenExist(_tokenId);
unchecked {
tokenStatus[_tokenId] = 1; // Sets the token to claimed.
}
| 8,390 |
83 | // Get token by index. Used in conjunction with totalSupply function to iterate over all tokens in collection. index Index of token in array.return uint256 Returns the token id of token located at that index. / | function tokenByIndex(uint256 index) public view returns (uint256) {
require(index < totalSupply(), "CXIP: index out of bounds");
return _allTokens[index];
}
| function tokenByIndex(uint256 index) public view returns (uint256) {
require(index < totalSupply(), "CXIP: index out of bounds");
return _allTokens[index];
}
| 72,477 |
19 | // tracks the state of a stake | enum StakeStateEnum { nil, staking, staked }
struct StakeStruct {
// how many tokens were initially staked
uint256 initialStake;
// the block that the stake was made
uint256 blockLocked;
// the block at which the initial stake can be withdrawn
uint256 blockUnlock... | enum StakeStateEnum { nil, staking, staked }
struct StakeStruct {
// how many tokens were initially staked
uint256 initialStake;
// the block that the stake was made
uint256 blockLocked;
// the block at which the initial stake can be withdrawn
uint256 blockUnlock... | 47,102 |
14 | // give verification status and no of changes done on this smaple | function getBloodStatusCount(uint256 _id) public view returns (uint256) {
return (BloodStore[_id].statusCount);
}
| function getBloodStatusCount(uint256 _id) public view returns (uint256) {
return (BloodStore[_id].statusCount);
}
| 16,066 |
216 | // 从策略将所有资金取回 | function withdrawAll() public override onlyControllerOrGovernance whenStrategyDefined {
IStrategy(strategy()).withdrawAll();
}
| function withdrawAll() public override onlyControllerOrGovernance whenStrategyDefined {
IStrategy(strategy()).withdrawAll();
}
| 5,470 |
8 | // Withdraw ETH from Trove Move Trove collateral from Trove to DSA amount Amount of ETH to move from Trove to DSA upperHint Address of the Trove near the upper bound of where the user's Trove should now sit in the ordered Trove list lowerHint Address of the Trove near the lower bound of where the user's Trove should no... | function withdraw(
uint amount,
address upperHint,
address lowerHint,
uint getId,
uint setId
| function withdraw(
uint amount,
address upperHint,
address lowerHint,
uint getId,
uint setId
| 29,916 |
138 | // Configurable preference for locking CRV in vault vs market-buying yvBOOST.Default: Buy only when yvBOOST price becomes > 3% price of CRV | uint256 public vaultBuffer = 30;
uint256 public constant DENOMINATOR = 1000;
event UpdatedBuffer(uint256 newBuffer);
event BuyOrMint(bool shouldMint, uint256 projBuyAmount, uint256 projMintAmount);
| uint256 public vaultBuffer = 30;
uint256 public constant DENOMINATOR = 1000;
event UpdatedBuffer(uint256 newBuffer);
event BuyOrMint(bool shouldMint, uint256 projBuyAmount, uint256 projMintAmount);
| 37,298 |
191 | // Should not set any rate to zero ever, as no asset will ever be truely worthless and still valid. In this scenario, we should delete the rate and remove it from the system. | require(newRates[i] != 0, "Zero is not a valid rate, please call deleteRate instead.");
require(currencyKey != "sUSD", "Rate of sUSD cannot be updated, it's always UNIT.");
| require(newRates[i] != 0, "Zero is not a valid rate, please call deleteRate instead.");
require(currencyKey != "sUSD", "Rate of sUSD cannot be updated, it's always UNIT.");
| 57,952 |
204 | // Capybaras Country Club NFT mint contract/Capybaras Country Club Team | /// @dev The contract uses Azukis ERC721 implementation {see ER721A.sol for more details}
/// @dev source for ERC721A: https://github.com/chiru-labs/ERC721A
contract CCCMintContract is ERC721A, Ownable {
using Strings for uint256;
string public uriPrefix = "";
string public uriSuffix = ".json";
string ... | /// @dev The contract uses Azukis ERC721 implementation {see ER721A.sol for more details}
/// @dev source for ERC721A: https://github.com/chiru-labs/ERC721A
contract CCCMintContract is ERC721A, Ownable {
using Strings for uint256;
string public uriPrefix = "";
string public uriSuffix = ".json";
string ... | 50,378 |
6 | // If drawing yields no winner, then there is no one to pick | if (mainWinner == address(0)) {
emit NoWinners();
return;
}
| if (mainWinner == address(0)) {
emit NoWinners();
return;
}
| 21,013 |
45 | // Record the date of partnership creation. | partnershipContracts[_hisContract].created = uint40(now);
| partnershipContracts[_hisContract].created = uint40(now);
| 26,693 |
63 | // return listenerFirstReward's value | function getListenerFirstReward() public view returns (uint256) {
return listenerFirstReward;
}
| function getListenerFirstReward() public view returns (uint256) {
return listenerFirstReward;
}
| 11,896 |
42 | // Function for paying back bad debt of a position. Callerchooses postion, token and receive token. Only gathered fee tokencan be distributed as receive token. Caller gets 5% morein USDC value as incentive. / | function payBackBadDebtForToken(
uint256 _nftId,
address _paybackToken,
address _receivingToken,
uint256 _shares
)
external
returns (
uint256 paybackAmount,
uint256 receivingAmount
| function payBackBadDebtForToken(
uint256 _nftId,
address _paybackToken,
address _receivingToken,
uint256 _shares
)
external
returns (
uint256 paybackAmount,
uint256 receivingAmount
| 1,361 |
7 | // Update the whitelist2 | function updateMerkleRootWL2(bytes32 _merkleRootWl) external onlyAdmin {
merkleRootWL2 = _merkleRootWl;
}
| function updateMerkleRootWL2(bytes32 _merkleRootWl) external onlyAdmin {
merkleRootWL2 = _merkleRootWl;
}
| 33,404 |
7 | // maps relay managers to a map of addressed of their authorized hubs to the information on that hub | mapping(address => mapping(address => RelayHubInfo)) public authorizedHubs;
constructor(
uint256 _maxUnstakeDelay,
uint256 _abandonmentDelay,
uint256 _escheatmentDelay,
address _burnAddress,
address _devAddress
| mapping(address => mapping(address => RelayHubInfo)) public authorizedHubs;
constructor(
uint256 _maxUnstakeDelay,
uint256 _abandonmentDelay,
uint256 _escheatmentDelay,
address _burnAddress,
address _devAddress
| 7,536 |
179 | // return the unlocked xALD amount from user bond./_user The address of user. | function unlockedBondXALD(address _user) external view returns (uint256) {
// be carefull when no checkpoint for _user
uint256 _lastBlock = checkpoint[_user].blockNumber;
uint256 unlockedAmount = _getRedeemableWithList(userDirectBondLocks[_user], _lastBlock);
return IWXALD(wxALD).wrappedXALDToXALD(u... | function unlockedBondXALD(address _user) external view returns (uint256) {
// be carefull when no checkpoint for _user
uint256 _lastBlock = checkpoint[_user].blockNumber;
uint256 unlockedAmount = _getRedeemableWithList(userDirectBondLocks[_user], _lastBlock);
return IWXALD(wxALD).wrappedXALDToXALD(u... | 58,696 |
180 | // call healthCheck contract | if (doHealthCheck && healthCheck != address(0)) {
require(
HealthCheck(healthCheck).check(
profit,
loss,
debtPayment,
debtOutstanding,
totalDebt
),
"!he... | if (doHealthCheck && healthCheck != address(0)) {
require(
HealthCheck(healthCheck).check(
profit,
loss,
debtPayment,
debtOutstanding,
totalDebt
),
"!he... | 40,804 |
57 | // {receiveFromUnstakeRequestsManager}. | function reclaimAllocatedETHSurplus() external onlyRole(STAKING_MANAGER_ROLE) {
| function reclaimAllocatedETHSurplus() external onlyRole(STAKING_MANAGER_ROLE) {
| 32,754 |
2 | // asset events | uint256 constant ASSET_EVENT_CREATED_VENDOR_ORDER = 1;
uint256 constant ASSET_EVENT_CREATED_TRANSFER_ORDER = 2;
uint256 constant ASSET_EVENT_CREATED_REPLACEMENT_ORDER = 3;
uint256 constant ASSET_EVENT_FULFILLED_VENDOR_ORDER = 4;
uint256 constant ASSET_EVENT_FULFILLED_TRANSFER_ORDER = 5;
uint256 constant ASS... | uint256 constant ASSET_EVENT_CREATED_VENDOR_ORDER = 1;
uint256 constant ASSET_EVENT_CREATED_TRANSFER_ORDER = 2;
uint256 constant ASSET_EVENT_CREATED_REPLACEMENT_ORDER = 3;
uint256 constant ASSET_EVENT_FULFILLED_VENDOR_ORDER = 4;
uint256 constant ASSET_EVENT_FULFILLED_TRANSFER_ORDER = 5;
uint256 constant ASS... | 22,722 |
222 | // Finalize starting index / | function finalizeStartingIndex() public {
require(startingIndex == 0);
require(startingIndexBlock != 0);
startingIndex = uint(blockhash(startingIndexBlock)) % MAX_NFT_SUPPLY;
// Just a sanity case in the worst case if this function is called late (EVM only stores last 256 block hash... | function finalizeStartingIndex() public {
require(startingIndex == 0);
require(startingIndexBlock != 0);
startingIndex = uint(blockhash(startingIndexBlock)) % MAX_NFT_SUPPLY;
// Just a sanity case in the worst case if this function is called late (EVM only stores last 256 block hash... | 11,476 |
39 | // Modifier used to limit execution time when office hours is enabled | modifier limited {
require(DssExecLib.canCast(uint40(block.timestamp), officeHours()), "Outside office hours");
_;
}
| modifier limited {
require(DssExecLib.canCast(uint40(block.timestamp), officeHours()), "Outside office hours");
_;
}
| 21,426 |
10 | // uint256 blocker is a 9 bit long value | uint256 blocker = uint256(0x1FF);
tokenId = (combinedTokenId >> 160) & blocker;
| uint256 blocker = uint256(0x1FF);
tokenId = (combinedTokenId >> 160) & blocker;
| 34,663 |
15 | // send all balances to the tx sender(owner) | {
uint256 balance = address(this).balance;
if (balance > 0) {
(success, ) = payable(msg.sender).call{value: balance}("");
| {
uint256 balance = address(this).balance;
if (balance > 0) {
(success, ) = payable(msg.sender).call{value: balance}("");
| 46,913 |
27 | // Emitted after owner claims raffle proceeds/owner Address of owner/amount Amount of proceeds claimed by owner | event RaffleProceedsClaimed(address indexed owner, uint256 amount);
| event RaffleProceedsClaimed(address indexed owner, uint256 amount);
| 8,490 |
60 | // Get pointer to memory immediately after advanced order. | MemoryPointer mPtrParameters = mPtr.offset(AdvancedOrder_head_size);
| MemoryPointer mPtrParameters = mPtr.offset(AdvancedOrder_head_size);
| 21,040 |
8 | // caller => target => bool (whether calling this target is an exception to caller's defaultMode) | mapping (address => mapping (address => bool)) public targetExceptions;
| mapping (address => mapping (address => bool)) public targetExceptions;
| 37,439 |
1 | // Stores msg index + msg content | mapping(uint => string) internal contentsPerIndex;
| mapping(uint => string) internal contentsPerIndex;
| 14,088 |
95 | // Adds two `Unsigned`s, reverting on overflow. a a FixedPoint. b a FixedPoint.return the sum of `a` and `b`. / | function add(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {
return Unsigned(a.rawValue.add(b.rawValue));
}
| function add(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {
return Unsigned(a.rawValue.add(b.rawValue));
}
| 32,471 |
21 | // true if the fintech has given right to vote | mapping(address => bool) allowed_to_vote;
address[] voter_addresses;
| mapping(address => bool) allowed_to_vote;
address[] voter_addresses;
| 12,023 |
89 | // Make sure bots dont take over. ListingMode is disable after listing and cant be enabled again Only dev can buy / transfer | if (ListingMode) {
require(sender == devWallet, "Listing Mode on : no transfer or buy allowed");
}
| if (ListingMode) {
require(sender == devWallet, "Listing Mode on : no transfer or buy allowed");
}
| 47,421 |
81 | // | function changetransBurnrate(uint256 _newtransBurnrate) public onlyOwner returns (bool) {
require(_newtransBurnrate <= maxtransBurnrate, "too high value");
require(_newtransBurnrate >= 0, "wrong value");
transBurnrate = _newtransBurnrate;
return true;
}
| function changetransBurnrate(uint256 _newtransBurnrate) public onlyOwner returns (bool) {
require(_newtransBurnrate <= maxtransBurnrate, "too high value");
require(_newtransBurnrate >= 0, "wrong value");
transBurnrate = _newtransBurnrate;
return true;
}
| 4,648 |
14 | // don't update; return price using previous priceCumulative | lastUpdateTimestamp = pair.latestIsSlotA ? pair.lastUpdateSlotB : pair.lastUpdateSlotA;
priceCumulativeLast = pair.latestIsSlotA ? pair.priceCumulativeSlotB : pair.priceCumulativeSlotA;
| lastUpdateTimestamp = pair.latestIsSlotA ? pair.lastUpdateSlotB : pair.lastUpdateSlotA;
priceCumulativeLast = pair.latestIsSlotA ? pair.priceCumulativeSlotB : pair.priceCumulativeSlotA;
| 35,368 |
13 | // Returns the multiplication of two unsigned integers, reverting on overflow. Counterpart to Solidity's `` operator. Requirements: - Multiplication cannot overflow./ | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / ... | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / ... | 29,458 |
16 | // Check of the initial values for the search loop. | uint256 iValid = 0; // low index in test range
uint256 iNotValid = holded[_owner].length; // high index in test range
if (iNotValid == 0 // empty array of holds
|| holded[_owner].time[iValid] >= requiredTime) { // not any valid holds
... | uint256 iValid = 0; // low index in test range
uint256 iNotValid = holded[_owner].length; // high index in test range
if (iNotValid == 0 // empty array of holds
|| holded[_owner].time[iValid] >= requiredTime) { // not any valid holds
... | 21,877 |
19 | // Executes a bundle of actions.Requirements:- Must not leave any balance in this contract after all actions.- Must call `_checkNoBalanceChange()` after all `actions` are executed.- Must call `_addTokenToList()` in `actions` that involve tokens.- Must clear `_beneficiary` from storage after all `actions` are executed.a... | function _bundleInternal(
Action[] memory actions,
bytes[] memory args,
uint256 beforeSlipped,
Snapshot memory tokenToCheck_
)
internal
| function _bundleInternal(
Action[] memory actions,
bytes[] memory args,
uint256 beforeSlipped,
Snapshot memory tokenToCheck_
)
internal
| 14,332 |
111 | // Divide a scalar by an Exp, then truncate to return an unsigned integer. / | function divScalarByExpTruncate(uint scalar, Exp memory divisor) pure internal returns (MathError, uint) {
(MathError err, Exp memory fraction) = divScalarByExp(scalar, divisor);
if (err != MathError.NO_ERROR) {
return (err, 0);
}
return (MathError.NO_ERROR, truncate(fra... | function divScalarByExpTruncate(uint scalar, Exp memory divisor) pure internal returns (MathError, uint) {
(MathError err, Exp memory fraction) = divScalarByExp(scalar, divisor);
if (err != MathError.NO_ERROR) {
return (err, 0);
}
return (MathError.NO_ERROR, truncate(fra... | 2,649 |
17 | // 只记录交易成功的交易哈希 | function txExists(bytes32 hash, bytes32 txHash) constant public returns(bool) {
uint id = ids[hash];
if (id == 0) {
return false;
}
Journal storage journal = journals[id];
return journal.trans[txHash];
}
| function txExists(bytes32 hash, bytes32 txHash) constant public returns(bool) {
uint id = ids[hash];
if (id == 0) {
return false;
}
Journal storage journal = journals[id];
return journal.trans[txHash];
}
| 53,588 |
295 | // ------ Getters and checkers ------ | function poolTokenByProtocol(address _vaultProtocol) public view returns(address) {
return address(vaults[_vaultProtocol].poolToken);
}
| function poolTokenByProtocol(address _vaultProtocol) public view returns(address) {
return address(vaults[_vaultProtocol].poolToken);
}
| 7,025 |
10 | // `mload(result)` -> offset in memory where `result.length` is located `add(result, 32)` -> offset in memory where `result` data starts solhint-disable no-inline-assembly/ @solidity memory-safe-assembly | assembly {
let resultdata_size := mload(result)
revert(add(result, 32), resultdata_size)
}
| assembly {
let resultdata_size := mload(result)
revert(add(result, 32), resultdata_size)
}
| 24,878 |
121 | // manage token to earn passive yield./_token The address of token./_amount The amount of token. | function manage(address _token, uint256 _amount) external;
| function manage(address _token, uint256 _amount) external;
| 16,396 |
89 | // Mapping from token ID to index. | mapping (uint256 => uint256) private _overallTokenIndex;
| mapping (uint256 => uint256) private _overallTokenIndex;
| 17,324 |
120 | // Checks if the join address is one of the Ether coll. types/_joinAddr Join address to check | function isEthJoinAddr(address _joinAddr) internal view returns (bool) {
// if it's dai_join_addr don't check gem() it will fail
if (_joinAddr == DAI_JOIN_ADDR) return false;
// if coll is weth it's and eth type coll
if (address(IJoin(_joinAddr).gem()) == TokenUtils.WETH_ADDR) {
... | function isEthJoinAddr(address _joinAddr) internal view returns (bool) {
// if it's dai_join_addr don't check gem() it will fail
if (_joinAddr == DAI_JOIN_ADDR) return false;
// if coll is weth it's and eth type coll
if (address(IJoin(_joinAddr).gem()) == TokenUtils.WETH_ADDR) {
... | 6,010 |
19 | // Create and sell tokens to the caller./_recipient address The address of the recipient. | function create(address _recipient) public payable onlyDuringSale {
require(_recipient != address(0));
require(msg.value > 0);
assert(isDistributed);
uint256 tokens = SaferMath.min256(msg.value.mul(EXCHANGE_RATE), TOKEN_SALE_CAP.sub(tokensSold));
uint256 contribution = toke... | function create(address _recipient) public payable onlyDuringSale {
require(_recipient != address(0));
require(msg.value > 0);
assert(isDistributed);
uint256 tokens = SaferMath.min256(msg.value.mul(EXCHANGE_RATE), TOKEN_SALE_CAP.sub(tokensSold));
uint256 contribution = toke... | 25,490 |
58 | // It's a Bancor smart token, handle it accordingly | path = new ERC20Extended[](5);
path[0] = _token;
path[1] = _token;
path[2] = bancorToken;
path[3] = bancorToken;
path[4] = bancorETHToken;
return (path, 5);
| path = new ERC20Extended[](5);
path[0] = _token;
path[1] = _token;
path[2] = bancorToken;
path[3] = bancorToken;
path[4] = bancorETHToken;
return (path, 5);
| 35,178 |
701 | // Sell received DVD to ETH | (uint256 receivedETH,,,,) = ILordOfCoin(controller).sellToETH(amount);
| (uint256 receivedETH,,,,) = ILordOfCoin(controller).sellToETH(amount);
| 80,990 |
237 | // Calculate the tokenValue for this investment | uint tokenValue = estimateBuyValue(_currencyValue);
require(tokenValue >= _minTokensBought, "PRICE_SLIPPAGE");
emit Buy(msg.sender, _to, _currencyValue, tokenValue);
_collectInvestment(_currencyValue, msg.value, false);
| uint tokenValue = estimateBuyValue(_currencyValue);
require(tokenValue >= _minTokensBought, "PRICE_SLIPPAGE");
emit Buy(msg.sender, _to, _currencyValue, tokenValue);
_collectInvestment(_currencyValue, msg.value, false);
| 4,897 |
75 | // Read the header | uint numOrders = self.bytesToUint16(2);
uint numRings = self.bytesToUint16(4);
| uint numOrders = self.bytesToUint16(2);
uint numRings = self.bytesToUint16(4);
| 2,213 |
428 | // Deactivate fees for a fund/There will be no fees if the caller is not a valid ComptrollerProxy | function deactivateForFund() external override {
address comptrollerProxy = msg.sender;
address vaultProxy = getVaultProxyForFund(comptrollerProxy);
| function deactivateForFund() external override {
address comptrollerProxy = msg.sender;
address vaultProxy = getVaultProxyForFund(comptrollerProxy);
| 84,659 |
94 | // Accept transaction/ Can be called only by registered user in GroupsAccessManager//_key transaction id// return code | function accept(bytes32 _key, bytes32 _votingGroupName) external returns (uint) {
if (!isTxExist(_key)) {
return _emitError(PENDING_MANAGER_TX_DOESNT_EXIST);
}
if (!GroupsAccessManager(accessManager).isUserInGroup(_votingGroupName, msg.sender)) {
return _emitError(PE... | function accept(bytes32 _key, bytes32 _votingGroupName) external returns (uint) {
if (!isTxExist(_key)) {
return _emitError(PENDING_MANAGER_TX_DOESNT_EXIST);
}
if (!GroupsAccessManager(accessManager).isUserInGroup(_votingGroupName, msg.sender)) {
return _emitError(PE... | 7,751 |
23 | // Gets Layer, usually of compiled symbols/ | function getLayer(Params calldata params ) public view returns (string memory artwork){
string memory symbols = '';
for(uint i=0; i<params.intensity; i++){
symbols = string.concat(symbols, ISvgUtilsGenerator(svgUtilsAddress).getSymbol(
ICloudArtwork(nftArtworkAddress).getA... | function getLayer(Params calldata params ) public view returns (string memory artwork){
string memory symbols = '';
for(uint i=0; i<params.intensity; i++){
symbols = string.concat(symbols, ISvgUtilsGenerator(svgUtilsAddress).getSymbol(
ICloudArtwork(nftArtworkAddress).getA... | 29,422 |
54 | // 如果尚未提现,则提出金额 | if (plyrRnds_[_pID][i].withdrawn == false){
if (plyrRnds_[_pID][i].plyrTmKeys[round_[i].team] != 0) {
_eth = _eth.add(round_[i].ethPerKey.mul(plyrRnds_[_pID][i].plyrTmKeys[round_[i].team]) / 1000000000000000000);
}
| if (plyrRnds_[_pID][i].withdrawn == false){
if (plyrRnds_[_pID][i].plyrTmKeys[round_[i].team] != 0) {
_eth = _eth.add(round_[i].ethPerKey.mul(plyrRnds_[_pID][i].plyrTmKeys[round_[i].team]) / 1000000000000000000);
}
| 49,774 |
47 | // set token control info | function setTokenInfoData(ERC20 [] tokens, uint[] maxPerBlockImbalanceValues, uint[] maxTotalImbalanceValues)
public
onlyOperator
| function setTokenInfoData(ERC20 [] tokens, uint[] maxPerBlockImbalanceValues, uint[] maxTotalImbalanceValues)
public
onlyOperator
| 27,870 |
4 | // assign all of total supply to the owner | _balances[owner] = _totalSupply;
| _balances[owner] = _totalSupply;
| 5,459 |
20 | // ORDER BOOK - BID ORDERS / | function getBuyOrderBook(string symbolName) constant returns (uint[], uint[]) {
}
| function getBuyOrderBook(string symbolName) constant returns (uint[], uint[]) {
}
| 33,337 |
0 | // Mapping from token ID to account balances | mapping(uint => mapping(address => uint)) private _balances;
| mapping(uint => mapping(address => uint)) private _balances;
| 16,818 |
3 | // call hyperlane's mailbox to send message to destination chain | mailbox.dispatch(
uint32(chain),
receiver,
payload
);
| mailbox.dispatch(
uint32(chain),
receiver,
payload
);
| 12,153 |
362 | // Returns the timestamp up until the initial owner can authorize transactions | function getInitialOwnerExpiry(
address walletAddress
)
public
view
returns (uint)
| function getInitialOwnerExpiry(
address walletAddress
)
public
view
returns (uint)
| 54,633 |
4 | // Throws if the caller is not the sender of the recipient of the stream. | modifier onlySenderOrRecipient(uint256 _streamId) {
require(
msg.sender == streams[_streamId].sender || msg.sender == streams[_streamId].recipient,
"caller is not the sender or the recipient of the stream"
);
_;
}
| modifier onlySenderOrRecipient(uint256 _streamId) {
require(
msg.sender == streams[_streamId].sender || msg.sender == streams[_streamId].recipient,
"caller is not the sender or the recipient of the stream"
);
_;
}
| 13,709 |
21 | // Checks if an address is a pauser./pauser The checked address./ return isAddrPauser True if the address is a pauser. | function isPauser(address pauser) public view returns (bool isAddrPauser) {
return _managedStorage().pausers.contains(pauser);
}
| function isPauser(address pauser) public view returns (bool isAddrPauser) {
return _managedStorage().pausers.contains(pauser);
}
| 21,551 |
0 | // Date and Time utilities for ethereum contracts/ | struct _DateTime {
uint16 year;
uint8 month;
uint8 day;
uint8 hour;
uint8 minute;
uint8 second;
uint8 weekday;
}
| struct _DateTime {
uint16 year;
uint8 month;
uint8 day;
uint8 hour;
uint8 minute;
uint8 second;
uint8 weekday;
}
| 7,932 |
8 | // Distribute USDC to the holding address of each NFT collection Address of the ERC721 contract amount Amount of USDC to distribute in regular terms Only callable by the ADMIN role / | function distribute(address collection, uint256 amount) external onlyRole(DISTRIBUTOR) {
// Get the supply of NFTs
uint256 supply = IERC721(collection).totalSupply();
require(supply > 0, "No nfts in this collection");
uint256 vigorish = amount * (vig / 10000);
uint256 amtInfo = amount - vigorish;
// Cal... | function distribute(address collection, uint256 amount) external onlyRole(DISTRIBUTOR) {
// Get the supply of NFTs
uint256 supply = IERC721(collection).totalSupply();
require(supply > 0, "No nfts in this collection");
uint256 vigorish = amount * (vig / 10000);
uint256 amtInfo = amount - vigorish;
// Cal... | 30,407 |
8 | // Gives permission to `to` to transfer `tokenId` token to another account.The approval is cleared when the token is transferred. Only a single account can be approved at a time, so approving the zero address clears previous approvals. Requirements: - The caller must own the token or be an approved operator.- `tokenId`... | function approve(address to, uint256 tokenId) external;
| function approve(address to, uint256 tokenId) external;
| 322 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.