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 |
|---|---|---|---|---|
4 | // Total allocation points. Must be the sum of all allocation points (i.e. multipliers) in all ethPools. | uint256 public ethTotalAllocPoint;
| uint256 public ethTotalAllocPoint;
| 21,090 |
770 | // Sets the status of claim using claim id. claimId claim id. stat status to be set. / | function setClaimStatus(uint claimId, uint stat) external onlyInternal {
_setClaimStatus(claimId, stat);
}
| function setClaimStatus(uint claimId, uint stat) external onlyInternal {
_setClaimStatus(claimId, stat);
}
| 2,196 |
22 | // \ Implementation of ShroomTopia's ERC20 SPOR Token | import {ISPORToken} from "../../Shared/interfaces/ISPORToken.sol";
contract SPORTokenMatic is Context, ISPORToken, Initializable {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
address private childManage... | import {ISPORToken} from "../../Shared/interfaces/ISPORToken.sol";
contract SPORTokenMatic is Context, ISPORToken, Initializable {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
address private childManage... | 30,584 |
6 | // Human readable name of this Governor. | string private constant GOVERNOR_NAME = "PoolTogether Governor Bravo";
| string private constant GOVERNOR_NAME = "PoolTogether Governor Bravo";
| 29,987 |
16 | // Emits details of a stream which has been deleted | event StreamDeleted(address _worker, address _token);
| event StreamDeleted(address _worker, address _token);
| 1,982 |
4,376 | // 2190 | entry "graphetically" : ENG_ADVERB
| entry "graphetically" : ENG_ADVERB
| 23,026 |
79 | // create a memory copy of array | IOption [] memory options = _options;
| IOption [] memory options = _options;
| 41,786 |
277 | // we start at 1 to save some gas | uint256 increment = 1;
| uint256 increment = 1;
| 51,948 |
18 | // Timestamp of last LP fee update. | uint32 lastLpFeeUpdate;
| uint32 lastLpFeeUpdate;
| 33,415 |
49 | // Function to claim tokens from the tax accumulated pot. Can be only called by an authorised contracts./ | function claimBlubTax(address user, uint256 amount) public onlyAuthorised nonReentrant {
require(activeTaxCollectedAmount >= amount, "Insufficiend tax balance");
activeTaxCollectedAmount -= amount;
depositedAmount[user] += amount;
taxesDistributed += amount;
emit ClaimTax(
_m... | function claimBlubTax(address user, uint256 amount) public onlyAuthorised nonReentrant {
require(activeTaxCollectedAmount >= amount, "Insufficiend tax balance");
activeTaxCollectedAmount -= amount;
depositedAmount[user] += amount;
taxesDistributed += amount;
emit ClaimTax(
_m... | 17,078 |
9 | // get the latest completed round where the answer was updated [deprecated]. Use latestRoundData instead. This does not error if noanswer has been reached, it will simply return 0. Either wait to point toan already answered Aggregator or use the recommended latestRoundDatainstead which includes better verification info... | function latestRound()
external
view
virtual
override
returns (uint256)
| function latestRound()
external
view
virtual
override
returns (uint256)
| 18,445 |
488 | // The initial WPC index for a market | uint224 public constant wpcInitialIndex = 1e36;
bool public enableWpcClaim;
bool public enableDistributeMintWpc;
bool public enableDistributeRedeemWpc;
bool public enableDistributeBorrowWpc;
bool public enableDistributeRepayBorrowWpc;
bool public enableDistributeSeizeWpc;
bool public en... | uint224 public constant wpcInitialIndex = 1e36;
bool public enableWpcClaim;
bool public enableDistributeMintWpc;
bool public enableDistributeRedeemWpc;
bool public enableDistributeBorrowWpc;
bool public enableDistributeRepayBorrowWpc;
bool public enableDistributeSeizeWpc;
bool public en... | 26,091 |
164 | // Private function to remove a token from this extension's token tracking data structures.This has O(1) time complexity, but alters the order of the _allTokens array. tokenId uint256 ID of the token to be removed from the tokens list / | function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[t... | function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[t... | 21,753 |
0 | // /Interface for the NFT Royalty Standard/ | interface IERC2981 is IERC165 {
/// ERC165 bytes to add to interface array - set in parent contract
/// implementing this standard
///
/// bytes4(keccak256("royaltyInfo(uint256,uint256)")) == 0x2a55205a
/// bytes4 private constant _INTERFACE_ID_ERC2981 = 0x2a55205a;
/// _registerInterface(_INTER... | interface IERC2981 is IERC165 {
/// ERC165 bytes to add to interface array - set in parent contract
/// implementing this standard
///
/// bytes4(keccak256("royaltyInfo(uint256,uint256)")) == 0x2a55205a
/// bytes4 private constant _INTERFACE_ID_ERC2981 = 0x2a55205a;
/// _registerInterface(_INTER... | 15,122 |
0 | // RLP encodes a byte string./_in The byte string to encode./ return out_ The RLP encoded string in bytes. | function writeBytes(bytes memory _in) internal pure returns (bytes memory out_) {
if (_in.length == 1 && uint8(_in[0]) < 128) {
out_ = _in;
} else {
out_ = abi.encodePacked(_writeLength(_in.length, 128), _in);
}
}
| function writeBytes(bytes memory _in) internal pure returns (bytes memory out_) {
if (_in.length == 1 && uint8(_in[0]) < 128) {
out_ = _in;
} else {
out_ = abi.encodePacked(_writeLength(_in.length, 128), _in);
}
}
| 27,669 |
216 | // Create SDVD ETH pair | sdvdEthPairAddress = IUniswapV2Factory(uniswapRouter.factory()).createPair(sdvd, weth);
| sdvdEthPairAddress = IUniswapV2Factory(uniswapRouter.factory()).createPair(sdvd, weth);
| 42,607 |
2 | // The comptroller of Compound's CToken / | address public underlyingComptroller;
| address public underlyingComptroller;
| 27,320 |
143 | // Returns True if `self` contains `needle`. self The slice to search. needle The text to search for in `self`.return True if `needle` is found in `self`, false otherwise. / | function contains(slice memory self, slice memory needle)
internal
pure
returns (bool)
| function contains(slice memory self, slice memory needle)
internal
pure
returns (bool)
| 33,193 |
216 | // Calculate erc20 pay amount. | erc20FillAmount = (params.sellAmount == orderInfo.orderAmount) ?
buyOrder.erc20TokenAmount : buyOrder.erc20TokenAmount * params.sellAmount / orderInfo.orderAmount;
if (params.unwrapNativeToken) {
| erc20FillAmount = (params.sellAmount == orderInfo.orderAmount) ?
buyOrder.erc20TokenAmount : buyOrder.erc20TokenAmount * params.sellAmount / orderInfo.orderAmount;
if (params.unwrapNativeToken) {
| 62,339 |
92 | // Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,/ Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, andoptionally initialized with `_data` as explained in {ERC1967Proxy-constructor}. / | constructor(
address _logic,
address admin_,
bytes memory _data
) payable ERC1967Proxy(_logic, _data) {
_changeAdmin(admin_);
}
| constructor(
address _logic,
address admin_,
bytes memory _data
) payable ERC1967Proxy(_logic, _data) {
_changeAdmin(admin_);
}
| 3,910 |
53 | // Settle bet using reveal and blockHash as entropy sources. | settleBetCommon(bet, reveal, blockHash);
| settleBetCommon(bet, reveal, blockHash);
| 16,233 |
98 | // 设置一个团队的根节点 | function set_root(address user,
string memory code)
public
| function set_root(address user,
string memory code)
public
| 16,379 |
71 | // assert(b > 0);Solidity automatically throws when dividing by 0 | uint256 c = a / b;
| uint256 c = a / b;
| 11,954 |
12 | // Allocate rewards from previous week multipliers | while(_currentWeek != _previousHarvestWeek){
uint256 _previousHarvestBlock = ships[id].harvestBlock;
uint256 _nextWeekBlock = getWeekBlockStart(_previousHarvestBlock.add(1));
uint256 _owedPreviousBlocks = _nextWeekBlock.sub(_previousHarvestBlock);
_metalCollected... | while(_currentWeek != _previousHarvestWeek){
uint256 _previousHarvestBlock = ships[id].harvestBlock;
uint256 _nextWeekBlock = getWeekBlockStart(_previousHarvestBlock.add(1));
uint256 _owedPreviousBlocks = _nextWeekBlock.sub(_previousHarvestBlock);
_metalCollected... | 8,459 |
2 | // Emitted when an old system account is removed./oldSystemAccount old system account's address removed. | event SystemAccountRemoved(address oldSystemAccount);
| event SystemAccountRemoved(address oldSystemAccount);
| 47,018 |
66 | // after a {IERC721-safeTransferFrom}. This function MUST return the function selector,otherwise the caller will revert the transaction. The selector to bereturned can be obtained as `this.onERC721Received.selector`. Thisfunction MAY throw to revert and reject the transfer.Note: the ERC721 contract address is always th... | function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data)
public returns (bytes4);
| function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data)
public returns (bytes4);
| 10,627 |
46 | // Исключить адрес из whitelist | function removeFromWhitelist(address _beneficiary) public backEnd {
whitelist[_beneficiary] = false;
}
| function removeFromWhitelist(address _beneficiary) public backEnd {
whitelist[_beneficiary] = false;
}
| 16,985 |
142 | // Sender borrows assets from the protocol to their own address borrowAmount The amount of the underlying asset to borrowreturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) / | function borrow(uint256 borrowAmount) external returns (uint256);
| function borrow(uint256 borrowAmount) external returns (uint256);
| 20,786 |
122 | // put payoff = max(K - S, 0) | payoff = payoff.add(longSupplies[i].mul(strikePrice.sub(expiryPrice)));
| payoff = payoff.add(longSupplies[i].mul(strikePrice.sub(expiryPrice)));
| 37,100 |
4 | // A function which turns a variable name for a storage address into a storage/ pointer for its container./name the variable name/ return data the storage pointer | function addressPtr(string memory name)
internal
pure
returns (Address storage data)
| function addressPtr(string memory name)
internal
pure
returns (Address storage data)
| 48,422 |
78 | // Len bits being decoded | uint256 code = 0;
| uint256 code = 0;
| 79,761 |
215 | // Add onto end | layer.layerItems[layer.layerItemSize] = item;
| layer.layerItems[layer.layerItemSize] = item;
| 29,427 |
83 | // If send failed, revert advertiserPendingWithdrawals[msg.sender] = 0so that player can try to withdraw again later / | advertiserPendingWithdrawals[msg.sender] = withdrawAmount;
| advertiserPendingWithdrawals[msg.sender] = withdrawAmount;
| 22,448 |
98 | // Holders fee | fees[2] = tAmount * _taxHolderFee / 100; // t
fees[3] = fees[2] * rate; // r
| fees[2] = tAmount * _taxHolderFee / 100; // t
fees[3] = fees[2] * rate; // r
| 35,878 |
30 | // A hash of hashes of pending DeFi interactions, the notes of which are expected to be added in the 'next' rollup | bytes32 public override(IRollupProcessor) prevDefiInteractionsHash;
| bytes32 public override(IRollupProcessor) prevDefiInteractionsHash;
| 14,615 |
26 | // Emitted when the allowance of a `spender` for an `owner` is set bya call to {approve}. `value` is the new allowance. / | event Approval(address indexed owner, address indexed spender, uint256 value);
| event Approval(address indexed owner, address indexed spender, uint256 value);
| 21,238 |
19 | // ------------Frax Balance------------ Frax sums | uint256 frax_in_contract = FRAX.balanceOf(address(this));
uint256 frax_total = frax_withdrawable.add(frax_in_contract);
| uint256 frax_in_contract = FRAX.balanceOf(address(this));
uint256 frax_total = frax_withdrawable.add(frax_in_contract);
| 30,071 |
200 | // And then subtract the amount already collected | amount = amount.sub(collected[msg.sender]);
require(amount > 0); // Notify the user that there are no tokens to exchange
totalCollected = totalCollected.add(amount);
collected[msg.sender] = collected[msg.sender].add(amount);
assert(snt.transfer(msg.sender, amount));
... | amount = amount.sub(collected[msg.sender]);
require(amount > 0); // Notify the user that there are no tokens to exchange
totalCollected = totalCollected.add(amount);
collected[msg.sender] = collected[msg.sender].add(amount);
assert(snt.transfer(msg.sender, amount));
... | 38,179 |
16 | // Mapping of registered contract IDs. | mapping(uint256 => bool) registeredAssetType; // NOLINT: uninitialized-state.
| mapping(uint256 => bool) registeredAssetType; // NOLINT: uninitialized-state.
| 42,087 |
21 | // if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) throw; |
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
|
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
| 5,347 |
2 | // accesible only by owner / | function decide(string document, bytes32 decision) {
if(msg.sender == owner) {
var hash = calculateHash(document);
visaForms[hash] = decision;
}
}
| function decide(string document, bytes32 decision) {
if(msg.sender == owner) {
var hash = calculateHash(document);
visaForms[hash] = decision;
}
}
| 22,027 |
27 | // Remove liquidity tokens from the liquidity pool and lock these tokens for `unstakeLockupPeriod` duration | function _removeLiquidityAndLock(
address user,
uint256 poolTokensToConsume,
uint256 unstakeLockupPeriod
| function _removeLiquidityAndLock(
address user,
uint256 poolTokensToConsume,
uint256 unstakeLockupPeriod
| 69,329 |
362 | // Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin rolebearer except when using {AccessControl-_setupRole}. / | event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
| event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
| 1,192 |
42 | // View returning all byte-encoded sell ordersreturn encoded bytes representing all orders ordered by (user, index) / | function getEncodedOrders() public view returns (bytes memory elements) {
if (allUsers.size > 0) {
address user = allUsers.first();
bool stop = false;
while (!stop) {
elements = elements.concat(getEncodedUserOrders(user));
if (user == allUs... | function getEncodedOrders() public view returns (bytes memory elements) {
if (allUsers.size > 0) {
address user = allUsers.first();
bool stop = false;
while (!stop) {
elements = elements.concat(getEncodedUserOrders(user));
if (user == allUs... | 19,783 |
223 | // Destroys `tokenId`.The approval is cleared when the token is burned. Requirements: - `tokenId` must exist. | * Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
unchecked {
_balance... | * Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
unchecked {
_balance... | 62,975 |
5 | // Verify the remote OpenST contract against the committed stateroot with the state trie Merkle proof. / | require(
MerklePatriciaProof.verify(
hashedAccount,
_encodedPath,
_rlpParentNodes,
_stateRoot
| require(
MerklePatriciaProof.verify(
hashedAccount,
_encodedPath,
_rlpParentNodes,
_stateRoot
| 35,478 |
2 | // ========== LIBRARIES ========== // ========== CONSTANTS ========== / This is the same unit as used inside `SignedSafeDecimalMath`. | int private constant _UNIT = int(10**uint(18));
| int private constant _UNIT = int(10**uint(18));
| 50,660 |
60 | // The address of the reward token for the Strategy. / | function rewardTokenAddress() external pure returns (address);
| function rewardTokenAddress() external pure returns (address);
| 25,431 |
103 | // Deposit staked tokens and collect reward tokens (if any) _amount: amount to withdraw (in rewardToken) / | function deposit(uint256 _amount) external nonReentrant {
UserInfo storage user = userInfo[msg.sender];
if (pancakeProfile != address(0)) {
// Checks whether the user has an active profile
require(
(!pancakeProfileIsRequested && pancakeProfileThresholdPoints ... | function deposit(uint256 _amount) external nonReentrant {
UserInfo storage user = userInfo[msg.sender];
if (pancakeProfile != address(0)) {
// Checks whether the user has an active profile
require(
(!pancakeProfileIsRequested && pancakeProfileThresholdPoints ... | 28,232 |
26 | // Cancel an operation. Requirements: - the caller must have the 'proposer' role. / | function cancel(bytes32 id) public virtual onlyRole(PROPOSER_ROLE) {
require(isOperationPending(id), "TimelockController: operation cannot be cancelled");
delete _timestamps[id];
emit Cancelled(id);
}
| function cancel(bytes32 id) public virtual onlyRole(PROPOSER_ROLE) {
require(isOperationPending(id), "TimelockController: operation cannot be cancelled");
delete _timestamps[id];
emit Cancelled(id);
}
| 3,428 |
1 | // Perform custom transfer logic via delegate call from source contract to a TransferStrategy implementation to Account to transfer rewards reward Address of the reward token amount Amount to transfer to the "to" address parameterreturn Returns true bool if transfer logic succeeds / | function performTransfer(
address to,
address reward,
uint256 amount
) external returns (bool);
| function performTransfer(
address to,
address reward,
uint256 amount
) external returns (bool);
| 20,035 |
29 | // Allows vote ratio to be changed. | uint256 public vRatio = 2;
| uint256 public vRatio = 2;
| 48,903 |
46 | // mint more tokens inside token contract equivalent to _pendingYield | require(yfdao.mintTokens(_pendingYield, msg.sender));
emit YieldCollected(_tokenAddress, _pendingYield);
| require(yfdao.mintTokens(_pendingYield, msg.sender));
emit YieldCollected(_tokenAddress, _pendingYield);
| 19,213 |
11 | // the voter has voted | require(!voters[to].voted, "the peoper has voted.");
| require(!voters[to].voted, "the peoper has voted.");
| 15,751 |
24 | // uint256 _totalPay = _price.mul(_newCount); | return (_account, _salesWalletAddress, _price, x, y);
| return (_account, _salesWalletAddress, _price, x, y);
| 21,997 |
0 | // Types / |
struct AnyswapData {
address token;
address router;
uint256 amount;
address recipient;
uint256 toChainId;
}
|
struct AnyswapData {
address token;
address router;
uint256 amount;
address recipient;
uint256 toChainId;
}
| 14,941 |
107 | // Transfer current Minter's ETH balance to new Minter | _newMinter.depositETH.value(address(this).balance)();
| _newMinter.depositETH.value(address(this).balance)();
| 40,282 |
198 | // Static ibBTC price from core | function _setPricePerShare() internal {
pricePerShare = core.pricePerShare();
}
| function _setPricePerShare() internal {
pricePerShare = core.pricePerShare();
}
| 2,763 |
17 | // Official record of token balances for each account / | mapping(address => uint256) internal accountTokens;
| mapping(address => uint256) internal accountTokens;
| 16,094 |
77 | // If the handover does not exist, or has expired. | if gt(timestamp(), sload(handoverSlot)) {
mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`.
revert(0x1c, 0x04)
}
| if gt(timestamp(), sload(handoverSlot)) {
mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`.
revert(0x1c, 0x04)
}
| 20,901 |
2 | // calcInGivenOut aI = tokenAmountIn bO = tokenBalanceOut // bO\(wO / wI)\bI = tokenBalanceInbI|| ------------| ^- 1| aO = tokenAmountOutaI =\\ ( bO - aO ) / /wI = tokenWeightIn --------------------------------------------wO = tokenWeightOut( 1 - sF )sF = swapFee/ | ) internal pure returns (uint256 tokenAmountIn) {
uint256 weightRatio = bdiv(tokenWeightOut, tokenWeightIn);
uint256 diff = bsub(tokenBalanceOut, tokenAmountOut);
uint256 y = bdiv(tokenBalanceOut, diff);
uint256 foo = bpow(y, weightRatio);
foo = bsub(foo, BONE);
tokenAmountIn = bsub(BONE, swap... | ) internal pure returns (uint256 tokenAmountIn) {
uint256 weightRatio = bdiv(tokenWeightOut, tokenWeightIn);
uint256 diff = bsub(tokenBalanceOut, tokenAmountOut);
uint256 y = bdiv(tokenBalanceOut, diff);
uint256 foo = bpow(y, weightRatio);
foo = bsub(foo, BONE);
tokenAmountIn = bsub(BONE, swap... | 15,679 |
66 | // not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). Emits a {BeaconUpgraded} event. / | function _upgradeBeaconToAndCall(
address newBeacon,
bytes memory data,
bool forceCall
) internal {
_setBeacon(newBeacon);
emit BeaconUpgraded(newBeacon);
if (data.length > 0 || forceCall) {
_functionDelegateCall(IBeacon(newBeacon).implementation(), da... | function _upgradeBeaconToAndCall(
address newBeacon,
bytes memory data,
bool forceCall
) internal {
_setBeacon(newBeacon);
emit BeaconUpgraded(newBeacon);
if (data.length > 0 || forceCall) {
_functionDelegateCall(IBeacon(newBeacon).implementation(), da... | 1,705 |
99 | // Get the necessary properties for the latest funding cycle. | JBFundingCycle memory _fundingCycle = _getStructFor(_projectId, configuration);
| JBFundingCycle memory _fundingCycle = _getStructFor(_projectId, configuration);
| 12,389 |
19 | // allows for partial unbonding | mapping(address => mapping(address => uint)) public partialUnbonding;
| mapping(address => mapping(address => uint)) public partialUnbonding;
| 10,986 |
51 | // Player has won a two T symbol prize! | profit = SafeMath.div(SafeMath.mul(spin.tokenValue, 232),100);
category = 14;
emit TwoTSymbols(target, spin.blockn);
| profit = SafeMath.div(SafeMath.mul(spin.tokenValue, 232),100);
category = 14;
emit TwoTSymbols(target, spin.blockn);
| 1,796 |
80 | // transfer tokens to wallet address | require(
IERC20(lockedToken[_id].tokenAddress).transfer(msg.sender, lockedToken[_id].tokenAmount),
"CoincheckerLock: Unable to transfer the tokens"
);
emit Withdrawal(_id, msg.sender, lockedToken[_id].tokenAmount);
| require(
IERC20(lockedToken[_id].tokenAddress).transfer(msg.sender, lockedToken[_id].tokenAmount),
"CoincheckerLock: Unable to transfer the tokens"
);
emit Withdrawal(_id, msg.sender, lockedToken[_id].tokenAmount);
| 28,862 |
10 | // Verify owner of seed & ensure royalty ownership | ensureEulerBeatsSeedOwner(seed, _owner);
| ensureEulerBeatsSeedOwner(seed, _owner);
| 49,360 |
24 | // See {IKIP17Metadata-symbol}. / | function symbol() public view returns (string memory) {
return _symbol;
}
| function symbol() public view returns (string memory) {
return _symbol;
}
| 23,417 |
6 | // CORE FUNCTIONS//send 1000 Token with a minimum time lock of 1 hour/ return bool on success | function drip1Token()
external
faucetOn
returns (bool success)
| function drip1Token()
external
faucetOn
returns (bool success)
| 20,951 |
12 | // External function to change token price. This function can be called by only owner. _newPrice New price / | function changeTokenPrice(uint256 _newPrice) external onlyOwner {
tokenPrice = _newPrice;
emit TokenPriceChanged(_newPrice);
}
| function changeTokenPrice(uint256 _newPrice) external onlyOwner {
tokenPrice = _newPrice;
emit TokenPriceChanged(_newPrice);
}
| 18,663 |
25 | // |/ Verifies if a transfer signature is valid based on data and update nonce _fromSource address _toTarget address _idID of the token type _amountTransfered amount _dataEncodes a meta transfer indicator, signature, gas payment receipt and extra transfer data_data should be encoded as (bytes4 METATRANSFER_FLAG, (bytes... | function _validateTransferSignature(
address _from,
address _to,
uint256 _id,
uint256 _amount,
bytes memory _data)
internal returns (bytes memory signedData)
| function _validateTransferSignature(
address _from,
address _to,
uint256 _id,
uint256 _amount,
bytes memory _data)
internal returns (bytes memory signedData)
| 36,022 |
156 | // State variables (can only be constants in a library) | bool public constant DEFAULT_CAN_PAUSE_SWAPPING = false;
bool public constant DEFAULT_CAN_CHANGE_SWAP_FEE = true;
bool public constant DEFAULT_CAN_CHANGE_WEIGHTS = true;
bool public constant DEFAULT_CAN_ADD_REMOVE_TOKENS = false;
bool public constant DEFAULT_CAN_WHITELIST_LPS = false;
bool publi... | bool public constant DEFAULT_CAN_PAUSE_SWAPPING = false;
bool public constant DEFAULT_CAN_CHANGE_SWAP_FEE = true;
bool public constant DEFAULT_CAN_CHANGE_WEIGHTS = true;
bool public constant DEFAULT_CAN_ADD_REMOVE_TOKENS = false;
bool public constant DEFAULT_CAN_WHITELIST_LPS = false;
bool publi... | 23,335 |
373 | // a = SPu(SPc - SPl) | uint a = FullMath.mulDiv(sqrtPriceU96, sqrtPriceX96 - sqrtPriceL96, FixedPoint64.Q64);
| uint a = FullMath.mulDiv(sqrtPriceU96, sqrtPriceX96 - sqrtPriceL96, FixedPoint64.Q64);
| 35,514 |
159 | // Returns an address of the sender on the other side for the currently processed message. Can be used by executors for getting other side caller address. return address of the sender on the other side./ | function messageSender() external view returns (address sender) {
assembly {
// Even though this is not the same as addressStorage[keccak256(abi.encodePacked("messageSender"))],
// since solidity mapping introduces another level of addressing, such slot change is safe
// ... | function messageSender() external view returns (address sender) {
assembly {
// Even though this is not the same as addressStorage[keccak256(abi.encodePacked("messageSender"))],
// since solidity mapping introduces another level of addressing, such slot change is safe
// ... | 50,228 |
91 | // index is +1 to avoid Solidity's zero default mapping value | ownedTokenIndexes[_tokenId] = ownedTokens[_to].length;
| ownedTokenIndexes[_tokenId] = ownedTokens[_to].length;
| 49,321 |
89 | // Returns the EIP-2612 domains separator. | function DOMAIN_SEPARATOR() public view virtual returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
result := mload(0x40) // Grab the free memory pointer.
}
// We simply calculate it on-the-fly to allow for cases where the `name` may change.
... | function DOMAIN_SEPARATOR() public view virtual returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
result := mload(0x40) // Grab the free memory pointer.
}
// We simply calculate it on-the-fly to allow for cases where the `name` may change.
... | 35,258 |
121 | // This works if `wantBase < 1027` which we should expect to be very the case for the strategies we are launching at the moment | uint256 normalizationFactor = 10**27 / wantBase;
ComputeProfitability.SCalculateBorrow memory parameters;
{
(
uint256 availableLiquidity,
uint256 totalStableDebt,
uint256 totalVariableDebt,
,
| uint256 normalizationFactor = 10**27 / wantBase;
ComputeProfitability.SCalculateBorrow memory parameters;
{
(
uint256 availableLiquidity,
uint256 totalStableDebt,
uint256 totalVariableDebt,
,
| 674 |
4 | // Execute any action on behalf of strategy./Regular call is executed. If any of extcall fails, transaction should revert./destinations addresses to call/calldatas calldatas to execute | function multicall(
address[] calldata destinations,
bytes[] calldata calldatas
) external;
| function multicall(
address[] calldata destinations,
bytes[] calldata calldatas
) external;
| 23,098 |
20 | // Contructor that authorizes the msg.sender. / | function Authorizable() public {
authorizers.length = 2;
authorizers[1] = msg.sender;
authorizerIndex[msg.sender] = 1;
}
| function Authorizable() public {
authorizers.length = 2;
authorizers[1] = msg.sender;
authorizerIndex[msg.sender] = 1;
}
| 41,757 |
366 | // The GOLN TOKEN! | GoldNugget public goldnugget;
| GoldNugget public goldnugget;
| 37,077 |
14 | // --- Variables --- Starting reward for the fee receiver/keeper | uint256 public baseUpdateCallerReward; // [wad]
| uint256 public baseUpdateCallerReward; // [wad]
| 86,339 |
3 | // Describe event of the "rollback transaction" and write info to the logfrom Address from which we rollback tokensto Tokens ownertokens Quantity of the tokens that will be rollbackedcheckpointId Checkpoint identifieroriginalTxHash Hash of the original transaction which maked a tokens transfer/ | event RollbackTransaction(
address from,
address to,
uint tokens,
uint checkpointId,
string originalTxHash
);
| event RollbackTransaction(
address from,
address to,
uint tokens,
uint checkpointId,
string originalTxHash
);
| 36,654 |
213 | // OwnableModule Common functionality for multi-token extension non-upgradeable module. / | contract OwnableModule {
address public owner;
/**
* @dev Initializes this contract.
* @param _owner address of the owner that is allowed to perform additional actions on the particular module.
*/
constructor(address _owner) {
owner = _owner;
}
/**
* @dev Throws if send... | contract OwnableModule {
address public owner;
/**
* @dev Initializes this contract.
* @param _owner address of the owner that is allowed to perform additional actions on the particular module.
*/
constructor(address _owner) {
owner = _owner;
}
/**
* @dev Throws if send... | 8,966 |
220 | // Adapted from https:github.com/trusttoken/smart-contracts/blob/master/contracts/truefi/TrueFarm.sol | contract Farm is IFarm {
using SafeMath for uint256;
uint256 constant PRECISION = 1e30;
string public name;
IERC20 public override stakingToken;
IERC20 public override rewardToken;
IFarmDistributor public farmDistributor;
// track stakes
uint256 public override totalStaked;
mapping... | contract Farm is IFarm {
using SafeMath for uint256;
uint256 constant PRECISION = 1e30;
string public name;
IERC20 public override stakingToken;
IERC20 public override rewardToken;
IFarmDistributor public farmDistributor;
// track stakes
uint256 public override totalStaked;
mapping... | 13,243 |
8 | // Reward Matrix Parameters | uint256 K = 25; //Editable by Owner
| uint256 K = 25; //Editable by Owner
| 29,324 |
690 | // Emitted when a cash balance changes | event CashBalanceChange(address indexed account, uint16 indexed currencyId, int256 netCashChange);
| event CashBalanceChange(address indexed account, uint16 indexed currencyId, int256 netCashChange);
| 11,090 |
81 | // ERC1155TradableERC1155Tradable - ERC1155 contract that whitelists an operator address, has create and mint functionality, and supports useful standards from OpenZeppelin, / | abstract contract ERC1155Tradable is ERC1155, ERC1155Burnable, Ownable, MinterRole, WhitelistAdminRole {
using Strings for string;
using SafeMath for uint256;
string private _uri2;
// address proxyRegistryAddress;
uint256 private _currentTokenID = 0;
mapping(uint256 => address) public creators;
mapping(uint... | abstract contract ERC1155Tradable is ERC1155, ERC1155Burnable, Ownable, MinterRole, WhitelistAdminRole {
using Strings for string;
using SafeMath for uint256;
string private _uri2;
// address proxyRegistryAddress;
uint256 private _currentTokenID = 0;
mapping(uint256 => address) public creators;
mapping(uint... | 16,205 |
84 | // Destroys the msg.sender's key and sends a refund based on the amount of time remaining. / | function cancelAndRefund() external;
| function cancelAndRefund() external;
| 40,560 |
39 | // ZiberToken contract - standard ERC20 token with Short Hand Attack and approve() race condition mitigation./<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="197d7c6f596a74786b6d7a76776d6b787a6d7c7874377a7674">[email&160;protected]</a> | contract ZiberToken is SafeMath, ERC20, Ownable {
string public name = "Ziber Token";
string public symbol = "ZBR";
uint public decimals = 8;
uint public constant FROZEN_TOKENS = 10000000;
uint public constant FREEZE_PERIOD = 1 years;
uint public crowdSaleOverTimestamp;
/// contract that is allowed to create ne... | contract ZiberToken is SafeMath, ERC20, Ownable {
string public name = "Ziber Token";
string public symbol = "ZBR";
uint public decimals = 8;
uint public constant FROZEN_TOKENS = 10000000;
uint public constant FREEZE_PERIOD = 1 years;
uint public crowdSaleOverTimestamp;
/// contract that is allowed to create ne... | 5,859 |
0 | // member indexing note: case (members[someAddress]) of 0 -> not a member of this org n -> member of this org, and memberKeys[n-1] == someAddress | address[] memberKeys;
mapping(address => uint) members;
bytes32[] serviceKeys;
bytes32[] typeRepoKeys;
mapping(bytes32 => ServiceRegistration) servicesById;
mapping(bytes32 => TypeRepositoryRegistration) typeReposById;
uint globalOrgIndex;
| address[] memberKeys;
mapping(address => uint) members;
bytes32[] serviceKeys;
bytes32[] typeRepoKeys;
mapping(bytes32 => ServiceRegistration) servicesById;
mapping(bytes32 => TypeRepositoryRegistration) typeReposById;
uint globalOrgIndex;
| 45,667 |
10 | // Initialized | uint256 statsBitMap = _cache[_cacheIndexer][nftCultTokenId];
return uint64(statsBitMap >> 128) - uint64(statsBitMap >> 192);
| uint256 statsBitMap = _cache[_cacheIndexer][nftCultTokenId];
return uint64(statsBitMap >> 128) - uint64(statsBitMap >> 192);
| 22,300 |
16 | // The callable function that is computed by the SGX node. Tallies votes. / | function countVotes(uint _pollID, uint[] _votes, uint[] _weights) public pure returns (uint, uint, uint) {
require(_votes.length == _weights.length);
uint yeaVotes;
uint nayVotes;
for (uint i = 0; i < _votes.length; i++) {
if (_votes[i] == 0) nayVotes += _weights[i];
else if (_votes[i] == ... | function countVotes(uint _pollID, uint[] _votes, uint[] _weights) public pure returns (uint, uint, uint) {
require(_votes.length == _weights.length);
uint yeaVotes;
uint nayVotes;
for (uint i = 0; i < _votes.length; i++) {
if (_votes[i] == 0) nayVotes += _weights[i];
else if (_votes[i] == ... | 8,409 |
4 | // % of the next sale to award the current owner | Decimal.D256 sellOnShare;
| Decimal.D256 sellOnShare;
| 31,037 |
7 | // he wrote like this, see if any problem happens | Campaign storage item = campaigns[i];
allcampaigns[i] = item;
| Campaign storage item = campaigns[i];
allcampaigns[i] = item;
| 24,655 |
49 | // require : there is silver card with `card_id` | require(card_id < silver_owner_count, "Card ID can not be exceed current card owners amount");
| require(card_id < silver_owner_count, "Card ID can not be exceed current card owners amount");
| 28,134 |
9 | // Generate the complete SVG and its associated data for a honeycomb./honeycombs The DB containing all honeycombs./tokenId The tokenId of the honeycomb to render. | function generateHoneycomb(
IHoneycombs.Honeycombs storage honeycombs,
uint256 tokenId
| function generateHoneycomb(
IHoneycombs.Honeycombs storage honeycombs,
uint256 tokenId
| 3,136 |
59 | // bot, snipe and whale control protections | bool public restrictions = true;
bool public tradesPermit = false;
bool public waxOn = false;
mapping (address => bool) private bots;
mapping(address => uint256) private _lastTrans;
bool public timeRugEnabled = true;
bool private boughtEarly = true;
uint256 private _firstBlock;
uin... | bool public restrictions = true;
bool public tradesPermit = false;
bool public waxOn = false;
mapping (address => bool) private bots;
mapping(address => uint256) private _lastTrans;
bool public timeRugEnabled = true;
bool private boughtEarly = true;
uint256 private _firstBlock;
uin... | 38,158 |
254 | // require(!paused(), "Mint is paused");Already checks in _beforeTokenTransfer | require(totalSupply() + amount <= maxSupply, "Max supply limit exceed");
for (uint256 i; i < amount; i++) {
_safeMint(to);
}
| require(totalSupply() + amount <= maxSupply, "Max supply limit exceed");
for (uint256 i; i < amount; i++) {
_safeMint(to);
}
| 30,728 |
27 | // withdraw funds from pool amount is presented in base asset quantity NOTE: this cannot transfer to arbitrary sender, or funds would be unsafe, only to transferProxy withdraw implementation considerations: - the most important factor is: no external fee if possible; - 2nd most important factor: lowest gas as possible ... | function withdraw(address _beneficiary, uint256 _amount) public override {
// TODO: perform funds reclamation if current amount of baseToken is insufficient
require(msg.sender == address(transferProxy), "transfer proxy only");
uint256 sharesAvailable = shares[_beneficiary];
uint256 ... | function withdraw(address _beneficiary, uint256 _amount) public override {
// TODO: perform funds reclamation if current amount of baseToken is insufficient
require(msg.sender == address(transferProxy), "transfer proxy only");
uint256 sharesAvailable = shares[_beneficiary];
uint256 ... | 39,072 |
25 | // Returns the address of the ACL admin.return The address of the ACL admin / | function getACLAdmin() external view returns (address);
| function getACLAdmin() external view returns (address);
| 21,981 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.