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 |
|---|---|---|---|---|
283 | // Mint / | function mint(uint256 _quantity) external payable {
// Normal requirements
require(!paused, "The contract is paused!");
require(
_quantity > 0,
"Minimum 1 NFT has to be minted per transaction"
);
require(_quantity + balanceOf(msg.sender) <= maxTx, "No ... | function mint(uint256 _quantity) external payable {
// Normal requirements
require(!paused, "The contract is paused!");
require(
_quantity > 0,
"Minimum 1 NFT has to be minted per transaction"
);
require(_quantity + balanceOf(msg.sender) <= maxTx, "No ... | 21,781 |
18 | // Reset Votes | for (uint i = 0; i < participantArray.length; i++) {
forRepurchaseVote[participantArray[i]] = false;
}
| for (uint i = 0; i < participantArray.length; i++) {
forRepurchaseVote[participantArray[i]] = false;
}
| 5,589 |
49 | // to upgrade feeAccount (eg. for fee calculation changes) / | function setFeeAccount(TransferFeeInterface newFeeAccount) external restrict("StabilityBoard") {
feeAccount = newFeeAccount;
emit FeeAccountChanged(newFeeAccount);
}
| function setFeeAccount(TransferFeeInterface newFeeAccount) external restrict("StabilityBoard") {
feeAccount = newFeeAccount;
emit FeeAccountChanged(newFeeAccount);
}
| 32,036 |
13 | // update the total amount raised | amountRaised = amountRaised.add(amount);
| amountRaised = amountRaised.add(amount);
| 33,128 |
488 | // Adds an entry to the underlyingAsset => WHAsset contract. It can be used to set the underlying asset to 0x0 address token Asset address whAsset WHAsset contract for the underlying asset / | function setWHAsset(address token, address whAsset) external onlyOwner {
whAssets[token] = whAsset;
}
| function setWHAsset(address token, address whAsset) external onlyOwner {
whAssets[token] = whAsset;
}
| 38,424 |
26 | // Functions / Using an explicit getter allows for function overloading | function balanceOf(address _addr)
public
view
returns (uint)
| function balanceOf(address _addr)
public
view
returns (uint)
| 53,213 |
199 | // Parses the order, verifies that it is not expired or canceled, and verifies the signature. / | function getOrderAndValidateSignature(
bytes memory data
)
private
view
returns (Order memory)
| function getOrderAndValidateSignature(
bytes memory data
)
private
view
returns (Order memory)
| 10,420 |
211 | // Exits Compound and transfers everything to the vault./ | function withdrawAllToVault() external restricted updateSupplyInTheEnd{
withdrawAll();
IERC20(address(underlying)).safeTransfer(vault, underlying.balanceOf(address(this)));
}
| function withdrawAllToVault() external restricted updateSupplyInTheEnd{
withdrawAll();
IERC20(address(underlying)).safeTransfer(vault, underlying.balanceOf(address(this)));
}
| 53,114 |
114 | // We are exposing these functions to be able to manual swap and send in case the token is highly valued and 5M becomes too much | function manualSwap() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
| function manualSwap() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
| 32,131 |
8 | // withdraws ether in a user balance | function withdraw(uint amount) external returns (uint){
require(amount <= balances[msg.sender], 'insufficient balance');
balances[msg.sender] = balances[msg.sender].sub(amount);
msg.sender.transfer(amount);
emit logWithdraw(msg.sender, amount, balances[msg.sender]);
return ba... | function withdraw(uint amount) external returns (uint){
require(amount <= balances[msg.sender], 'insufficient balance');
balances[msg.sender] = balances[msg.sender].sub(amount);
msg.sender.transfer(amount);
emit logWithdraw(msg.sender, amount, balances[msg.sender]);
return ba... | 26,345 |
2 | // Sets the metaverse administrative consumer, used/ as a consumer when LandWorks NFTs do not have an active rent./_metaverseRegistry The target metaverse registry (token address)/_administrativeConsumer The target administrative consumer | function setAdministrativeConsumerFor(
address _metaverseRegistry,
address _administrativeConsumer
| function setAdministrativeConsumerFor(
address _metaverseRegistry,
address _administrativeConsumer
| 42,759 |
15 | // Get the threshold of an aggregator aggregator addressreturn string Compound Oracle Symbolreturn uint8 Compound Oracle Decimalsreturn uint32 Deviation Threshold Numerator / | function getFeedDetails(address aggregator)
public
view
returns (
string memory,
uint8,
uint32
)
| function getFeedDetails(address aggregator)
public
view
returns (
string memory,
uint8,
uint32
)
| 4,647 |
13 | // Settle the specified orders at a clearing price. Note that it is/ the responsibility of the caller to ensure that all GPv2 invariants are/ upheld for the input settlement, otherwise this call will revert./ Namely:/ - All orders are valid and signed/ - Accounts have sufficient balance and approval./ - Settlement cont... | function settle(
IERC20[] calldata tokens,
uint256[] calldata clearingPrices,
GPv2Trade.Data[] calldata trades,
GPv2Interaction.Data[][3] calldata interactions
| function settle(
IERC20[] calldata tokens,
uint256[] calldata clearingPrices,
GPv2Trade.Data[] calldata trades,
GPv2Interaction.Data[][3] calldata interactions
| 30,054 |
41 | // Setting OP boss | meta.setBossStats(boss, 0xffffffffffff0000);
vm.expectRevert("not won");
meta.getBossDrop(heroId, boss, itm);
| meta.setBossStats(boss, 0xffffffffffff0000);
vm.expectRevert("not won");
meta.getBossDrop(heroId, boss, itm);
| 3,416 |
226 | // SIP-65: Decentralized Circuit Breaker | if (
_suspendIfRateInvalid(sourceCurrencyKey, sourceRate) ||
_suspendIfRateInvalid(destinationCurrencyKey, destinationRate)
) {
return (0, 0, IVirtualPynth(0));
}
| if (
_suspendIfRateInvalid(sourceCurrencyKey, sourceRate) ||
_suspendIfRateInvalid(destinationCurrencyKey, destinationRate)
) {
return (0, 0, IVirtualPynth(0));
}
| 57,520 |
499 | // they no longer want to vote | else if (_new == 0) {
votingTokens -= weight;
reserveTotal -= weight * old;
}
| else if (_new == 0) {
votingTokens -= weight;
reserveTotal -= weight * old;
}
| 10,230 |
185 | // See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan intomultiple smaller scans if the collection is large enough to causean out-of-gas error (10K pfp collections should be fine). / | function tokensOfOwner(address owner) external view returns (uint256[] memory) {
unchecked {
uint256 tokenIdsIdx;
address currOwnershipAddr;
uint256 tokenIdsLength = balanceOf(owner);
uint256[] memory tokenIds = new uint256[](tokenIdsLength);
Token... | function tokensOfOwner(address owner) external view returns (uint256[] memory) {
unchecked {
uint256 tokenIdsIdx;
address currOwnershipAddr;
uint256 tokenIdsLength = balanceOf(owner);
uint256[] memory tokenIds = new uint256[](tokenIdsLength);
Token... | 36,256 |
44 | // Put the last token to the transferred token index and update its index in ownerTokensIndexes. | uint lastTokenId = fromTokens[fromTokens.length - 1];
| uint lastTokenId = fromTokens[fromTokens.length - 1];
| 24,010 |
182 | // Update reward weight of the given pool | function updatePoolWeight(uint256 _pid, address _user) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint newWeight = getWeight(user.nksnLength, user.nkcnLength, user.nkcmLength, user.inviteNumber);
if(newWeight != user.weigh... | function updatePoolWeight(uint256 _pid, address _user) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint newWeight = getWeight(user.nksnLength, user.nkcnLength, user.nkcmLength, user.inviteNumber);
if(newWeight != user.weigh... | 22,614 |
268 | // Mappings for the ticketIsuer data storage | mapping(address => TicketIssuerStruct) public allTicketIssuerStructs;
address[] public ticketIssuerAddresses;
| mapping(address => TicketIssuerStruct) public allTicketIssuerStructs;
address[] public ticketIssuerAddresses;
| 20,801 |
21 | // Checks `role` for `account`. Reverts with a message including the required role. | function _checkRole(bytes32 role, address account) internal view virtual {
PermissionsStorage.Data storage data = PermissionsStorage.permissionsStorage();
if (!data._hasRole[role][account]) {
revert(
string(
abi.encodePacked(
"P... | function _checkRole(bytes32 role, address account) internal view virtual {
PermissionsStorage.Data storage data = PermissionsStorage.permissionsStorage();
if (!data._hasRole[role][account]) {
revert(
string(
abi.encodePacked(
"P... | 4,998 |
116 | // We need to swap the current tokens to ETH and send to the dev wallet | swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHTodev(address(this).balance);
}
| swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHTodev(address(this).balance);
}
| 13,907 |
30 | // Create a new stake tokenAmount If staking in something other than eth, this is the amount of tokens staked, otherwise 0 / | function newStake(uint256 tokenAmount) external payable whenNotPaused {
// Verify that sender is not already a staker
require(!isStaked(msg.sender), "ALREADY_STAKED");
uint256 depositAmount = receiveStakerFunds(tokenAmount);
require(depositAmount >= currentRequiredStake(), "NOT_ENOU... | function newStake(uint256 tokenAmount) external payable whenNotPaused {
// Verify that sender is not already a staker
require(!isStaked(msg.sender), "ALREADY_STAKED");
uint256 depositAmount = receiveStakerFunds(tokenAmount);
require(depositAmount >= currentRequiredStake(), "NOT_ENOU... | 34,116 |
1 | // GSs2 (Appendix) | mapping(address => Organization) public orgs;
| mapping(address => Organization) public orgs;
| 22,244 |
2 | // Add by Joe~bytes32 private coverRole; | string private _coverUri;
bytes32 public constant COVER_ROLE = keccak256("COVER_ROLE");
bool private isCover = true;
bytes32 private coverRole;
constructor(
string memory _name,
string memory _symbol,
address _royaltyRecipient,
uint128 _royaltyBps,
| string private _coverUri;
bytes32 public constant COVER_ROLE = keccak256("COVER_ROLE");
bool private isCover = true;
bytes32 private coverRole;
constructor(
string memory _name,
string memory _symbol,
address _royaltyRecipient,
uint128 _royaltyBps,
| 24,294 |
5 | // List of all addresses which have ever owned a furball. | address[] public accounts;
Community public community;
| address[] public accounts;
Community public community;
| 69,619 |
191 | // withdraw from pool | _withdrawFromLP(unstakedBalance);
| _withdrawFromLP(unstakedBalance);
| 27,391 |
191 | // overridden / | function renounceOwnership() public whenPaused {
_removePauser(owner());
Ownable.renounceOwnership();
}
| function renounceOwnership() public whenPaused {
_removePauser(owner());
Ownable.renounceOwnership();
}
| 56,357 |
113 | // Exchanges wstETH to stETH _wstETHAmount amount of wstETH to uwrap in exchange for stETH Requirements: - `_wstETHAmount` must be non-zero - msg.sender must have at least `_wstETHAmount` wstETH.return Amount of stETH user receives after unwrap / | function unwrap(uint256 _wstETHAmount) external returns (uint256);
| function unwrap(uint256 _wstETHAmount) external returns (uint256);
| 47,733 |
8 | // Thrown whenever the RewardRecipient weights are invalid | error InvalidWeights();
| error InvalidWeights();
| 19,175 |
405 | // all interfaces supported | return true;
| return true;
| 544 |
44 | // Update the admin fee. Admin fee takes portion of the swap fee. newAdminFee new admin fee to be applied on future transactions / | function setAdminFee(uint256 newAdminFee) external onlyOwner {
swapStorage.setAdminFee(newAdminFee);
}
| function setAdminFee(uint256 newAdminFee) external onlyOwner {
swapStorage.setAdminFee(newAdminFee);
}
| 17,462 |
18 | // Compute remainder using the mulmod Yul instruction. | remainder := mulmod(x, y, denominator)
| remainder := mulmod(x, y, denominator)
| 16,768 |
43 | // calculate divident fees, tokens to transfer | uint256 _tokenFee = SafeMath.div(amountOfCollate, dividendFee);
uint256 _taxedTokens = SafeMath.sub(amountOfCollate, _tokenFee);
uint256 _dividends = collateralToToken_(contractAddress, _tokenFee);
| uint256 _tokenFee = SafeMath.div(amountOfCollate, dividendFee);
uint256 _taxedTokens = SafeMath.sub(amountOfCollate, _tokenFee);
uint256 _dividends = collateralToToken_(contractAddress, _tokenFee);
| 11,866 |
1 | // Role identifer for cross-chain minter | bytes32 public constant PREDICATE_ROLE = keccak256("PREDICATE_ROLE");
| bytes32 public constant PREDICATE_ROLE = keccak256("PREDICATE_ROLE");
| 1,920 |
399 | // An event to track tranche creations/trancheAddress the address of the tranche contract/wpAddress the address of the wrapped position/expiration the expiration time of the tranche | event TrancheCreated(
address indexed trancheAddress,
address indexed wpAddress,
uint256 indexed expiration
);
IInterestTokenFactory internal immutable _interestTokenFactory;
address internal _tempWpAddress;
uint256 internal _tempExpiration;
IInterestToken internal _temp... | event TrancheCreated(
address indexed trancheAddress,
address indexed wpAddress,
uint256 indexed expiration
);
IInterestTokenFactory internal immutable _interestTokenFactory;
address internal _tempWpAddress;
uint256 internal _tempExpiration;
IInterestToken internal _temp... | 32,958 |
79 | // Distributes a starterpack to an eligible address. Either a promo pack or a default will be distributed depending on availability/Can only be called by signer, assumes signer has validated an IAP receipt, owner can block calling by pausing./_recipient A payable address that is sent a starterpack after being checked f... | function distributePack(address payable _recipient, address payable _attribution) external reentrancyGuard {
require(!pause, "Paused");
require(msg.sender == signer, "Unauthorized");
require(_recipient != _attribution, "Recipient should be different from Attribution address");
Pack ... | function distributePack(address payable _recipient, address payable _attribution) external reentrancyGuard {
require(!pause, "Paused");
require(msg.sender == signer, "Unauthorized");
require(_recipient != _attribution, "Recipient should be different from Attribution address");
Pack ... | 23,231 |
280 | // Withdraw staking.Releases staking, withdraw rewards, and transfer the staked and withdraw rewards amount to the sender. / | function withdraw(address _property, uint256 _amount) external {
/**
* Validates the sender is staking to the target Property.
*/
require(
hasValue(_property, msg.sender, _amount),
"insufficient tokens staked"
);
/**
* Withdraws the staking reward
*/
RewardPrices memory prices = _withdrawI... | function withdraw(address _property, uint256 _amount) external {
/**
* Validates the sender is staking to the target Property.
*/
require(
hasValue(_property, msg.sender, _amount),
"insufficient tokens staked"
);
/**
* Withdraws the staking reward
*/
RewardPrices memory prices = _withdrawI... | 52,060 |
176 | // SignedSafeMath Signed math operations with safety checks that revert on error. / | library SignedSafeMath {
int256 constant private _INT256_MIN = -2**255;
/**
* @dev Returns the multiplication of two signed integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
... | library SignedSafeMath {
int256 constant private _INT256_MIN = -2**255;
/**
* @dev Returns the multiplication of two signed integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
... | 7,930 |
0 | // ------------------------------------------------------------------ config |
address public owner;
address public tokenAddress;
uint256 public compoundPercentage;
uint256 public compoundPeriod;
uint256 public maxCompoundReturn;
|
address public owner;
address public tokenAddress;
uint256 public compoundPercentage;
uint256 public compoundPeriod;
uint256 public maxCompoundReturn;
| 25,443 |
3 | // Set the if purchase and minting is active | function setActive(bool isActive) external override onlyOwner {
_isActive = isActive;
}
| function setActive(bool isActive) external override onlyOwner {
_isActive = isActive;
}
| 73,485 |
54 | // convert amount to match SIN decimals | value_ = _amount.mul( 10 ** IERC20( SIN ).decimals() ).div( 10 ** IERC20( _token ).decimals() );
| value_ = _amount.mul( 10 ** IERC20( SIN ).decimals() ).div( 10 ** IERC20( _token ).decimals() );
| 49,255 |
7 | // Moves `value` AnyswapV3ERC20 token from caller's account to account (`to`),/ after which a call is executed to an ERC677-compliant contract with the `data` parameter./ A transfer to `address(0)` triggers an ERC-20 withdraw matching the sent AnyswapV3ERC20 token in favor of caller./ Emits {Transfer} event./ Returns b... | function transferAndCall(address to, uint value, bytes calldata data) external returns (bool);
| function transferAndCall(address to, uint value, bytes calldata data) external returns (bool);
| 26,132 |
3 | // Never Mind :P/The Ownable contract has an owner address, and provides basic authorization control functions, this simplifies the implementation of "user permissions"./ | contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
r... | contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
r... | 19,169 |
35 | // A method to distribute rewards to all stakeholders. / | function distributeRewards()
public
onlyOwner
| function distributeRewards()
public
onlyOwner
| 12,422 |
174 | // The `LiquidateLocalVars` struct is used internally in the `liquidateBorrow` function. | struct LiquidateLocalVars {
// we need these addresses in the struct for use with `emitLiquidationEvent` to avoid `CompilerError: Stack too deep, try removing local variables.`
address targetAccount;
address assetBorrow;
address liquidator;
address assetCollateral;
//... | struct LiquidateLocalVars {
// we need these addresses in the struct for use with `emitLiquidationEvent` to avoid `CompilerError: Stack too deep, try removing local variables.`
address targetAccount;
address assetBorrow;
address liquidator;
address assetCollateral;
//... | 20,962 |
18 | // Requests and returns price in ETH for one request. This function could be called as `view` function. Oraclize API for price calculations restricts making this function as view./oracleId address Address of the `oracleId` smart contract/ return fetchPrice uint256 Price of one data request in ETH | function calculateFetchPrice(address oracleId) public returns(uint256 fetchPrice) {
fetchPrice = IOracleId(oracleId).calculateFetchPrice();
}
| function calculateFetchPrice(address oracleId) public returns(uint256 fetchPrice) {
fetchPrice = IOracleId(oracleId).calculateFetchPrice();
}
| 3,484 |
22 | // ======================================AXIA EVENTS========================================= |
event NewEpoch(uint epoch, uint emission, uint nextepoch);
event NewDay(uint epoch, uint day, uint nextday);
event BurnEvent(address indexed pool, address indexed burnaddress, uint amount);
event emissions(address indexed root, address indexed pool, uint value);
event TrigRewardEvent(address indexe... |
event NewEpoch(uint epoch, uint emission, uint nextepoch);
event NewDay(uint epoch, uint day, uint nextday);
event BurnEvent(address indexed pool, address indexed burnaddress, uint amount);
event emissions(address indexed root, address indexed pool, uint value);
event TrigRewardEvent(address indexe... | 3,068 |
125 | // Base fees | function setBaseFeesOnBuy(
uint8 _liquidityFeeOnBuy,
uint8 _devFeeOnBuy,
uint8 _buyBackFeeOnBuy,
uint8 _stakingFeeOnBuy,
uint8 _holdersFeeOnBuy
| function setBaseFeesOnBuy(
uint8 _liquidityFeeOnBuy,
uint8 _devFeeOnBuy,
uint8 _buyBackFeeOnBuy,
uint8 _stakingFeeOnBuy,
uint8 _holdersFeeOnBuy
| 13,447 |
12 | // NOTE: theoretically possible overflow of (_start + 0x10) | function bytesToUInt128(bytes memory _bytes, uint256 _start) internal pure returns (uint128 r) {
uint256 offset = _start + 0x10;
require(_bytes.length >= offset, "W");
assembly {
r := mload(add(_bytes, offset))
}
}
| function bytesToUInt128(bytes memory _bytes, uint256 _start) internal pure returns (uint128 r) {
uint256 offset = _start + 0x10;
require(_bytes.length >= offset, "W");
assembly {
r := mload(add(_bytes, offset))
}
}
| 10,862 |
19 | // Only manager is able to call this function Sets a permission for an address to modify the Vault who The target address permit The permission flag / | function setVaultAccess(address who, bool permit) external onlyManager {
canModifyVault[who] = permit;
}
| function setVaultAccess(address who, bool permit) external onlyManager {
canModifyVault[who] = permit;
}
| 3,294 |
28 | // By default, the owner is also the Responsible for Settlement.The owner can assign other address to be the Responsible for Settlement. rs Ethereum address to be assigned as Responsible for Settlement./ | function setResponsibleForSettlement(address rs) onlyOwner public {
responsibleForSettlement = rs;
}
| function setResponsibleForSettlement(address rs) onlyOwner public {
responsibleForSettlement = rs;
}
| 28,124 |
58 | // Add toClaim to the rewards already claimable | myToken.addReward(ownerOf(ids[0]), toClaim);
| myToken.addReward(ownerOf(ids[0]), toClaim);
| 35,431 |
10 | // post IDs start at 1, just like arrays do :) |
mapping (address => mapping (uint256 => bool)) upvotedPost;
mapping (address => mapping (uint256 => bool)) downvotedPost;
|
mapping (address => mapping (uint256 => bool)) upvotedPost;
mapping (address => mapping (uint256 => bool)) downvotedPost;
| 24,564 |
93 | // do the trade with all `_rewardToken` in this contract | address[] memory _pathUniv2 = new address[](3);
_pathUniv2[0] = _rewardToken;
_pathUniv2[1] = weth;
_pathUniv2[2] = token;
uint256[] memory _amounts = _uniRouter.swapExactTokensForTokens(
_amount,
_minAmount,
_pathUniv2,
address(this),
block.timestam... | address[] memory _pathUniv2 = new address[](3);
_pathUniv2[0] = _rewardToken;
_pathUniv2[1] = weth;
_pathUniv2[2] = token;
uint256[] memory _amounts = _uniRouter.swapExactTokensForTokens(
_amount,
_minAmount,
_pathUniv2,
address(this),
block.timestam... | 33,356 |
3 | // 形体 | BodyView body;
| BodyView body;
| 54,450 |
53 | // Emitted when a position's liquidity is removed/Does not withdraw any fees earned by the liquidity position, which must be withdrawn via collect/owner The owner of the position for which liquidity is removed/tickLower The lower tick of the position/tickUpper The upper tick of the position/amount The amount of liquidi... | event Burn(
address indexed owner,
int24 indexed tickLower,
int24 indexed tickUpper,
uint128 amount,
uint256 amount0,
uint256 amount1
);
| event Burn(
address indexed owner,
int24 indexed tickLower,
int24 indexed tickUpper,
uint128 amount,
uint256 amount0,
uint256 amount1
);
| 20,818 |
405 | // check admin in this function | add(_allocPoint, IERC20(newToken), _withUpdate);
| add(_allocPoint, IERC20(newToken), _withUpdate);
| 11,027 |
3 | // read the Allowed ERC725Y data keys of a `caller` on an ERC725Y `target` contract. target an `IERC725Y` contract where to read the permissions. caller the controller address to read the permissions from.return an abi-encoded array of allowed ERC725 keys that the controller address is allowed to interact with. / | function getAllowedERC725YDataKeysFor(IERC725Y target, address caller)
internal
view
returns (bytes memory)
| function getAllowedERC725YDataKeysFor(IERC725Y target, address caller)
internal
view
returns (bytes memory)
| 16,349 |
9 | // Superfluid host contract address | ISuperfluid public immutable HOST;
| ISuperfluid public immutable HOST;
| 23,847 |
275 | // Get the contract balance of every protocol currently used return tokenAddresses : array with all token addresses used, eg [cTokenAddress, iTokenAddress]return amounts : array with all amounts for each protocol in order,eg [amountCompoundInUnderlying, amountFulcrumInUnderlying] / | function _getCurrentAllocations() internal view
| function _getCurrentAllocations() internal view
| 37,644 |
152 | // transfer LPs to new target if we have any | uint256 poolBal = pool.lpToken.balanceOf(address(this));
if (poolBal > 0) {
pool.lpToken.safeTransfer(address(pool.adapter), poolBal);
pool.adapter.deposit(poolBal);
}
| uint256 poolBal = pool.lpToken.balanceOf(address(this));
if (poolBal > 0) {
pool.lpToken.safeTransfer(address(pool.adapter), poolBal);
pool.adapter.deposit(poolBal);
}
| 30,198 |
2 | // Initializes a buffer with an initial capacity.buf The buffer to initialize.capacity The number of bytes of space to allocate the buffer. return The buffer, for chaining./ | function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {
if (capacity % 32 != 0) {
capacity += 32 - (capacity % 32);
}
// Allocate space for the buffer data
buf.capacity = capacity;
assembly {
let ptr := mload(0x40)
... | function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {
if (capacity % 32 != 0) {
capacity += 32 - (capacity % 32);
}
// Allocate space for the buffer data
buf.capacity = capacity;
assembly {
let ptr := mload(0x40)
... | 2,133 |
59 | // Function to emit fail event to frontend / | function emitError(Error error, FailureInfo failure) private returns(uint) {
address assetBorrow,
uint borrowBalanceBefore,
uint borrowBalanceAccumulated,
uint amountRepaid,
uint borrowBalanceAfter,
address liquidator,
address assetCollateral,
uint c... | function emitError(Error error, FailureInfo failure) private returns(uint) {
address assetBorrow,
uint borrowBalanceBefore,
uint borrowBalanceAccumulated,
uint amountRepaid,
uint borrowBalanceAfter,
address liquidator,
address assetCollateral,
uint c... | 19,270 |
17 | // build element 3 | entry.e3 = bytes32(feePlan[1] << 128)>>(256 - 128);
| entry.e3 = bytes32(feePlan[1] << 128)>>(256 - 128);
| 16,400 |
5 | // Transfer tokens from one address to another./_from address The address which you want to send tokens from./_to address The address which you want to transfer to./_value uint256 the amount of tokens to be transferred. | function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
uint256 _allowance = allowed[_from][msg.sender];
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][ms... | function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
uint256 _allowance = allowed[_from][msg.sender];
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][ms... | 5,886 |
231 | // Returns a list of Positions, through traversing the components. Each component with a non-zero virtual unitis considered a Default Position, and each externalPositionModule will generate a unique position.Virtual units are converted to real units. This function is typically used off-chain for data presentation purpo... | function getPositions() external view returns (ISetToken.Position[] memory) {
ISetToken.Position[] memory positions = new ISetToken.Position[](_getPositionCount());
uint256 positionCount = 0;
for (uint256 i = 0; i < components.length; i++) {
address component = components[i];
... | function getPositions() external view returns (ISetToken.Position[] memory) {
ISetToken.Position[] memory positions = new ISetToken.Position[](_getPositionCount());
uint256 positionCount = 0;
for (uint256 i = 0; i < components.length; i++) {
address component = components[i];
... | 39,218 |
12 | // Emitted when an IArbitrable instance's dispute is ruled by an IArbitratorarbitrator IArbitrator instance ruling the disputedisputeId Identification number of the dispute being ruled by the arbitratorruling Ruling given by the arbitrator/ | event Ruled(IArbitrator indexed arbitrator, uint256 indexed disputeId, uint256 ruling);
| event Ruled(IArbitrator indexed arbitrator, uint256 indexed disputeId, uint256 ruling);
| 7,653 |
37 | // XOR over sx, sy and sd. This is checking whether there are one or three negative signs in the inputs. If yes, the result should be negative. | result = sx ^ sy ^ sd == 0 ? -int256(rAbs) : int256(rAbs);
| result = sx ^ sy ^ sd == 0 ? -int256(rAbs) : int256(rAbs);
| 22,687 |
38 | // Staking interface, as defined by EIP-900. / | contract IStaking {
event Staked(address indexed user, uint256 amount, uint256 total, bytes data);
event Unstaked(address indexed user, uint256 amount, uint256 total, bytes data);
function stake(uint256 amount, bytes calldata data) external;
function stakeFor(address user, uint256 amount, bytes calldat... | contract IStaking {
event Staked(address indexed user, uint256 amount, uint256 total, bytes data);
event Unstaked(address indexed user, uint256 amount, uint256 total, bytes data);
function stake(uint256 amount, bytes calldata data) external;
function stakeFor(address user, uint256 amount, bytes calldat... | 19,076 |
117 | // Fallback function to return money to reward distributer via pool deployer In case of issues or incorrect calls or errors | function refund(uint256 amount, address refundAddress) public onlyOwner {
require(
IERC20(rewardsToken).transfer(refundAddress, amount),
"StakingRewardsFactory::notifyRewardAmount: transfer failed"
);
}
| function refund(uint256 amount, address refundAddress) public onlyOwner {
require(
IERC20(rewardsToken).transfer(refundAddress, amount),
"StakingRewardsFactory::notifyRewardAmount: transfer failed"
);
}
| 42,706 |
269 | // Allocate one word for the length, and `tokenIdsMaxLength` words for the data. `shl(5, x)` is equivalent to `mul(32, x)`. | mstore(0x40, add(tokenIds, shl(5, add(tokenIdsMaxLength, 1))))
| mstore(0x40, add(tokenIds, shl(5, add(tokenIdsMaxLength, 1))))
| 34,711 |
115 | // Only allow unregistered darknodes. | modifier onlyRefunded(address _darknodeID) {
require(isRefunded(_darknodeID), "must be refunded or never registered");
_;
}
| modifier onlyRefunded(address _darknodeID) {
require(isRefunded(_darknodeID), "must be refunded or never registered");
_;
}
| 33,780 |
41 | // Return if no pending rewards | if (pendingRewards == 0) {
| if (pendingRewards == 0) {
| 24,882 |
76 | // Returns the minimum delay for an operation to become valid. This value can be changed by executing an operation that calls `updateDelay`. / | function getMinDelay() public view virtual returns (uint256 duration) {
return _minDelay;
}
| function getMinDelay() public view virtual returns (uint256 duration) {
return _minDelay;
}
| 19,659 |
0 | // Mapping from token ID to name | mapping(uint256 => string) private _tokenName;
| mapping(uint256 => string) private _tokenName;
| 16,771 |
4 | // src/RaceToNumber.sol/ pragma solidity ^0.5.4; //RaceToNumbermust have the password to play. Whoever calls the lucky transaction wins!/ | contract RaceToNumber {
bytes32 public constant passwordHash = 0xe6259607f8876d87cad42be003ee39649999430d825382960e3d25ca692d4fb0;
uint256 public constant callsToWin = 15;
uint256 public callCount;
event Victory(
address winner,
uint payout
);
function callMe(string memory pass... | contract RaceToNumber {
bytes32 public constant passwordHash = 0xe6259607f8876d87cad42be003ee39649999430d825382960e3d25ca692d4fb0;
uint256 public constant callsToWin = 15;
uint256 public callCount;
event Victory(
address winner,
uint payout
);
function callMe(string memory pass... | 29,258 |
23 | // Unanchor an object from the org. | function unanchor(bytes32 id) public ownerOnly {
delete anchors[id];
emit Unanchored(id);
}
| function unanchor(bytes32 id) public ownerOnly {
delete anchors[id];
emit Unanchored(id);
}
| 17,379 |
5 | // Maximum value that can be converted to fixed point. Optimize for deployment. Test maxNewFixed() equals maxInt256() / fixed1()Hardcoded to 24 digits. / | function maxNewFixed() public pure returns(int256) {
return 57896044618658097711785492504343953926634992332820282;
}
| function maxNewFixed() public pure returns(int256) {
return 57896044618658097711785492504343953926634992332820282;
}
| 5,338 |
25 | // This is an alternative to {approve} that can be used as a mitigation forproblems described in {IBEP20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. / | function increaseAllowance(
address spender,
uint256 addedValue
) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
| function increaseAllowance(
address spender,
uint256 addedValue
) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
| 26,633 |
21 | // Precisely divides two ratioed units, by first scaling the left hand operand i.e. How much bAsset is this mAsset worth? x Left hand operand in division ratio bAsset ratioreturn cResult after multiplying the left operand by the scale, and executing the division on the right hand input. / | function divRatioPrecisely(uint256 x, uint256 ratio) internal pure returns (uint256 c) {
// e.g. 1e14 * 1e8 = 1e22
// return 1e22 / 1e12 = 1e10
return (x * RATIO_SCALE) / ratio;
}
| function divRatioPrecisely(uint256 x, uint256 ratio) internal pure returns (uint256 c) {
// e.g. 1e14 * 1e8 = 1e22
// return 1e22 / 1e12 = 1e10
return (x * RATIO_SCALE) / ratio;
}
| 31,867 |
59 | // Split the contract balance into halves | uint256 denominator = (sellTaxes.liquidity + sellTaxes.marketing) * 2;
uint256 tokensToAddLiquidityWith = contractBalance * sellTaxes.liquidity / denominator;
uint256 toSwap = contractBalance - tokensToAddLiquidityWith;
uint256 initialBalance = address(this).balance;... | uint256 denominator = (sellTaxes.liquidity + sellTaxes.marketing) * 2;
uint256 tokensToAddLiquidityWith = contractBalance * sellTaxes.liquidity / denominator;
uint256 toSwap = contractBalance - tokensToAddLiquidityWith;
uint256 initialBalance = address(this).balance;... | 9,247 |
23 | // Make the swap | uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // Accept any amount of ETH; ignore slippage
path,
taxWallet,
block.timestamp
);
| uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // Accept any amount of ETH; ignore slippage
path,
taxWallet,
block.timestamp
);
| 29,475 |
29 | // Burns a specific amount of tokens. _value The amount of token to be burned. / | function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
| function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
| 7,295 |
40 | // UniversalCryptoUnitTokenContract to create the Kimera Token / | contract LavevelToken is CrowdsaleToken {
string public constant name = "Universal Crypto Unit";
string public constant symbol = "UCU";
uint32 public constant decimals = 18;
} | contract LavevelToken is CrowdsaleToken {
string public constant name = "Universal Crypto Unit";
string public constant symbol = "UCU";
uint32 public constant decimals = 18;
} | 26,195 |
181 | // Used to retrieve the document name from index in the smart contract.return string Name of the document name. / | function getDocumentName(uint256 _index) external view returns (string memory) {
require(_index < _docNames.length, "Index out of bounds");
return _docNames[_index];
}
| function getDocumentName(uint256 _index) external view returns (string memory) {
require(_index < _docNames.length, "Index out of bounds");
return _docNames[_index];
}
| 48,150 |
0 | // Set initial token balance of the pool offering flash loans | dvt.transfer(address(flashLoanerPool), TOKENS_IN_LENDER_POOL);
theRewarderPool = new TheRewarderPool(address(dvt));
| dvt.transfer(address(flashLoanerPool), TOKENS_IN_LENDER_POOL);
theRewarderPool = new TheRewarderPool(address(dvt));
| 29,134 |
11 | // ROOM BOOKING/ |
function createReservation(bytes32 companyId, bytes32 roomId, uint16 year, uint8 month, uint8 day, uint8 hour)
|
function createReservation(bytes32 companyId, bytes32 roomId, uint16 year, uint8 month, uint8 day, uint8 hour)
| 48,357 |
54 | // Returns the downcasted int80 from int256, reverting onoverflow (when the input is less than smallest int80 orgreater than largest int80). Counterpart to Solidity's `int80` operator. Requirements: - input must fit into 80 bits _Available since v4.7._ / | function toInt80(int256 value) internal pure returns (int80 downcasted) {
downcasted = int80(value);
require(downcasted == value, "SafeCast: value doesn't fit in 80 bits");
}
| function toInt80(int256 value) internal pure returns (int80 downcasted) {
downcasted = int80(value);
require(downcasted == value, "SafeCast: value doesn't fit in 80 bits");
}
| 30,771 |
75 | // Emitted when a {apy} is changed. / | event APYChanged(uint256 apy);
| event APYChanged(uint256 apy);
| 70,705 |
94 | // Configuration structure of nest ledger contract | struct Config {
// nest reward scale(10000 based). 2000
uint16 nestRewardScale;
// // ntoken reward scale(10000 based). 8000
// uint16 ntokenRewardScale;
}
| struct Config {
// nest reward scale(10000 based). 2000
uint16 nestRewardScale;
// // ntoken reward scale(10000 based). 8000
// uint16 ntokenRewardScale;
}
| 37,240 |
76 | // Gets the receipt for a voter on a given proposalproposalId the id of proposalvoter The address of the voter return The voting receipt/ | function getReceipt(uint proposalId, address voter) external view returns (Receipt memory) {
return proposals[proposalId].receipts[voter];
}
| function getReceipt(uint proposalId, address voter) external view returns (Receipt memory) {
return proposals[proposalId].receipts[voter];
}
| 80,950 |
91 | // Emit event when wrapped tokens get redemmed. | event Unswapped(address indexed from, address indexed to, uint256 fromAmt, uint256 toAmt);
| event Unswapped(address indexed from, address indexed to, uint256 fromAmt, uint256 toAmt);
| 33,498 |
3 | // Token symbol | string private _symbol;
| string private _symbol;
| 3,086 |
20 | // Returns the smaller of the two values. | function min(uint256 a, uint256 b) private pure returns (uint256){
return (a > b) ? b : a;
}
| function min(uint256 a, uint256 b) private pure returns (uint256){
return (a > b) ? b : a;
}
| 10,841 |
11 | // Wrappers over Solidity's arithmetic operations with added overflowchecks.Arithmetic operations in Solidity wrap on overflow. This can easily resultin bugs, because programmers usually assume that an overflow raises anerror, which is the standard behavior in high level programming languages.`SafeMath` restores this i... | library SafeMath {
/**
* @dev 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) {
... | library SafeMath {
/**
* @dev 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) {
... | 12,535 |
11 | // Underlying asset for this CToken / | address public underlying;
| address public underlying;
| 25,644 |
2 | // Public functions //Constructor sets ultimate oracle properties/_forwardedOracle Oracle address/_collateralToken Collateral token address/_spreadMultiplier Defines the spread as a multiple of the money bet on other outcomes/_challengePeriod Time to challenge oracle outcome/_challengeAmount Amount to challenge the out... | function UltimateOracle(
Oracle _forwardedOracle,
Token _collateralToken,
uint8 _spreadMultiplier,
uint _challengePeriod,
uint _challengeAmount,
uint _frontRunnerPeriod
)
public
| function UltimateOracle(
Oracle _forwardedOracle,
Token _collateralToken,
uint8 _spreadMultiplier,
uint _challengePeriod,
uint _challengeAmount,
uint _frontRunnerPeriod
)
public
| 45,575 |
17 | // line 153 of Zora Auction House, createBid() function | (bool success, bytes memory returnData) =
| (bool success, bytes memory returnData) =
| 42,530 |
108 | // admin functions | function setStakedToken(IERC20 _target) public onlyOwner {
require(address(_target) != address(0x0), "Null address not allowed");
stakedToken = _target;
}
| function setStakedToken(IERC20 _target) public onlyOwner {
require(address(_target) != address(0x0), "Null address not allowed");
stakedToken = _target;
}
| 7,498 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.