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 |
|---|---|---|---|---|
114 | // bootloader program contract and the program in the proof. |
require(
cairoAuxInput[getOffsetPageSize(0)] == publicMemoryLength,
"Invalid size for memory page 0.");
require(
cairoAuxInput[getOffsetPageHash(0)] == memoryHash,
|
require(
cairoAuxInput[getOffsetPageSize(0)] == publicMemoryLength,
"Invalid size for memory page 0.");
require(
cairoAuxInput[getOffsetPageHash(0)] == memoryHash,
| 5,861 |
59 | // jhhong/κ³μ (spender)μ μμλ ν΅νλμ ν΅νλ(addedValue)λ₯Ό λνκ°μ μμνλ€./μμλ ν΅νλμ΄ μμ κ²½μ°, ν΅νλ μ¦κ°λ μκΈ° ν¨μλ‘ μνν κ²/spender μμλ°μ κ³μ /addedValue λν΄μ§ ν΅νλ/ return μ μμ²λ¦¬ μ true | function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
uint256 amount = allowance(msg.sender, spender).add(addedValue);
return super.approve(spender, amount);
}
| function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
uint256 amount = allowance(msg.sender, spender).add(addedValue);
return super.approve(spender, amount);
}
| 46,253 |
43 | // this prevents proposer from voting again with his tokens on this submission | adminStruct[msg.sender].voteTracker = params[2];
proposer = msg.sender;
| adminStruct[msg.sender].voteTracker = params[2];
proposer = msg.sender;
| 33,644 |
2 | // Builds a prefixed hash to mimic the behavior of eth_sign/_hash The hash of the message's content without the prefix/ return The hash with the prefix | function prefixed(bytes32 _hash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", _hash));
}
| function prefixed(bytes32 _hash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", _hash));
}
| 40,901 |
219 | // The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encodingthey need in their contracts using a combination of `abi.encode` and `keccak256`. | * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
* scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
* ({_hashTypedDataV4}).
*
* The implementation of the domain separator was designed to be as ef... | * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
* scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
* ({_hashTypedDataV4}).
*
* The implementation of the domain separator was designed to be as ef... | 13,295 |
226 | // Set custom function `_sig` for `_target`_sig Signature of the function to be set_target Address of the target implementation to be registered for the given signature/ | function setCustomFunction(bytes4 _sig, address _target) external onlyModulesGovernor {
customFunctions[_sig] = _target;
emit CustomFunctionSet(_sig, _target);
}
| function setCustomFunction(bytes4 _sig, address _target) external onlyModulesGovernor {
customFunctions[_sig] = _target;
emit CustomFunctionSet(_sig, _target);
}
| 68,998 |
36 | // get sha256 hash of name for content ID | function generateContentID(string _name) public pure returns (bytes32) {
return keccak256(_name);
}
| function generateContentID(string _name) public pure returns (bytes32) {
return keccak256(_name);
}
| 55,106 |
213 | // Helper for calling `BytecodeStorageReader` external library reader method,added for bytecode size reduction purposes. / | function _readFromBytecode(
address _address
| function _readFromBytecode(
address _address
| 33,409 |
50 | // Convert a standard decimal representation to a high precision one. / | function decimalToPreciseDecimal(uint i) internal pure returns (uint) {
return i.mul(UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR);
}
| function decimalToPreciseDecimal(uint i) internal pure returns (uint) {
return i.mul(UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR);
}
| 18,081 |
365 | // res += val(coefficients[134] + coefficients[135]adjustments[12]). | res := addmod(res,
mulmod(val,
add(/*coefficients[134]*/ mload(0x1500),
mulmod(/*coefficients[135]*/ mload(0x1520),
| res := addmod(res,
mulmod(val,
add(/*coefficients[134]*/ mload(0x1500),
mulmod(/*coefficients[135]*/ mload(0x1520),
| 24,790 |
23 | // Signature provided by the trader (EIP-712). | bytes takerSignature;
| bytes takerSignature;
| 10,353 |
97 | // Stake primary tokens | function deposit(uint256 _amount) public nonReentrant {
if(holderUnlockTime[msg.sender] == 0){
holderUnlockTime[msg.sender] = block.timestamp + lockDuration;
}
PoolInfo storage pool = poolInfo[0];
UserInfo storage user = userInfo[msg.sender];
updatePool(0);
... | function deposit(uint256 _amount) public nonReentrant {
if(holderUnlockTime[msg.sender] == 0){
holderUnlockTime[msg.sender] = block.timestamp + lockDuration;
}
PoolInfo storage pool = poolInfo[0];
UserInfo storage user = userInfo[msg.sender];
updatePool(0);
... | 26,119 |
44 | // Transfer ERC721 token. | _performERC721Transfer(
item.token,
item.from,
item.to,
item.identifier
);
| _performERC721Transfer(
item.token,
item.from,
item.to,
item.identifier
);
| 14,320 |
10 | // Get the twap price of a specific path.period The twap time.returnpriceThe twap price.returntimestampThe updated timestamp, is always block.timestamp. / | function priceTWAP(uint32 period) internal view returns (int256 price, uint256 timestamp) {
// input = 1, output = price
uint128 baseAmount = uint128(10**(18 - collateralDecimals + underlyingAssetDecimals));
uint256 length = pools.length;
for (uint256 i = 0; i < length; i++) {
... | function priceTWAP(uint32 period) internal view returns (int256 price, uint256 timestamp) {
// input = 1, output = price
uint128 baseAmount = uint128(10**(18 - collateralDecimals + underlyingAssetDecimals));
uint256 length = pools.length;
for (uint256 i = 0; i < length; i++) {
... | 35,584 |
62 | // Token allocation per mille for reserve/community/founders | uint private constant RESERVE_ALLOCATION_PER_MILLE_RATIO = 200;
uint private constant COMMUNITY_ALLOCATION_PER_MILLE_RATIO = 103;
uint private constant FOUNDERS_ALLOCATION_PER_MILLE_RATIO = 30;
| uint private constant RESERVE_ALLOCATION_PER_MILLE_RATIO = 200;
uint private constant COMMUNITY_ALLOCATION_PER_MILLE_RATIO = 103;
uint private constant FOUNDERS_ALLOCATION_PER_MILLE_RATIO = 30;
| 41,343 |
12 | // Check if the room is really full before shooting people... | require(room.players.length == 6);
uint256 halfFee = SafeMath.div(room.entryPrice, 20);
CTO.transfer(halfFee);
CEO.transfer(halfFee);
room.balance -= halfFee * 2;
uint256 deadSeat = random();
distributeFunds(_roomId, deadSeat);
| require(room.players.length == 6);
uint256 halfFee = SafeMath.div(room.entryPrice, 20);
CTO.transfer(halfFee);
CEO.transfer(halfFee);
room.balance -= halfFee * 2;
uint256 deadSeat = random();
distributeFunds(_roomId, deadSeat);
| 6,335 |
41 | // Use the old answer to calculate cumulative. | uint256 currentCumulative = currentObservation.cumulative + (_answer * timeDelta);
if (currentCumulative > type(uint192).max) revert ERC4626SharePriceOracle__CumulativeTooLarge();
currentObservation.cumulative = uint192(currentCumulative);
currentObservation.timestamp = currentTime;
... | uint256 currentCumulative = currentObservation.cumulative + (_answer * timeDelta);
if (currentCumulative > type(uint192).max) revert ERC4626SharePriceOracle__CumulativeTooLarge();
currentObservation.cumulative = uint192(currentCumulative);
currentObservation.timestamp = currentTime;
... | 6,394 |
132 | // Propose a Security Token Offering Factory for an issuance _securityToken The security token being bid on _factoryAddress The address of the offering factoryreturn bool success / | function proposeOfferingFactory(
address _securityToken,
address _factoryAddress
) public returns (bool success)
| function proposeOfferingFactory(
address _securityToken,
address _factoryAddress
) public returns (bool success)
| 31,712 |
17 | // Add an array of adresses / | function addAddressesToWhitelist(address[] memory addrs) onlyOwner public returns(bool success) {
for(uint i = 0; i < addrs.length; i++) {
addAddressToWhitelist(addrs[i]);
}
}
| function addAddressesToWhitelist(address[] memory addrs) onlyOwner public returns(bool success) {
for(uint i = 0; i < addrs.length; i++) {
addAddressToWhitelist(addrs[i]);
}
}
| 79,487 |
809 | // Oraclize call to close emergency pause. | function closeEmergencyPause(uint) external onlyInternal {
_saveQueryId("EP", 0);
}
| function closeEmergencyPause(uint) external onlyInternal {
_saveQueryId("EP", 0);
}
| 6,128 |
65 | // prelim. parameter checks | require(amount != 0, "Invalid amount");
| require(amount != 0, "Invalid amount");
| 33,741 |
30 | // hash contents of array, without length | let arrayHash :=
keccak256(
| let arrayHash :=
keccak256(
| 17,085 |
133 | // Claim from the distributor, unstake and deposits in 3pool./index - claimer index/account - claimer account/amount - claim amount/merkleProof - merkle proof for the claim/minAmountOut - minimum amount of 3CRV (NOT USDT!)/to - address on behalf of which to stake | function claimFromDistributorAndStakeIn3PoolConvex(
uint256 index,
address account,
uint256 amount,
bytes32[] calldata merkleProof,
uint256 minAmountOut,
address to
| function claimFromDistributorAndStakeIn3PoolConvex(
uint256 index,
address account,
uint256 amount,
bytes32[] calldata merkleProof,
uint256 minAmountOut,
address to
| 33,324 |
248 | // Access Control ListAccess control smart contract provides an API to check if specific operation is permitted globally and/or if particular user has a permission to execute it.It deals with two main entities: features and roles.Features are designed to be used to enable/disable specific functions (public functions) o... | contract AccessControl {
/**
* @notice Access manager is responsible for assigning the roles to users,
* enabling/disabling global features of the smart contract
* @notice Access manager can add, remove and update user roles,
* remove and update global features
*
* @dev Role ROLE_ACCESS_MA... | contract AccessControl {
/**
* @notice Access manager is responsible for assigning the roles to users,
* enabling/disabling global features of the smart contract
* @notice Access manager can add, remove and update user roles,
* remove and update global features
*
* @dev Role ROLE_ACCESS_MA... | 17,892 |
2 | // token->total | mapping (address => uint256) public total;
| mapping (address => uint256) public total;
| 29,631 |
109 | // Primitive | import { ITrader, IOption } from "../../option/interfaces/ITrader.sol";
import { TraderLib, IERC20 } from "../../option/libraries/TraderLib.sol";
import { IWethConnector01, IWETH } from "../WETH/IWethConnector01.sol";
import { WethConnectorLib01 } from "../WETH/WethConnectorLib01.sol";
// Open Zeppelin
import { SafeMat... | import { ITrader, IOption } from "../../option/interfaces/ITrader.sol";
import { TraderLib, IERC20 } from "../../option/libraries/TraderLib.sol";
import { IWethConnector01, IWETH } from "../WETH/IWethConnector01.sol";
import { WethConnectorLib01 } from "../WETH/WethConnectorLib01.sol";
// Open Zeppelin
import { SafeMat... | 4,664 |
17 | // VIEWS//This view returns true if the given ERC20 token contract has been listed valid for deposit/asset_source Contract address for given ERC20 token/ return True if asset is listed | function is_asset_listed(address asset_source) public virtual view returns(bool);
| function is_asset_listed(address asset_source) public virtual view returns(bool);
| 56,977 |
111 | // Create the city | uint cityId = cities.push(City(_landId, msg.sender, 0, 0, false, 0, 0)) - 1;
lands[_landId].landForSale == false;
lands[_landId].landForRent == false;
lands[_landId].cityRentingId = cityId;
lands[_landId].isOccupied = true;
| uint cityId = cities.push(City(_landId, msg.sender, 0, 0, false, 0, 0)) - 1;
lands[_landId].landForSale == false;
lands[_landId].landForRent == false;
lands[_landId].cityRentingId = cityId;
lands[_landId].isOccupied = true;
| 41,397 |
38 | // installation of a lockup for safe,fixing free amount on balance,token installation (run once) | function setContract(Token _token, uint256 _lockup) thirdLevel public returns(bool){
require(_token != address(0x0));
require(!lockupIsSet);
require(!tranche);
token = _token;
freeAmount = getMainBalance();
mainLockup = _lockup;
tranche = true;
lockupI... | function setContract(Token _token, uint256 _lockup) thirdLevel public returns(bool){
require(_token != address(0x0));
require(!lockupIsSet);
require(!tranche);
token = _token;
freeAmount = getMainBalance();
mainLockup = _lockup;
tranche = true;
lockupI... | 33,193 |
70 | // update data for new owner | tokenOwner[_tokenId] = newOwner;
| tokenOwner[_tokenId] = newOwner;
| 64,035 |
81 | // fetch data | address _owner = voucher.ownerOf(id);
uint256[3] memory packedOrdersMemory = _packedOrdersByStrategyId[id];
(Order[2] memory orders, bool ordersInverted) = _unpackOrders(packedOrdersMemory);
| address _owner = voucher.ownerOf(id);
uint256[3] memory packedOrdersMemory = _packedOrdersByStrategyId[id];
(Order[2] memory orders, bool ordersInverted) = _unpackOrders(packedOrdersMemory);
| 13,862 |
39 | // Converts all of caller&39;s dividends to tokens. | function reinvest() onlyStronghands public {
// fetch dividends
uint256 _dividends = myDividends(false); // retrieve ref. bonus later in the code
// pay out the dividends virtually
address _customerAddress = msg.sender;
payoutsTo_[_customerAddress] += (int256) (_dividends *... | function reinvest() onlyStronghands public {
// fetch dividends
uint256 _dividends = myDividends(false); // retrieve ref. bonus later in the code
// pay out the dividends virtually
address _customerAddress = msg.sender;
payoutsTo_[_customerAddress] += (int256) (_dividends *... | 22,961 |
24 | // ESTIMATION FUNCTIONS //returns how much shares ( LP tokens ) send to user/amount1 and amount2 must have the same proportion in relation to reserves/use this formula to calculate _amountToken1 and _amountToken2/ x = totalToken1, y = totalToken2, dx = amount of token 1, dy = amount of token 2/ dx = xdy / y to prioriti... | function estimateShares( uint _amountToken1, uint _amountToken2 ) public view returns ( uint _shares ) {
if( totalSupply() == 0 ) {
require( _amountToken1 == _amountToken2, "Error: Genesis Amounts must be the same" );
_shares = _amountToken1;
} else {
uint sh... | function estimateShares( uint _amountToken1, uint _amountToken2 ) public view returns ( uint _shares ) {
if( totalSupply() == 0 ) {
require( _amountToken1 == _amountToken2, "Error: Genesis Amounts must be the same" );
_shares = _amountToken1;
} else {
uint sh... | 20,667 |
157 | // reset their index | holderTimestamps[msg.sender] = block.timestamp;
sendETH(msg.sender, cut);
checkForTheGamesEnd();
| holderTimestamps[msg.sender] = block.timestamp;
sendETH(msg.sender, cut);
checkForTheGamesEnd();
| 16,877 |
0 | // Price rate caches are used to avoid querying the price rate for a token every time we need to work with it. Data is stored with the following structure: [ expires | duration | price rate value ] [ uint64|uint64|uint128 ] |
bytes32 private _priceRateCache0;
bytes32 private _priceRateCache1;
uint256 private constant _PRICE_RATE_CACHE_VALUE_OFFSET = 0;
uint256 private constant _PRICE_RATE_CACHE_DURATION_OFFSET = 128;
uint256 private constant _PRICE_RATE_CACHE_EXPIRES_OFFSET = 128 + 64;
event OracleEnabledChanged(b... |
bytes32 private _priceRateCache0;
bytes32 private _priceRateCache1;
uint256 private constant _PRICE_RATE_CACHE_VALUE_OFFSET = 0;
uint256 private constant _PRICE_RATE_CACHE_DURATION_OFFSET = 128;
uint256 private constant _PRICE_RATE_CACHE_EXPIRES_OFFSET = 128 + 64;
event OracleEnabledChanged(b... | 35,506 |
31 | // Event emitted when user claim Asset token | event WithdrawedToken(uint id, address user, uint assetAmount);
| event WithdrawedToken(uint id, address user, uint assetAmount);
| 20,542 |
5 | // Tells the address of the owner return owner - the address of the owner/ | function proxyOwner() public view returns (address owner) {
bytes32 position = PROXY_OWNER_POSITION;
// solhint-disable-next-line no-inline-assembly
assembly {
owner := sload(position)
}
}
| function proxyOwner() public view returns (address owner) {
bytes32 position = PROXY_OWNER_POSITION;
// solhint-disable-next-line no-inline-assembly
assembly {
owner := sload(position)
}
}
| 11,063 |
11 | // function that is called when transaction target is a contract | function transferToContract(address _to, uint _value, bytes _data) private returns(bool success) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = SafeMath.sub(balanceOf(msg.sender), _value);
balances[_to] = SafeMath.add(balanceOf(_to), _value);
ERC223TokenReceiver receiver = ERC223TokenRe... | function transferToContract(address _to, uint _value, bytes _data) private returns(bool success) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = SafeMath.sub(balanceOf(msg.sender), _value);
balances[_to] = SafeMath.add(balanceOf(_to), _value);
ERC223TokenReceiver receiver = ERC223TokenRe... | 37,765 |
97 | // Initializes access controls. _admin Admins address. / | function initAccessControls(address _admin) public {
require(!initAccess, "Already initialised");
_setupRole(DEFAULT_ADMIN_ROLE, _admin);
initAccess = true;
}
| function initAccessControls(address _admin) public {
require(!initAccess, "Already initialised");
_setupRole(DEFAULT_ADMIN_ROLE, _admin);
initAccess = true;
}
| 13,970 |
17 | // Set client address, must be called by owner / | function setClientAddress(address _newClient) public onlyOwner {
clientAddress = _newClient;
}
| function setClientAddress(address _newClient) public onlyOwner {
clientAddress = _newClient;
}
| 20,977 |
259 | // Only perform the call to transfer if there is a non-zero balance. | if (balance > 0) {
if (!suppressRevert) {
| if (balance > 0) {
if (!suppressRevert) {
| 27,369 |
1 | // Calculates absolute difference between a and b a uint256 to compare with b uint256 to compare withreturn Difference between a and b / | function difference(uint256 a, uint256 b) external pure returns (uint256) {
return _difference(a, b);
}
| function difference(uint256 a, uint256 b) external pure returns (uint256) {
return _difference(a, b);
}
| 8,524 |
257 | // Set the required fraction of all Havvens that need to be part ofa vote for it to pass. / | function setRequiredParticipation(uint fraction)
external
onlyOwner
| function setRequiredParticipation(uint fraction)
external
onlyOwner
| 64,905 |
403 | // Percent of a Liquidation/Position's lockedCollateral to be deposited by a potential disputer Represented as a multiplier, for example 1.5e18 = "150%" and 0.05e18 = "5%" | FixedPoint.Unsigned public disputeBondPct;
| FixedPoint.Unsigned public disputeBondPct;
| 30,857 |
8 | // set max power | var PowerContract = ERC20(powerAddr);
uint256 authorizedPower = PowerContract.totalSupply();
contr.setMaxPower(authorizedPower);
| var PowerContract = ERC20(powerAddr);
uint256 authorizedPower = PowerContract.totalSupply();
contr.setMaxPower(authorizedPower);
| 30,798 |
10 | // Solari/ @date Sep 2021/Solari Token implementation | contract Solari is ERC20, Ownable {
using SafeMath for uint256;
// Events
event LogAddMinter(address indexed minter_);
event LogRemoveMinter(address indexed minter_);
// Minters
mapping(address => bool) public minters;
// Modifiers
modifier onlyMinter() {
require(minters[msg.s... | contract Solari is ERC20, Ownable {
using SafeMath for uint256;
// Events
event LogAddMinter(address indexed minter_);
event LogRemoveMinter(address indexed minter_);
// Minters
mapping(address => bool) public minters;
// Modifiers
modifier onlyMinter() {
require(minters[msg.s... | 50,933 |
232 | // In the specific case of a Lock, each owner can own only at most 1 key.return The number of NFTs owned by `_keyOwner`, either 0 or 1./ | function balanceOf(
address _keyOwner
)
public
view
returns (uint)
| function balanceOf(
address _keyOwner
)
public
view
returns (uint)
| 41,596 |
20 | // We only need settle the transfering in of the assetToTransferIn | _settleTokenTransfer(assetToTransferIn, transfers[0], address(market));
| _settleTokenTransfer(assetToTransferIn, transfers[0], address(market));
| 33,670 |
56 | // gets the latest recorded price time return the last recorded time of a synths price/ | function getLatestPriceTime() external view returns (uint) {
return _latestobservedtime;
}
| function getLatestPriceTime() external view returns (uint) {
return _latestobservedtime;
}
| 67,856 |
4 | // This emits when an operator is enabled or disabled for an owner./The operator can manage all NFTs of the owner. | event ApprovalForAll(
address indexed _owner,
address indexed _operator,
bool _approved
);
| event ApprovalForAll(
address indexed _owner,
address indexed _operator,
bool _approved
);
| 48,429 |
17 | // Creates a new lock by transferring 'amount' to a newly created holding contract. An NFT with the lockId is minted to the user. This NFT is transferrable and represents the ownership of the lock. token The token to transfer in amount The amount of tokens to transfer in unlockTimestamp The timestamp from which withdra... | function createLock(
IERC20 token,
uint256 amount,
uint256 unlockTimestamp,
bool unlockableByGovernance
| function createLock(
IERC20 token,
uint256 amount,
uint256 unlockTimestamp,
bool unlockableByGovernance
| 16,617 |
61 | // Buying eggs from the company | contract EggPurchase is EggMinting, ExternalContracts {
uint16[4] discountThresholds = [20, 100, 250, 500];
uint8[4] discountPercents = [75, 50, 30, 20 ];
// purchasing egg
function purchaseEgg(uint64 userNumber, uint16 quality) external payable whenNotPaused {
require(tokensC... | contract EggPurchase is EggMinting, ExternalContracts {
uint16[4] discountThresholds = [20, 100, 250, 500];
uint8[4] discountPercents = [75, 50, 30, 20 ];
// purchasing egg
function purchaseEgg(uint64 userNumber, uint16 quality) external payable whenNotPaused {
require(tokensC... | 36,734 |
153 | // handle transfers prior to adding newPrincipal to loanTokenSent | uint256 msgValue = _verifyTransfers(
collateralTokenAddress,
sentAddresses,
sentAmounts,
withdrawAmount
);
| uint256 msgValue = _verifyTransfers(
collateralTokenAddress,
sentAddresses,
sentAmounts,
withdrawAmount
);
| 21,956 |
53 | // OfficeHours Management /// | function canCast(uint40 _ts, bool _officeHours) public pure returns (bool) {
if (_officeHours) {
uint256 day = (_ts / 1 days + 3) % 7;
if (day >= 5) { return false; } // Can only be cast on a weekday
uint256 hour = _ts / 1 hours % 24;
if (hour... | function canCast(uint40 _ts, bool _officeHours) public pure returns (bool) {
if (_officeHours) {
uint256 day = (_ts / 1 days + 3) % 7;
if (day >= 5) { return false; } // Can only be cast on a weekday
uint256 hour = _ts / 1 hours % 24;
if (hour... | 39,491 |
3 | // Rauction | function getCounter() external returns (uint256);
function setCounter(uint) external;
function generateTokenId() external returns (uint256);
function isLive(uint) external view returns (bool);
function getTokens(uint256[] calldata) external view returns (DS.TokenData[] memory);
| function getCounter() external returns (uint256);
function setCounter(uint) external;
function generateTokenId() external returns (uint256);
function isLive(uint) external view returns (bool);
function getTokens(uint256[] calldata) external view returns (DS.TokenData[] memory);
| 29,978 |
8 | // todo to check the validity of new_vault |
_transfer(_vault, new_vault, balanceOf(_vault));
_vault = new_vault;
return true;
|
_transfer(_vault, new_vault, balanceOf(_vault));
_vault = new_vault;
return true;
| 21,324 |
1 | // Initialize inheritance chain | __Ownable_init();
__UUPSUpgradeable_init();
| __Ownable_init();
__UUPSUpgradeable_init();
| 30,870 |
68 | // Set max transaction | function setMaxTxAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
| function setMaxTxAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
| 53,035 |
11 | // Adds or changes a vote on a proposal. proposal The proposal struct. previousWeight The previous weight of the vote. currentWeight The current weight of the vote. previousVote The vote to be removed, or None for a new vote. currentVote The vote to be set. / | function updateVote(
Proposal storage proposal,
uint256 previousWeight,
uint256 currentWeight,
VoteValue previousVote,
VoteValue currentVote
| function updateVote(
Proposal storage proposal,
uint256 previousWeight,
uint256 currentWeight,
VoteValue previousVote,
VoteValue currentVote
| 19,137 |
25 | // Nonce for the next message to be sent, without the message version applied. Use themessageNonce getter which will insert the message version into the nonce to give youthe actual nonce to be used for the message. / | uint240 internal msgNonce;
| uint240 internal msgNonce;
| 15,946 |
78 | // release & release | event Release(address indexed _to, uint256 _amount);
event Refund(address indexed _to, uint256 _amount);
function release(address _addr)
external
returns (bool)
| event Release(address indexed _to, uint256 _amount);
event Refund(address indexed _to, uint256 _amount);
function release(address _addr)
external
returns (bool)
| 14,221 |
15 | // erc20 methods |
function getTotalSupplies(
address[] memory tokens
)
public
view
returns (address[] memory, uint256[] memory)
|
function getTotalSupplies(
address[] memory tokens
)
public
view
returns (address[] memory, uint256[] memory)
| 15,753 |
37 | // address array |
function inArray(address[] storage array, address _item)
|
function inArray(address[] storage array, address _item)
| 68,267 |
7 | // Withdraws from LP vault | uint256 _lpBefore = lp.balanceOf(address(this));
IVault(lpVault).withdraw(_lpVault);
uint256 _lpAfter = lp.balanceOf(address(this));
| uint256 _lpBefore = lp.balanceOf(address(this));
IVault(lpVault).withdraw(_lpVault);
uint256 _lpAfter = lp.balanceOf(address(this));
| 17,452 |
22 | // returns info list of ALL claims | function allClaims(uint256 offset, uint256 limit)
external
view
returns (AllClaimInfo[] memory _allClaimsInfo);
| function allClaims(uint256 offset, uint256 limit)
external
view
returns (AllClaimInfo[] memory _allClaimsInfo);
| 49,966 |
18 | // Vesting vaults can only contain fungible tokens. For this reason, the non-fungible and multi tokens are entirely disregarded in the pricing model. It is assumed that the vault factory will block any attempts at creating such a vault until the feature is supported. | if (!isVested) {
| if (!isVested) {
| 20,873 |
132 | // Checks whether the cap has been reached. return Whether the cap was reached/ | function capReached() public view returns (bool) {
return tokensSold >= cap;
}
| function capReached() public view returns (bool) {
return tokensSold >= cap;
}
| 11,231 |
3 | // Taker order is not valid | string constant ORDER_IS_NOT_FILLABLE = "ORDER_IS_NOT_FILLABLE";
string constant MAKER_ORDER_CAN_NOT_BE_MARKET_ORDER = "MAKER_ORDER_CAN_NOT_BE_MARKET_ORDER";
string constant TRANSFER_FROM_FAILED = "TRANSFER_FROM_FAILED";
string constant MAKER_ORDER_OVER_MATCH = "MAKER_ORDER_OVER_MATCH";
string const... | string constant ORDER_IS_NOT_FILLABLE = "ORDER_IS_NOT_FILLABLE";
string constant MAKER_ORDER_CAN_NOT_BE_MARKET_ORDER = "MAKER_ORDER_CAN_NOT_BE_MARKET_ORDER";
string constant TRANSFER_FROM_FAILED = "TRANSFER_FROM_FAILED";
string constant MAKER_ORDER_OVER_MATCH = "MAKER_ORDER_OVER_MATCH";
string const... | 11,325 |
5 | // Sets the base token URI prefix. | function setBaseTokenURI(string memory _baseTokenURI) external onlyOwner {
baseTokenURI = _baseTokenURI;
}
| function setBaseTokenURI(string memory _baseTokenURI) external onlyOwner {
baseTokenURI = _baseTokenURI;
}
| 14,202 |
8 | // transfer the nft to maxbidder | IERC721(_nft).safeTransferFrom(
address(this),
auction.maxBidUser,
_tokenId);
| IERC721(_nft).safeTransferFrom(
address(this),
auction.maxBidUser,
_tokenId);
| 44,511 |
1 | // Burns a specific amount of tokens._value The amount of token to be burned./ | function burn(uint256 _value) public;
| function burn(uint256 _value) public;
| 26,195 |
53 | // Check if the buyer has bought tokens | uint256 tokensBought = amountBought[_buyers[i]];
if (tokensBought == 0) continue;
| uint256 tokensBought = amountBought[_buyers[i]];
if (tokensBought == 0) continue;
| 22,983 |
43 | // PUBLIC: Get NFT contract address based on the collectible type / | function getNFTAddress(CollectibleType collectibleType)
internal
view
returns (address payable collectibleAddress)
| function getNFTAddress(CollectibleType collectibleType)
internal
view
returns (address payable collectibleAddress)
| 20,008 |
236 | // the referenced Uniswap pair contract | IUniswapV2Pair public override pair;
| IUniswapV2Pair public override pair;
| 16,707 |
1,067 | // Ensure the sAAVE synth Proxy is correctly connected to the Synth; | proxysaave_i.setTarget(Proxyable(new_SynthsAAVE_contract));
| proxysaave_i.setTarget(Proxyable(new_SynthsAAVE_contract));
| 49,028 |
153 | // This function is an owner only function, it can change baseURI. / | function setBaseURI(string memory uri) public onlyOwner {
require(!_baseURILocked_, "GhettoSharkhodd: BaseURI has been locked, it cannot be changed anymore.");
_baseURI_ = uri;
}
| function setBaseURI(string memory uri) public onlyOwner {
require(!_baseURILocked_, "GhettoSharkhodd: BaseURI has been locked, it cannot be changed anymore.");
_baseURI_ = uri;
}
| 38,261 |
44 | // Step two | raffles[_raffleId].participants.pop();
raffles[_raffleId].tickets.pop();
| raffles[_raffleId].participants.pop();
raffles[_raffleId].tickets.pop();
| 28,995 |
0 | // allocate initial supply; | _balances[msg.sender] = _initialSupply;
| _balances[msg.sender] = _initialSupply;
| 38,394 |
27 | // Whether the uniswap proxy has been changed -> needs manual update | bool public isValidUniswapProxy = true;
| bool public isValidUniswapProxy = true;
| 31,138 |
466 | // Returns length of the voting power history array for the delegate specified; useful since reading an entire array just to get its length is expensive (gas cost)_of delegate to query voting power history length forreturn voting power history array length for the delegate of interest / | function getVotingPowerHistoryLength(address _of) public view returns(uint256) {
// read array length and return
return votingPowerHistory[_of].length;
}
| function getVotingPowerHistoryLength(address _of) public view returns(uint256) {
// read array length and return
return votingPowerHistory[_of].length;
}
| 7,158 |
210 | // queried by others ({ERC165Checker}).For an implementation, see {ERC165}./ Returns true if this contract implements the interface defined by`interfaceId`. See the correspondingto learn more about how these ids are created. This function call must use less than 30 000 gas. / | function supportsInterface(bytes4 interfaceId) external view returns (bool);
| function supportsInterface(bytes4 interfaceId) external view returns (bool);
| 382 |
8 | // Returns the active state of the game / | function getGameActive() public view returns(bool) {
return gameActive;
}
| function getGameActive() public view returns(bool) {
return gameActive;
}
| 3,649 |
48 | // Adds an address to the list of agents authorizedto make 'modifyBeneficiary' mutations to the registry. / | function addAuthorizedEditAgent(address agent)
public
onlyOwner
| function addAuthorizedEditAgent(address agent)
public
onlyOwner
| 21,282 |
92 | // vID must be available | Validator storage validator = idToValidators[vID];
uint256 currentTimeStamp = block.timestamp;
uint256 interval = currentTimeStamp - validator.lastEpochTimestamp;
| Validator storage validator = idToValidators[vID];
uint256 currentTimeStamp = block.timestamp;
uint256 interval = currentTimeStamp - validator.lastEpochTimestamp;
| 23,505 |
27 | // anyone that doesn't own any pupe gets maxTime remaining | function abandonTime(address _ownerAddress)
public
view
returns (uint256)
| function abandonTime(address _ownerAddress)
public
view
returns (uint256)
| 16,887 |
61 | // Check if genders match - male is really male | require(getData().kangarooIsMale(male) == true && getData().kangarooIsMale(female) == false,"Couple genders mismatched");
| require(getData().kangarooIsMale(male) == true && getData().kangarooIsMale(female) == false,"Couple genders mismatched");
| 43,797 |
0 | // ------------------------------------------------------ generic object events | event onNewTransaction(uint transactionId);
event onUpdatedTransaction(uint transactionId);
event onNewPurchase(uint purchaseId);
event onUpdatedPurchase(uint purchaseId);
event onNewProduct(bytes32 productId);
event onUpdatedProduct(bytes32 productId);
event onNewCategory(bytes32 categoryId... | event onNewTransaction(uint transactionId);
event onUpdatedTransaction(uint transactionId);
event onNewPurchase(uint purchaseId);
event onUpdatedPurchase(uint purchaseId);
event onNewProduct(bytes32 productId);
event onUpdatedProduct(bytes32 productId);
event onNewCategory(bytes32 categoryId... | 54,390 |
147 | // register the supported interface to conform to ERC721Enumerable via ERC165 | _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
| _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
| 14,871 |
3 | // Burns a specific amount of tokens. _value The amount of token to be burned. / | function burn(uint256 _value) public {
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balanc... | function burn(uint256 _value) public {
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balanc... | 5,994 |
0 | // Interface for the Buy Back Reward contract that can be used to buildcustom logic to elevate user rewards / | interface IConditional {
/**
* @dev Returns whether a wallet passes the test.
*/
function passesTest(address wallet) external view returns (bool);
} | interface IConditional {
/**
* @dev Returns whether a wallet passes the test.
*/
function passesTest(address wallet) external view returns (bool);
} | 16,742 |
84 | // setting the number of selectors | assembly {
mstore(selectors, numSelectors)
}
| assembly {
mstore(selectors, numSelectors)
}
| 18,369 |
24 | // tokenζ―WETHοΌε
¨ι¨ζη° | IWETH(WETH).withdraw(balanceAfter);
uint toCoinbase = _profit * _coinbasePercent / 100;
uint toSender = balanceAfter - toCoinbase;
require(toSender > 0, "CaV3: sender no profit");
_safeTransferETH(msg.sender, toSender);
if(toCoinbase > 0){
if(_coinbaseAddre... | IWETH(WETH).withdraw(balanceAfter);
uint toCoinbase = _profit * _coinbasePercent / 100;
uint toSender = balanceAfter - toCoinbase;
require(toSender > 0, "CaV3: sender no profit");
_safeTransferETH(msg.sender, toSender);
if(toCoinbase > 0){
if(_coinbaseAddre... | 18,628 |
6 | // Convert signed 128.128 fixed point number into signed 64.64-bit fixed pointnumber rounding down.Revert on overflow.x signed 128.128-bin fixed point numberreturn signed 64.64-bit fixed point number / | function from128x128(int256 x) internal pure returns (int128) {
unchecked {
int256 result = x >> 64;
require(result >= MIN_64x64 && result <= MAX_64x64);
return int128(result);
}
}
| function from128x128(int256 x) internal pure returns (int128) {
unchecked {
int256 result = x >> 64;
require(result >= MIN_64x64 && result <= MAX_64x64);
return int128(result);
}
}
| 5,795 |
64 | // _numTokensWrapped++;we might just assign this | numTokensWrapped++;
| numTokensWrapped++;
| 47,238 |
188 | // Finish this. | (, uint256 amountEth, uint256 liquidity) = _addLiquidity1155WETH(vaultId, ids, amounts, minEthIn, msg.value, to);
| (, uint256 amountEth, uint256 liquidity) = _addLiquidity1155WETH(vaultId, ids, amounts, minEthIn, msg.value, to);
| 31,546 |
37 | // Decode a CBOR value into a Result instance. _cborValue An instance of `CBOR.Value`.return A `Result` instance. / | function resultFromCborValue(CBOR.Value memory _cborValue) public pure returns(Result memory) {
// Witnet uses CBOR tag 39 to represent RADON error code identifiers.
// [CBOR tag 39] Identifiers for CBOR: https://github.com/lucas-clemente/cbor-specs/blob/master/id.md
bool success = _cborValue.tag != 39;
... | function resultFromCborValue(CBOR.Value memory _cborValue) public pure returns(Result memory) {
// Witnet uses CBOR tag 39 to represent RADON error code identifiers.
// [CBOR tag 39] Identifiers for CBOR: https://github.com/lucas-clemente/cbor-specs/blob/master/id.md
bool success = _cborValue.tag != 39;
... | 25,175 |
308 | // The maximum value of a uint256 contains 78 digits (1 byte per digit), but we allocate 0x80 bytes to keep the free memory pointer 32-byte word aligned. We will need 1 32-byte word to store the length, and 3 32-byte words to store a maximum of 78 digits. Total: 0x20 + 30x20 = 0x80. | str := add(mload(0x40), 0x80)
| str := add(mload(0x40), 0x80)
| 18,444 |
11 | // Prevents a function from being called with a gas price higher/ than the specified limit.//_gasPriceLimit The gas price upper-limit in Wei. | modifier withGasPriceLimit(uint256 _gasPriceLimit) {
require(tx.gasprice <= _gasPriceLimit, "gas price too high");
_;
}
| modifier withGasPriceLimit(uint256 _gasPriceLimit) {
require(tx.gasprice <= _gasPriceLimit, "gas price too high");
_;
}
| 12,603 |
12 | // Update buffer length | mstore(bufptr, add(buflen, mload(data)))
src := add(data, 32)
| mstore(bufptr, add(buflen, mload(data)))
src := add(data, 32)
| 13,071 |
143 | // Dispute | enum Period {
evidence, // Evidence can be submitted. This is also when drawing has to take place.
commit, // Jurors commit a hashed vote. This is skipped for courts without hidden votes.
vote, // Jurors reveal/cast their vote depending on whether the court has hidden votes or not.
appeal, /... | enum Period {
evidence, // Evidence can be submitted. This is also when drawing has to take place.
commit, // Jurors commit a hashed vote. This is skipped for courts without hidden votes.
vote, // Jurors reveal/cast their vote depending on whether the court has hidden votes or not.
appeal, /... | 29,195 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.