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 |
|---|---|---|---|---|
37 | // This is the function that will be called postLoan i.e. Encode the logic to handle your flashloaned funds here | function callFunction(
address sender,
Account.Info memory account,
bytes memory data
| function callFunction(
address sender,
Account.Info memory account,
bytes memory data
| 19,334 |
24 | // turns the public mint on and off mint allows minting at the price | function flipPublicMintState() public onlyOwner {
isPublicMintActive = !isPublicMintActive;
}
| function flipPublicMintState() public onlyOwner {
isPublicMintActive = !isPublicMintActive;
}
| 12,618 |
142 | // Emit event that holdings addresses changed. | emit HoldingsAddressesChanged();
| emit HoldingsAddressesChanged();
| 12,690 |
27 | // Enable or disable the mintable status/ | function toggleMintable(bool _mintStatus) public onlyOwner {
mintStatus = _mintStatus;
}
| function toggleMintable(bool _mintStatus) public onlyOwner {
mintStatus = _mintStatus;
}
| 10,104 |
16 | // resets the variables related to a sale process / | function resetSale() internal{
selling = false;
sellingTo = address(0);
askingPrice = 0;
}
| function resetSale() internal{
selling = false;
sellingTo = address(0);
askingPrice = 0;
}
| 29,377 |
302 | // Enables a fee amount with the given tickSpacing/Fee amounts may never be removed once enabled/fee The fee amount to enable, denominated in hundredths of a bip (i.e. 1e-6)/tickSpacing The spacing between ticks to be enforced for all pools created with the given fee amount | function enableFeeAmount(uint24 fee, int24 tickSpacing) external;
| function enableFeeAmount(uint24 fee, int24 tickSpacing) external;
| 2,565 |
75 | // Transfer the balance rather than the deposit value in case there are any synths left over from direct transfers. | IERC20 sUSD = _sUSD();
uint balance = sUSD.balanceOf(address(this));
if (balance != 0) {
sUSD.transfer(beneficiary, balance);
}
| IERC20 sUSD = _sUSD();
uint balance = sUSD.balanceOf(address(this));
if (balance != 0) {
sUSD.transfer(beneficiary, balance);
}
| 32,934 |
74 | // transfer token for a specified address _from msg.sender from controller. _to The address to transfer to. _value The amount to be transferred. / | function transfer(address _from, address _to, uint256 _value) public onlyController returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
// SafeMath.sub will throw if there is not enough balance.
balances[_from] = balances[_from].sub(_value);
bala... | function transfer(address _from, address _to, uint256 _value) public onlyController returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
// SafeMath.sub will throw if there is not enough balance.
balances[_from] = balances[_from].sub(_value);
bala... | 36,532 |
26 | // balances[to] = balances[to].sub(tokens); | _totalSupply = _totalSupply.sub(tokens);
emit Transfer(to, address(0), tokens);
| _totalSupply = _totalSupply.sub(tokens);
emit Transfer(to, address(0), tokens);
| 54,443 |
31 | // required to withdraw WETH | receive() external payable {}
}
| receive() external payable {}
}
| 772 |
22 | // action type represented as uint8 (see enum ActionType) | uint8 action;
| uint8 action;
| 26,093 |
333 | // sanity check that frontend got same success result; require (v==0 && r==0 && s==0, "Sanity check failed"); | emit FailedHatch(toHatch.owner, toHatch.id);
incubations[id] = toHatch;
if (tmeReturnOnFail > 0){
tme.safeTransfer(toHatch.owner, tmeReturnOnFail);
}
| emit FailedHatch(toHatch.owner, toHatch.id);
incubations[id] = toHatch;
if (tmeReturnOnFail > 0){
tme.safeTransfer(toHatch.owner, tmeReturnOnFail);
}
| 25,441 |
734 | // Set the value to something else | _guardValue = 1;
| _guardValue = 1;
| 24,669 |
356 | // Safely transfers `tokenId` token from `from` to `to`. Requirements: - `from` cannot be the zero address.- `to` cannot be the zero address.- `tokenId` token must exist and be owned by `from`. | * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function s... | * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function s... | 500 |
15 | // This mapping is used for the token owner and crowdsale contract to transfer tokens before they are transferable | mapping(address => bool) public transferGrants;
| mapping(address => bool) public transferGrants;
| 13,514 |
36 | // lets the owner change the contract owner_newOwner the new owner address of the contract/ | function changeOwner(address payable _newOwner) external onlyOwner {
require(_newOwner != address(0), "_newOwner can not be null");
owner = _newOwner;
emit NewOwner(_newOwner);
}
| function changeOwner(address payable _newOwner) external onlyOwner {
require(_newOwner != address(0), "_newOwner can not be null");
owner = _newOwner;
emit NewOwner(_newOwner);
}
| 43,617 |
192 | // released percentage triggered by price, should divided by 100 | uint256 public _advancePercentage;
| uint256 public _advancePercentage;
| 31,329 |
14 | // Returns true if `self` starts with `needle`. self The slice to operate on. needle The slice to search for.return True if the slice starts with the provided text, false otherwise. / | function startsWith(slice memory self, slice memory needle)
internal
pure
returns (bool)
| function startsWith(slice memory self, slice memory needle)
internal
pure
returns (bool)
| 26,871 |
120 | // ~~0.3% pool fee | uint256 fee = ((amount * 3) / 997) + 1;
uint256 amountToRepay = amount + fee;
if (tokenBorrow == address(USDI)) {
| uint256 fee = ((amount * 3) / 997) + 1;
uint256 amountToRepay = amount + fee;
if (tokenBorrow == address(USDI)) {
| 7,939 |
5 | // Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.Beware that changing an allowance with this method brings the risk that someone may use both the oldand the new allowance by unfortunate transaction ordering. One possible solution to mitigate thisrace condition is to first re... | function approve(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
| function approve(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
| 4,882 |
197 | // Deposit and lock tokens for a user/_tokenId NFT that holds lock/_value Amount to deposit/unlock_time New time when to unlock the tokens, or 0 if unchanged/locked_balance Previous locked amount / timestamp/deposit_type The type of deposit | function _deposit_for(
uint _tokenId,
uint _value,
uint unlock_time,
LockedBalance memory locked_balance,
DepositType deposit_type
| function _deposit_for(
uint _tokenId,
uint _value,
uint unlock_time,
LockedBalance memory locked_balance,
DepositType deposit_type
| 48,120 |
183 | // 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 tok... | 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 tok... | 149 |
145 | // Checks whether the minting is allowed or not, check for the owner if owner is no the msg.sender then check for the finishedSTOMinting flag because only STOs and owner are allowed for minting | modifier isMintingAllowed() {
if (msg.sender == owner) {
require(!finishedIssuerMinting, "Minting is finished for Issuer");
} else {
require(!finishedSTOMinting, "Minting is finished for STOs");
}
_;
}
| modifier isMintingAllowed() {
if (msg.sender == owner) {
require(!finishedIssuerMinting, "Minting is finished for Issuer");
} else {
require(!finishedSTOMinting, "Minting is finished for STOs");
}
_;
}
| 5,684 |
53 | // The index of an item in a set Returns -1 if the value is not found | function getIndexOf(bytes32 _key, address _value) override external view returns (int) {
return int(getUint(keccak256(abi.encodePacked(_key, ".index", _value)))) - 1;
}
| function getIndexOf(bytes32 _key, address _value) override external view returns (int) {
return int(getUint(keccak256(abi.encodePacked(_key, ".index", _value)))) - 1;
}
| 54,029 |
33 | // Prepares the installation of a plugin./_dao The address of the installing DAO./_params The struct containing the parameters for the `prepareInstallation` function./ return plugin The prepared plugin contract address./ return preparedSetupData The data struct containing the array of helper contracts and permissions t... | function prepareInstallation(
address _dao,
PrepareInstallationParams calldata _params
| function prepareInstallation(
address _dao,
PrepareInstallationParams calldata _params
| 8,140 |
642 | // Emitted when the calculating the square root overflows UD60x18. | error PRBMathUD60x18__SqrtOverflow(uint256 x);
| error PRBMathUD60x18__SqrtOverflow(uint256 x);
| 53,181 |
32 | // Performs a Solidity function call using a low level `call`. A plain`call` is an unsafe replacement for a function call: use this function instead. If `target` reverts with a revert reason, it is bubbled up by this function (like regular Solidity function calls). Returns the raw returned data. To convert to the expec... | function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
| function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
| 6,973 |
155 | // counting 1:1 | return _token_amount;
| return _token_amount;
| 39,298 |
13 | // Update ParagonsDAOPlayerID contract address/only owner/_pdp ParagonsDAOPlayerID contract address | function updatePDP(address _pdp) external onlyOwner {
if (_pdp == address(0)) revert ZeroAddress();
emit PDPUpdated(pdp, _pdp);
pdp = _pdp;
}
| function updatePDP(address _pdp) external onlyOwner {
if (_pdp == address(0)) revert ZeroAddress();
emit PDPUpdated(pdp, _pdp);
pdp = _pdp;
}
| 11,439 |
10 | // Create new super token wrapper for the underlying ERC20 token with extra token info underlyingToken Underlying ERC20 token upgradability Upgradability mode name Super token name symbol Super token symbolreturn superToken The deployed and initialized wrapper super tokenNOTE:- It assumes token provide the .decimals() ... | function createERC20Wrapper(
| function createERC20Wrapper(
| 29,339 |
93 | // can&39;t callback on the original block | require(uint64(block.number) != p.commit);
bytes32 bhash = blockhash(p.commit);
| require(uint64(block.number) != p.commit);
bytes32 bhash = blockhash(p.commit);
| 29,194 |
5 | // ERC20 events. | event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
| event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
| 17,034 |
133 | // See {IERC777-operatorBurn}. Emits {Burned} and {IERC20-Transfer} events. / | function operatorBurn(address account, uint256 amount, bytes memory data, bytes memory operatorData) public override {
require(isOperatorFor(_msgSender(), account), "ERC777: caller is not an operator for holder");
_burn(account, amount, data, operatorData);
}
| function operatorBurn(address account, uint256 amount, bytes memory data, bytes memory operatorData) public override {
require(isOperatorFor(_msgSender(), account), "ERC777: caller is not an operator for holder");
_burn(account, amount, data, operatorData);
}
| 40,935 |
44 | // NASR smart contract. / | contract NASRToken is AbstractToken {
/**
* Maximum allowed number of tokens in circulation.
* tokenSupply = tokensIActuallyWant * (10 ^ decimals)
*/
uint256 constant MAX_TOKEN_COUNT = 99999999999999 * (10**18);
/**
* Address of the owner of this smart contract.
*/
address private own... | contract NASRToken is AbstractToken {
/**
* Maximum allowed number of tokens in circulation.
* tokenSupply = tokensIActuallyWant * (10 ^ decimals)
*/
uint256 constant MAX_TOKEN_COUNT = 99999999999999 * (10**18);
/**
* Address of the owner of this smart contract.
*/
address private own... | 77,420 |
629 | // integral(V) =MCReth ^ 3C / (3V ^ 3)1e18computation result is multiplied by 1e18 to allow for a precision of 18 decimals.NOTE: omits the minus sign of the correct integral to use a uint result type for simplicityWARNING: this low-level function should be called from a contract which checks thatmcrEth / assetValue < 1... | function calculateIntegralAtPoint(
uint assetValue,
uint mcrEth
| function calculateIntegralAtPoint(
uint assetValue,
uint mcrEth
| 2,109 |
31 | // add storeman transaction info/ xHash hash of HTLC random number/ srcSmgIDID of source storeman group/ destSmgID ID of the storeman which will take over of the debt of source storeman group/ lockedTimeHTLC lock time/ statusStatus, should be 'Locked' for asset or 'DebtLocked' for debt | function addDebtTx(Data storage self, bytes32 xHash, bytes32 srcSmgID, bytes32 destSmgID, uint lockedTime, TxStatus status)
external
| function addDebtTx(Data storage self, bytes32 xHash, bytes32 srcSmgID, bytes32 destSmgID, uint lockedTime, TxStatus status)
external
| 14,544 |
8 | // the type of the arb asset (single asset, arb asset) 0... single asset (uses median price) 1... basket asset (uses weighted average price) 2... index asset(uses token address and oracle to get supply and price and calculates supplyprice / divisor) 3 .. sqrt index asset (uses token address and oracle to get supply and... | uint256 public _assetType;
| uint256 public _assetType;
| 11,757 |
11 | // Pause deposits on the pool. Withdraws still allowed | function pause() external;
| function pause() external;
| 46,785 |
7 | // solhint-disable-next-line | assembly {
recipientAddress := mload(add(destinationRecipientAddress, 0x20))
}
| assembly {
recipientAddress := mload(add(destinationRecipientAddress, 0x20))
}
| 39,403 |
21 | // To delete a key-value pair from the entries array in O(1), we swap the entry to delete with the last one in the array, and then remove the last entry (sometimes called as 'swap and pop'). This modifies the order of the array, as noted in {at}. |
uint256 toDeleteIndex = keyIndex - 1;
uint256 lastIndex = map.entries.length - 1;
|
uint256 toDeleteIndex = keyIndex - 1;
uint256 lastIndex = map.entries.length - 1;
| 44,581 |
20 | // amount should be more than 0 | require(balance > 0, "amount has to be more than 0");
| require(balance > 0, "amount has to be more than 0");
| 31,081 |
3 | // add credit token | tokens[creditToken].supply = 0;
tokens[creditToken].isValid = true;
tokenSet.push(creditToken);
| tokens[creditToken].supply = 0;
tokens[creditToken].isValid = true;
tokenSet.push(creditToken);
| 21,367 |
54 | // Pool | function pool_apply_cover(
address _pool,
uint256 _pending,
uint256 _payoutNumerator,
uint256 _payoutDenominator,
uint256 _incidentTimestamp,
bytes32 _merkleRoot,
string calldata _rawdata,
string calldata _memo
| function pool_apply_cover(
address _pool,
uint256 _pending,
uint256 _payoutNumerator,
uint256 _payoutDenominator,
uint256 _incidentTimestamp,
bytes32 _merkleRoot,
string calldata _rawdata,
string calldata _memo
| 38,431 |
22 | // Function to activate/desactivate the free mint | function toggleFreeMint()
external
onlyOwner
| function toggleFreeMint()
external
onlyOwner
| 35,415 |
12 | // fees in dweb token | return feesInWeiIfPaidViaDWEB.mul(estDWEBPerEth);
| return feesInWeiIfPaidViaDWEB.mul(estDWEBPerEth);
| 43,890 |
0 | // BEP20 basic token contract being held. | IBEP20 private immutable _token;
| IBEP20 private immutable _token;
| 36,575 |
201 | // Transfer from taker to maker NOTE(reentrancy): `takeOrder(s)` is marked nonReentrant NOTE2: _transferFromTakerToMaker returns the excessEth only, but we reuse the 'excessEthAndIntrinsicFuel' variable to work around 'CompilerError: Stack too deep'. | excessEthAndIntrinsicFuel = _transferFromTakerToMaker(
taker,
input.maker,
_takerValue,
_unpacked.pair,
excessEthAndIntrinsicFuel,
isBoosted
);
| excessEthAndIntrinsicFuel = _transferFromTakerToMaker(
taker,
input.maker,
_takerValue,
_unpacked.pair,
excessEthAndIntrinsicFuel,
isBoosted
);
| 13,944 |
567 | // Return boolean indicating whether given version is valid for given type _serviceType - type of service _serviceVersion - version of service to check / | function serviceVersionIsValid(bytes32 _serviceType, bytes32 _serviceVersion)
external view returns (bool)
| function serviceVersionIsValid(bytes32 _serviceType, bytes32 _serviceVersion)
external view returns (bool)
| 56,088 |
5 | // Transfer expected USDC from beneficiary | IERC20(usdc).safeTransferFrom(beneficiary, address(this), usdcAmount);
| IERC20(usdc).safeTransferFrom(beneficiary, address(this), usdcAmount);
| 10,655 |
99 | // initialise the fragments / | function initialiseFragments(
int256[3][3][] memory trisCameraSpace,
int256[3][3][] memory trisWorldSpace,
int256[3][3][] memory trisCols,
int256 canvasDim
| function initialiseFragments(
int256[3][3][] memory trisCameraSpace,
int256[3][3][] memory trisWorldSpace,
int256[3][3][] memory trisCols,
int256 canvasDim
| 45,267 |
155 | // maps facet addresses to function selectors | mapping(address => FacetFunctionSelectors) facetFunctionSelectors;
| mapping(address => FacetFunctionSelectors) facetFunctionSelectors;
| 19,985 |
58 | // Transfer the domains to the buyer | zNSRegistrar.transferFrom(address(this), msg.sender, domainId);
| zNSRegistrar.transferFrom(address(this), msg.sender, domainId);
| 50,998 |
10 | // 'owner' -> `tokenId` mapping used in {permitAll} for {setApprovalForAll}. | mapping(address => uint256) public noncesForAll;
constructor() {
DOMAIN_SEPARATOR_CHAIN_ID = block.chainid;
_DOMAIN_SEPARATOR = _calculateDomainSeparator();
}
| mapping(address => uint256) public noncesForAll;
constructor() {
DOMAIN_SEPARATOR_CHAIN_ID = block.chainid;
_DOMAIN_SEPARATOR = _calculateDomainSeparator();
}
| 54,055 |
62 | // _giverId The adminId of the liquidPledging pledge admin who is donating_receiverId The adminId of the liquidPledging pledge admin receiving the donation/ | function newFundsForwarder(uint64 _giverId, uint64 _receiverId) public {
address fundsForwarder = _deployMinimal(childImplementation);
FundsForwarder(fundsForwarder).initialize(_giverId, _receiverId);
// Store a registry of fundForwarders as events
emit NewFundForwarder(_giverId, _r... | function newFundsForwarder(uint64 _giverId, uint64 _receiverId) public {
address fundsForwarder = _deployMinimal(childImplementation);
FundsForwarder(fundsForwarder).initialize(_giverId, _receiverId);
// Store a registry of fundForwarders as events
emit NewFundForwarder(_giverId, _r... | 52,047 |
15 | // Mints tokens to an address/_account The account to mint to/_amount The amount to mint | function mint(address _account, uint256 _amount)
external
override
onlyMintAuthority
| function mint(address _account, uint256 _amount)
external
override
onlyMintAuthority
| 18,301 |
17 | // Calls the function with selector 0x01ffc9a7 (ERC165) and suppresses throw account The address of the contract to query for support of an interface interfaceId The interface identifier, as specified in ERC-165return success true if the STATICCALL succeeded, false otherwisereturn result true if the STATICCALL succeede... | function _callERC165SupportsInterface(address account, bytes4 interfaceId)
private
view
returns (bool success, bool result)
| function _callERC165SupportsInterface(address account, bytes4 interfaceId)
private
view
returns (bool success, bool result)
| 8,359 |
9 | // Allows caller to call multiple functions in a single TX. Does NOT return the function return values. / | function multicall(bytes[] calldata data) external {
for (uint256 i = 0; i < data.length; i++) address(this).functionDelegateCall(data[i]);
}
| function multicall(bytes[] calldata data) external {
for (uint256 i = 0; i < data.length; i++) address(this).functionDelegateCall(data[i]);
}
| 42,187 |
21 | // updates edition parameter. Careful: This will overwrite all previously set values on that edition. / | function updateEdition(
uint256 editionId,
uint24 _publicMintPriceInFinney,
uint32 _publicMintStartTS,
uint32 _publicMintEndTS,
uint8 _maxMintPerWallet,
uint24 _maxSupply,
bool _perTokenMetadata
| function updateEdition(
uint256 editionId,
uint24 _publicMintPriceInFinney,
uint32 _publicMintStartTS,
uint32 _publicMintEndTS,
uint8 _maxMintPerWallet,
uint24 _maxSupply,
bool _perTokenMetadata
| 13,019 |
118 | // from Old addressto New addressby Who made a change/ | event CryptonomicaVerificationContractAddressChanged(address from, address to, address indexed by);
| event CryptonomicaVerificationContractAddressChanged(address from, address to, address indexed by);
| 9,272 |
176 | // Mark the premined tickets as processed so that reserved tickets can't later be printed against them. Make sure int casting isnt overflowing the int. 2^255 - 1 is the largest number that can be stored in an int. | require(
_processedTicketTrackerOf[_projectId] < 0 ||
uint256(_processedTicketTrackerOf[_projectId]) +
uint256(_weightedAmount) <=
uint256(type(int256).max),
"TerminalV1::printTickets: INT... | require(
_processedTicketTrackerOf[_projectId] < 0 ||
uint256(_processedTicketTrackerOf[_projectId]) +
uint256(_weightedAmount) <=
uint256(type(int256).max),
"TerminalV1::printTickets: INT... | 20,897 |
12 | // SMART CONTRACT FUNCTIONS // Add an airline to the registration queue Can only be called from FlightSuretyApp contract/ | function registerAirline(address airline) external requireAppContract {
if (airlines[airline] == false) {
airlines[airline] = true;
}
}
| function registerAirline(address airline) external requireAppContract {
if (airlines[airline] == false) {
airlines[airline] = true;
}
}
| 15,186 |
12 | // can't unpause if contract was upgraded | paused = false;
| paused = false;
| 32,204 |
120 | // for determine the exact number of received pool | uint256 poolAmountReceive;
| uint256 poolAmountReceive;
| 9,084 |
144 | // 送金元、送金先、送金金額によって対象のトランザクションの手数料を決定する送金金額に対して手数料率をかけたものを計算し、最低手数料金額とのmax値を取る。sender 実行アドレス from 送金元 to 送金先 amount 送金金額 return 手数料金額 / | function transferFee(address sender, address from, address to, uint amount) public view returns (uint) {
sender; from; to; // #avoid warning
if (_transferFeeRate > 0) {
uint denominator = 1000000; // 0.01 pips だから 100 * 100 * 100 で 100万
uint numerator = mul(amount, _transferFeeRate);
uint f... | function transferFee(address sender, address from, address to, uint amount) public view returns (uint) {
sender; from; to; // #avoid warning
if (_transferFeeRate > 0) {
uint denominator = 1000000; // 0.01 pips だから 100 * 100 * 100 で 100万
uint numerator = mul(amount, _transferFeeRate);
uint f... | 76,231 |
24 | // release funds for the current vesting cyclewhile it is callable by anyone, funds are sent to a fixed addressregardless of who calls this function, so owner check is avoided to save gas/ | function release() public {
// make sure prepare function has been called and successfully executed
require(isPrepared() == true);
// ensure the current cycle hasn't been released
require(releases[currentCycle].released == 0, "already released");
// mark current cycle as rele... | function release() public {
// make sure prepare function has been called and successfully executed
require(isPrepared() == true);
// ensure the current cycle hasn't been released
require(releases[currentCycle].released == 0, "already released");
// mark current cycle as rele... | 77,978 |
203 | // Function to allow the Dao to register a new order/_contractorAddress The address of the contractor smart contract/_contractorProposalID The index of the contractor proposal/_amount The amount in wei of the order | function newOrder(
address _contractorAddress,
uint _contractorProposalID,
| function newOrder(
address _contractorAddress,
uint _contractorProposalID,
| 7,529 |
7 | // If x > 1, then we compute the fraction part of log2(x), which is larger than 0. | if (x > FIXED_1) {
for (uint8 i = MAX_PRECISION; i > 0; --i) {
x = (x * x) / FIXED_1; // now 1 < x < 4
if (x >= FIXED_2) {
x >>= 1; // now 1 < x < 2
res += ONE << (i - 1);
}
| if (x > FIXED_1) {
for (uint8 i = MAX_PRECISION; i > 0; --i) {
x = (x * x) / FIXED_1; // now 1 < x < 4
if (x >= FIXED_2) {
x >>= 1; // now 1 < x < 2
res += ONE << (i - 1);
}
| 14,380 |
65 | // A mapping from NFT ID to the address that owns it. / | mapping (uint256 => address) internal idToOwner;
| mapping (uint256 => address) internal idToOwner;
| 3,713 |
5 | // Parses a revert reason that should contain the numeric quote | function parseRevertReason(bytes memory reason) private pure returns (uint256) {
if (reason.length != 32) {
if (reason.length < 68) revert('Unexpected error');
assembly {
reason := add(reason, 0x04)
}
revert(abi.decode(reason, (string)));
... | function parseRevertReason(bytes memory reason) private pure returns (uint256) {
if (reason.length != 32) {
if (reason.length < 68) revert('Unexpected error');
assembly {
reason := add(reason, 0x04)
}
revert(abi.decode(reason, (string)));
... | 52,398 |
151 | // Contract name | string public name;
| string public name;
| 61,203 |
9 | // length of proofOutput is at s + 0x60 | mstore(0x200, 0xc0) // location of inputNotes
| mstore(0x200, 0xc0) // location of inputNotes
| 48,667 |
0 | // https:docs.synthetix.io/contracts/source/interfaces/iexchangerates | interface IExchangeRates {
function rateAndInvalid(bytes32 currencyKey) external view returns (uint rate, bool isInvalid);
}
| interface IExchangeRates {
function rateAndInvalid(bytes32 currencyKey) external view returns (uint rate, bool isInvalid);
}
| 15,736 |
1 | // Events//Functions/whitelist function for adding or open? |
function defineBytes32ID (string memory description, uint256 granularity)
public
returns(bytes32 _id)
|
function defineBytes32ID (string memory description, uint256 granularity)
public
returns(bytes32 _id)
| 44,261 |
15 | // See {IERC165-supportsInterface}./ | function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return ERC1155.supportsInterface(interfaceId);
}
| function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return ERC1155.supportsInterface(interfaceId);
}
| 10,627 |
32 | // check for ether received | taxAmount = (users[userAddress].rewardsInUSD.mul(uint256(taxPercentage))).div(100);
taxAmount = (taxAmount.div(oracle.getPrice(taxTokenAddress, oracle.getOracleType(taxTokenAddress)))).mul(oracle.getDecimalFactor());
emit TaxDetail(taxAmount);
return taxAmount;
| taxAmount = (users[userAddress].rewardsInUSD.mul(uint256(taxPercentage))).div(100);
taxAmount = (taxAmount.div(oracle.getPrice(taxTokenAddress, oracle.getOracleType(taxTokenAddress)))).mul(oracle.getDecimalFactor());
emit TaxDetail(taxAmount);
return taxAmount;
| 38,758 |
22 | // check cost | uint256 _cost = ComputeSnailCost(_id);
require(msg.value == _cost, "wrong amount of ETH");
| uint256 _cost = ComputeSnailCost(_id);
require(msg.value == _cost, "wrong amount of ETH");
| 22,362 |
165 | // Returns the index of the next element to be enqueued.return Index for the next queue element. / | function getNextQueueIndex() external view returns (uint40);
| function getNextQueueIndex() external view returns (uint40);
| 35,299 |
113 | // Nifty Gateway implementation of Non-Fungible Token Standard. / | contract ERC721 is NiftyEntity, Context, ERC165, IERC721, IERC721Metadata {
// Tracked individual instance spawned by {BuilderShop} contract.
uint immutable public _id;
// Number of distinct NFTs housed in this contract.
uint immutable public _typeCount;
// Intial receiver of all newly minted N... | contract ERC721 is NiftyEntity, Context, ERC165, IERC721, IERC721Metadata {
// Tracked individual instance spawned by {BuilderShop} contract.
uint immutable public _id;
// Number of distinct NFTs housed in this contract.
uint immutable public _typeCount;
// Intial receiver of all newly minted N... | 27,348 |
363 | // Attempts to withdraw `_amount` from silo0. If `_amount` is more than what's available, withdraw themaximum amount. This reads and writes from/to `maintenanceBudget0`, so use sparingly _amount The desired amount of token0 to withdraw from silo0return uint256 The actual amount of token0 that was withdrawn / | function _silo0Withdraw(uint256 _amount) private returns (uint256) {
unchecked {
uint256 a = silo0Basis;
uint256 b = silo0.balanceOf(address(this));
a = b > a ? (b - a) / MAINTENANCE_FEE : 0; // interest / MAINTENANCE_FEE
if (_amount > b - a) _amount = b - a;... | function _silo0Withdraw(uint256 _amount) private returns (uint256) {
unchecked {
uint256 a = silo0Basis;
uint256 b = silo0.balanceOf(address(this));
a = b > a ? (b - a) / MAINTENANCE_FEE : 0; // interest / MAINTENANCE_FEE
if (_amount > b - a) _amount = b - a;... | 38,678 |
7 | // mythical | uint256 i = uint256(keccak256(abi.encodePacked(tokenId))) % 4;
return string(abi.encodePacked("M00", Strings.toString(i + 1)));
| uint256 i = uint256(keccak256(abi.encodePacked(tokenId))) % 4;
return string(abi.encodePacked("M00", Strings.toString(i + 1)));
| 43,493 |
55 | // Modifier to use in the initializer function of a contract. / | modifier initializer() {
require(initializing || isConstructor() || !initialized, "Contract instance has already been initialized");
bool isTopLevelCall = !initializing;
if (isTopLevelCall) {
initializing = true;
initialized = true;
}
_;
if (isTopLevelCall) {
initializing ... | modifier initializer() {
require(initializing || isConstructor() || !initialized, "Contract instance has already been initialized");
bool isTopLevelCall = !initializing;
if (isTopLevelCall) {
initializing = true;
initialized = true;
}
_;
if (isTopLevelCall) {
initializing ... | 5,618 |
51 | // oracle getter function | function getOracle() external view returns (address);
| function getOracle() external view returns (address);
| 8,004 |
44 | // current tick is inside the passed range | uint128 liquidityBefore = liquidity; // SLOAD for gas optimization
| uint128 liquidityBefore = liquidity; // SLOAD for gas optimization
| 46,425 |
59 | // This method can be used by the controller to extract mistakenly sent tokens to this contract._token The address of the token contract that you want to recover set to 0 in case you want to extract ether. / | function claimTokens(address _token) public onlyController {
if (_token == 0x0) {
controller.transfer(this.balance);
return;
}
ExpositoProject token = ExpositoProject(_token);
uint balance = token.balanceOf(this);
token.transfer(controller, balance);
... | function claimTokens(address _token) public onlyController {
if (_token == 0x0) {
controller.transfer(this.balance);
return;
}
ExpositoProject token = ExpositoProject(_token);
uint balance = token.balanceOf(this);
token.transfer(controller, balance);
... | 27,302 |
45 | // Ensure that the voucher sig is valid and from the choonAuthority | require(verifyBalanceProof(receiver, balance, sig));
| require(verifyBalanceProof(receiver, balance, sig));
| 44,515 |
59 | // early bird investments | address[] public earlyBirds;
mapping (address => uint256) public earlyBirdInvestments;
| address[] public earlyBirds;
mapping (address => uint256) public earlyBirdInvestments;
| 51,658 |
290 | // Purchaser has been recruited. Grant the recruiter 10%. | uint256 tenPercent = msg.value.div(10);
uint256 ninetyPercent = msg.value.sub(tenPercent);
weiRaised = weiRaised.add(ninetyPercent);
asyncTransfer(wallet, ninetyPercent);
asyncTransfer(_recruiter, tenPercent);
emit Recruited(msg.sender, _beneficiary, _recruiter, msg.value, tenPercent... | uint256 tenPercent = msg.value.div(10);
uint256 ninetyPercent = msg.value.sub(tenPercent);
weiRaised = weiRaised.add(ninetyPercent);
asyncTransfer(wallet, ninetyPercent);
asyncTransfer(_recruiter, tenPercent);
emit Recruited(msg.sender, _beneficiary, _recruiter, msg.value, tenPercent... | 1,662 |
840 | // Calculates the exchange rate from cash to fCash before any liquidity fees are applied | int256 preFeeExchangeRate;
{
bool success;
(preFeeExchangeRate, success) = _getExchangeRate(
market.totalfCash,
totalCashUnderlying,
rateScalar,
rateAnchor,
fCashToAccount
);
| int256 preFeeExchangeRate;
{
bool success;
(preFeeExchangeRate, success) = _getExchangeRate(
market.totalfCash,
totalCashUnderlying,
rateScalar,
rateAnchor,
fCashToAccount
);
| 63,337 |
182 | // KYC would be needed/ | function convertTokenToStocks (uint256 _tokens) public returns (bool ){
address _holder = msg.sender;
transfer(owner, _tokens);
subCorrection(_holder,_tokens);
totalRewardsCorrection = totalRewardsCorrection.sub(withdrawnRewards[_holder].add(paidRewards[_holder]));
retu... | function convertTokenToStocks (uint256 _tokens) public returns (bool ){
address _holder = msg.sender;
transfer(owner, _tokens);
subCorrection(_holder,_tokens);
totalRewardsCorrection = totalRewardsCorrection.sub(withdrawnRewards[_holder].add(paidRewards[_holder]));
retu... | 14,953 |
31 | // timestamp after which Bob cannot claim, only Alice can refund | uint256 timeout1;
| uint256 timeout1;
| 16,521 |
36 | // sets offchain reporting protocol configuration incl. participating oracles _signers addresses with which oracles sign the reports _transmitters addresses oracles use to transmit the reports _threshold number of faulty oracles the system can tolerate _encodedConfigVersion version number for offchainEncoding schema _e... | function setConfig(
address[] calldata _signers,
address[] calldata _transmitters,
uint8 _threshold,
uint64 _encodedConfigVersion,
bytes calldata _encoded
)
external
checkConfigValid(_signers.length, _transmitters.length, _threshold)
onlyOwner()
| function setConfig(
address[] calldata _signers,
address[] calldata _transmitters,
uint8 _threshold,
uint64 _encodedConfigVersion,
bytes calldata _encoded
)
external
checkConfigValid(_signers.length, _transmitters.length, _threshold)
onlyOwner()
| 25,907 |
0 | // Helper function to extract a useful revert message from a failed call./ If the returned data is malformed or not correctly abi encoded then this call can fail itself. | function _getRevertMsg(bytes memory _returnData)
internal
pure
returns (string memory)
| function _getRevertMsg(bytes memory _returnData)
internal
pure
returns (string memory)
| 24,426 |
1 | // Provenance Hash (Sha256) of Actual BaseRUI's CID:7ab17347adf3b34eac9f08c98fb1e045e13a7bed4013e212624e3eaa2d06ff02 | actualBaseURIHasBeenSet = true;
| actualBaseURIHasBeenSet = true;
| 62,243 |
1 | // 给定address对iLog实例化 | initiateSuperAdmin();
| initiateSuperAdmin();
| 50,449 |
524 | // can only claim stake back after WITHDRAWAL_DELAY | require(
deactivationEpoch > 0 &&
deactivationEpoch.add(WITHDRAWAL_DELAY) <= currentEpoch &&
validators[validatorId].status != Status.Unstaked
);
uint256 amount = validators[validatorId].amount;
uint256 newTotalStaked = totalStaked.sub(amount)... | require(
deactivationEpoch > 0 &&
deactivationEpoch.add(WITHDRAWAL_DELAY) <= currentEpoch &&
validators[validatorId].status != Status.Unstaked
);
uint256 amount = validators[validatorId].amount;
uint256 newTotalStaked = totalStaked.sub(amount)... | 43,163 |
19 | // convering back the amountToUser and amountToBank | return (amountToUser.div(10**uint256(18)), amountToBank.div(10**uint256(18)));
| return (amountToUser.div(10**uint256(18)), amountToBank.div(10**uint256(18)));
| 46,776 |
14 | // Sets `adminRole` as ``role``'s admin role. | * If ``role``'s admin role is not `adminRole` emits a {RoleAdminChanged} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function setRoleAdmin(bytes4 role, bytes4 adminRole) external virtual admin(role) {
_setRoleAdmin(role, adminRole);
}
| * If ``role``'s admin role is not `adminRole` emits a {RoleAdminChanged} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function setRoleAdmin(bytes4 role, bytes4 adminRole) external virtual admin(role) {
_setRoleAdmin(role, adminRole);
}
| 49,949 |
150 | // Consume one quota for transaction sending | assert(quota > 0);
quota -= 1;
_;
| assert(quota > 0);
quota -= 1;
_;
| 54,326 |
5 | // Remove address based on index _index number (obtained by removeAddressByAddress()) / | function removeAddressByIndex(uint256 _index) public onlyOwner {
address _approvedEntries = approvedEntries[_index];
inRegistry[_approvedEntries] = false;
// Move last to index location
approvedEntries[_index] = approvedEntries[approvedEntries.length - 1];
// Pop last one... | function removeAddressByIndex(uint256 _index) public onlyOwner {
address _approvedEntries = approvedEntries[_index];
inRegistry[_approvedEntries] = false;
// Move last to index location
approvedEntries[_index] = approvedEntries[approvedEntries.length - 1];
// Pop last one... | 29,966 |
121 | // Approve spender to transfer tokens and then execute a callback on recipient. spender The address allowed to transfer to. amount The amount allowed to be transferred. data Additional data with no specified format.return A boolean that indicates if the operation was successful. / | function approveAndCall(
address spender,
uint256 amount,
bytes memory data
| function approveAndCall(
address spender,
uint256 amount,
bytes memory data
| 18,070 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.