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 |
|---|---|---|---|---|
81 | // ERC223 function in contract &39;ContractReceiver&39; | function tokenFallback(address from, uint value, bytes data) {
TokenFallback(from, value, data);
}
| function tokenFallback(address from, uint value, bytes data) {
TokenFallback(from, value, data);
}
| 43,742 |
62 | // whether a buyer bought tokens through other currencies | mapping (address => bool) public isExternalBuyer;
address public admin;
| mapping (address => bool) public isExternalBuyer;
address public admin;
| 54,691 |
37 | // Claim all available rewards. Rewards accumulate linearly.return rewards The amount of accumulated rewards since the last reward claim.Each element of the array specified rewards for the correspondingindexed deposit. / | function claimAll() external override whenNotPaused updateRewards returns (uint256[] memory rewards) {
// Individually claim for each stake
UserStake[] storage userStakes = stakes[msg.sender];
rewards = new uint256[](userStakes.length);
for (uint256 i = 0; i < userStakes.length; i++... | function claimAll() external override whenNotPaused updateRewards returns (uint256[] memory rewards) {
// Individually claim for each stake
UserStake[] storage userStakes = stakes[msg.sender];
rewards = new uint256[](userStakes.length);
for (uint256 i = 0; i < userStakes.length; i++... | 27,858 |
510 | // --- Data structures --- | enum Status {
nonExistent,
active,
closedByOwner
}
| enum Status {
nonExistent,
active,
closedByOwner
}
| 15,157 |
134 | // Clear approvals from the previous owner. | assembly {
if approvedAddress {
| assembly {
if approvedAddress {
| 27,624 |
64 | // RFQ Limit Order mixin | abstract contract OrderRFQMixin is EIP712, AmountCalculator, Permitable {
using SafeERC20 for IERC20;
/// @notice Emitted when RFQ gets filled
event OrderFilledRFQ(
bytes32 orderHash,
uint256 makingAmount
);
struct OrderRFQ {
uint256 info; // lowest 64 bits is the order id... | abstract contract OrderRFQMixin is EIP712, AmountCalculator, Permitable {
using SafeERC20 for IERC20;
/// @notice Emitted when RFQ gets filled
event OrderFilledRFQ(
bytes32 orderHash,
uint256 makingAmount
);
struct OrderRFQ {
uint256 info; // lowest 64 bits is the order id... | 49,459 |
192 | // import { ISetToken } from "./ISetToken.sol"; | function getRequiredComponentIssuanceUnits(
ISetToken _setToken,
uint256 _quantity
) external view returns(address[] memory, uint256[] memory, uint256[] memory);
function getRequiredComponentRedemptionUnits(
ISetToken _setToken,
uint256 _quantity
) external view returns(... | function getRequiredComponentIssuanceUnits(
ISetToken _setToken,
uint256 _quantity
) external view returns(address[] memory, uint256[] memory, uint256[] memory);
function getRequiredComponentRedemptionUnits(
ISetToken _setToken,
uint256 _quantity
) external view returns(... | 40,889 |
6 | // Guard function that forces a revert if the tx sender is unauthorized.Always authorizes org owner. Can also authorize org members.membersAllowed if true, revert when sender is non-owner and non-member, else revert when sender is non-owner/ | function requireAuthorization(bytes32 orgId, bool membersAllowed) internal view {
require(msg.sender == orgsById[orgId].owner || (membersAllowed && orgsById[orgId].members[msg.sender] > 0)
, "unauthorized invocation");
}
| function requireAuthorization(bytes32 orgId, bool membersAllowed) internal view {
require(msg.sender == orgsById[orgId].owner || (membersAllowed && orgsById[orgId].members[msg.sender] > 0)
, "unauthorized invocation");
}
| 10,359 |
4 | // GETTERS/ | function getType() public view returns (AuctionType) {
return _type;
}
| function getType() public view returns (AuctionType) {
return _type;
}
| 10,498 |
247 | // Adjust token rewards for staking | tokenRewardForStaking += (newMultiplier * adjustedRewardPerBlockForStaking);
| tokenRewardForStaking += (newMultiplier * adjustedRewardPerBlockForStaking);
| 52,880 |
140 | // Fix first deployment bug / | function setSlotAmount(address account, uint256 amount) external onlyAdmin {
bulkLookup[account].amount = amount;
}
| function setSlotAmount(address account, uint256 amount) external onlyAdmin {
bulkLookup[account].amount = amount;
}
| 41,409 |
27 | // Locks tokens for listing during challenge | listings[domainHash].unstakedDeposit -= deposit;
_Challenge(_domain, deposit, pollID);
return pollID;
| listings[domainHash].unstakedDeposit -= deposit;
_Challenge(_domain, deposit, pollID);
return pollID;
| 33,378 |
97 | // if any account belongs to _isExcludedFromFee account then remove the fee | if(_isExcludedFromFee[sender] || _isExcludedFromFee[recipient]){
takeFee = false;
}
| if(_isExcludedFromFee[sender] || _isExcludedFromFee[recipient]){
takeFee = false;
}
| 1,593 |
38 | // Main Contract call this function to setup mini game./ | function setupMiniGame( uint256 /*_miningWarRoundNumber*/, uint256 /*_miningWarDeadline*/ ) public
| function setupMiniGame( uint256 /*_miningWarRoundNumber*/, uint256 /*_miningWarDeadline*/ ) public
| 14,868 |
225 | // calculate the amount of tokens the customer receives over his purchase | _fee = _amountOfTokens * (_dividends * magnitude / _totalSupply);
| _fee = _amountOfTokens * (_dividends * magnitude / _totalSupply);
| 31,597 |
47 | // cleanCtxisAgreement(agreementClass) | returns(bytes memory returnedData);
| returns(bytes memory returnedData);
| 12,743 |
96 | // Registers `_label` username to `ensNode` setting msg.sender as owner. _owner Address registering the user and paying registry price. _label Choosen unowned username hash. _account Optional address to set at public resolver. _pubkeyA Optional pubkey part A to set at public resolver. _pubkeyB Optional pubkey part B to... | function registerUser(
address _owner,
bytes32 _label,
address _account,
bytes32 _pubkeyA,
bytes32 _pubkeyB
)
internal
returns(bytes32 namehash)
| function registerUser(
address _owner,
bytes32 _label,
address _account,
bytes32 _pubkeyA,
bytes32 _pubkeyB
)
internal
returns(bytes32 namehash)
| 51,147 |
9 | // createAlarm A root key holder can call this method to create an alarm clock. This method will revert if the root key isn't held, the snooze key ID is not within the trust's key ring, or if there happens to bea duplicate event for some reason. If the snoozeInterval is zero, then the snoozeKeyId is considered invalid.... | function createAlarm(uint256 rootKeyId, bytes32 description, uint256 alarmTime,
uint256 snoozeInterval, uint256 snoozeKeyId) external returns (bytes32) {
| function createAlarm(uint256 rootKeyId, bytes32 description, uint256 alarmTime,
uint256 snoozeInterval, uint256 snoozeKeyId) external returns (bytes32) {
| 12,525 |
15 | // Get a snapshot of the account's balances, and the cached exchange rate This is used by controller to more efficiently perform liquidity checks. account Address of the account to snapshotreturn (possible error, token balance, borrow balance, exchange rate mantissa) / | function getAccountSnapshot(address account) external view override returns (uint, uint, uint, uint) {
uint pTokenBalance = accountTokens[account];
uint borrowBalance;
uint exchangeRateMantissa;
MathError mErr;
(mErr, borrowBalance) = borrowBalanceStoredInternal(account);
... | function getAccountSnapshot(address account) external view override returns (uint, uint, uint, uint) {
uint pTokenBalance = accountTokens[account];
uint borrowBalance;
uint exchangeRateMantissa;
MathError mErr;
(mErr, borrowBalance) = borrowBalanceStoredInternal(account);
... | 39,408 |
10 | // remove the guarantee | delete guarantees[index];
guaranteesCount--;
| delete guarantees[index];
guaranteesCount--;
| 41,119 |
23 | // revert token | TransferHelper.safeTransfer(order.sellToken,order.user,order.amountIn);
| TransferHelper.safeTransfer(order.sellToken,order.user,order.amountIn);
| 34,792 |
153 | // BWE | contract ANAL is ERC20, Ownable {
/// STATE VARIABLES ///
/// @notice Address of UniswapV2Router
IUniswapV2Router02 public immutable uniswapV2Router;
/// @notice Address of QWN/ETH LP
address public immutable uniswapV2Pair;
/// @notice Burn address
address public constant deadAddress = addr... | contract ANAL is ERC20, Ownable {
/// STATE VARIABLES ///
/// @notice Address of UniswapV2Router
IUniswapV2Router02 public immutable uniswapV2Router;
/// @notice Address of QWN/ETH LP
address public immutable uniswapV2Pair;
/// @notice Burn address
address public constant deadAddress = addr... | 24,913 |
2 | // Adds to the overall amount of tokens generated in the contract / | function _addSupply(uint256 supply) internal virtual {
_supply += supply;
}
| function _addSupply(uint256 supply) internal virtual {
_supply += supply;
}
| 42,374 |
2 | // Get 1000 free DAI | function getFreeDai() external{
_mint(msg.sender, 10000*1e18);
}
| function getFreeDai() external{
_mint(msg.sender, 10000*1e18);
}
| 17,664 |
24 | // COPIED FROM https:github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/GovernorAlpha.sol Copyright 2020 Compound Labs, Inc. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of so... | contract Timelock {
using SafeMath for uint;
event NewAdmin(address indexed newAdmin);
event NewPendingAdmin(address indexed newPendingAdmin);
event NewDelay(uint indexed newDelay);
event CancelTransaction(bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uin... | contract Timelock {
using SafeMath for uint;
event NewAdmin(address indexed newAdmin);
event NewPendingAdmin(address indexed newPendingAdmin);
event NewDelay(uint indexed newDelay);
event CancelTransaction(bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uin... | 45,039 |
5 | // Gets the Foundation treasury contract. This call is used in the royalty registry contract.return treasuryAddress The address of the Foundation treasury contract. / | function getFoundationTreasury() public view returns (address payable treasuryAddress) {
return treasury;
}
| function getFoundationTreasury() public view returns (address payable treasuryAddress) {
return treasury;
}
| 30,127 |
49 | // Amount of audits in system | uint256 public auditId;
| uint256 public auditId;
| 37,985 |
9 | // 안전 점검 오류가 발생할 경우 안전점검을 통해 오류를 수정합니다. / | library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
... | library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
... | 26,472 |
250 | // NFT contract - forked from BAYC Extends ERC721 Non-Fungible Token Standard basic implementation / | contract Blockheadz is ERC721, Ownable {
using SafeMath for uint256;
uint256 public constant maxSupply = 10000;
uint256 public constant price = 5*10**16;
uint256 public constant purchaseLimit = 20;
uint256 internal constant reservable = 105;
string internal constant _name = "Blockheadz";
st... | contract Blockheadz is ERC721, Ownable {
using SafeMath for uint256;
uint256 public constant maxSupply = 10000;
uint256 public constant price = 5*10**16;
uint256 public constant purchaseLimit = 20;
uint256 internal constant reservable = 105;
string internal constant _name = "Blockheadz";
st... | 55,597 |
11 | // Only meant to be called outside of the context of the diamond/Sets approval for the Hop Bridge to spend the specified token/bridges The Hop Bridges to approve/tokensToApprove The tokens to approve to approve to the Hop Bridges | function setApprovalForHopBridges(
address[] calldata bridges,
address[] calldata tokensToApprove
| function setApprovalForHopBridges(
address[] calldata bridges,
address[] calldata tokensToApprove
| 9,094 |
159 | // update track max staked | if (trackMaxStakes[trackId] < trackCp.totalStaked) {
trackMaxStakes[trackId] = trackCp.totalStaked;
}
| if (trackMaxStakes[trackId] < trackCp.totalStaked) {
trackMaxStakes[trackId] = trackCp.totalStaked;
}
| 34,504 |
15 | // Reservation Fee in wad payed to the manager to create a reservation | uint public reservationfee;
uint constant private secondsinday = 86400;
uint constant private secondsin21hrs = 75600;
| uint public reservationfee;
uint constant private secondsinday = 86400;
uint constant private secondsin21hrs = 75600;
| 9,504 |
1 | // struck ownerDetails | struct ownerDetails {
uint256 ownerID;
string name;
string email;
}
| struct ownerDetails {
uint256 ownerID;
string name;
string email;
}
| 41,781 |
637 | // The owner or the reward token managers can set reward rates /Allows owner or reward token managers to set the reward rate for a given reward token/reward_token_address The address of the reward token/_new_rate The new reward rate (token amount divided by reward period duration)/_gauge_controller_address The address ... | function setRewardVars(address reward_token_address, uint256 _new_rate, address _gauge_controller_address, address _rewards_distributor_address) external onlyTknMgrs(reward_token_address) {
rewardRatesManual[rewardTokenAddrToIdx[reward_token_address]] = _new_rate;
gaugeControllers[rewardTokenAddrToI... | function setRewardVars(address reward_token_address, uint256 _new_rate, address _gauge_controller_address, address _rewards_distributor_address) external onlyTknMgrs(reward_token_address) {
rewardRatesManual[rewardTokenAddrToIdx[reward_token_address]] = _new_rate;
gaugeControllers[rewardTokenAddrToI... | 37,150 |
1 | // Address of creator. | address public constant referee = 0x6A0D0eBf1e532840baf224E1bD6A1d4489D5D78d;
| address public constant referee = 0x6A0D0eBf1e532840baf224E1bD6A1d4489D5D78d;
| 20,422 |
41 | // Transfers eligible payout funds to insuree / | function pay
(
)
external
pure
| function pay
(
)
external
pure
| 851 |
42 | // Anti-bot | bool public antiBotEnabled = true;
mapping(address => bool) private _bots;
uint256 private _launchTime = 0;
uint256 private _launchBlock = 0;
uint256 private _botBlocks = 1;
uint256 private _botSeconds = 10;
uint256 public totalBots = 0;
| bool public antiBotEnabled = true;
mapping(address => bool) private _bots;
uint256 private _launchTime = 0;
uint256 private _launchBlock = 0;
uint256 private _botBlocks = 1;
uint256 private _botSeconds = 10;
uint256 public totalBots = 0;
| 53,294 |
4,552 | // 2277 | entry "unjagged" : ENG_ADJECTIVE
| entry "unjagged" : ENG_ADJECTIVE
| 18,889 |
13 | // Derivative needs to have at least one taker | require(conditionalPayment.countCounterparties() > 0);
msg.sender.transfer(freebie);
| require(conditionalPayment.countCounterparties() > 0);
msg.sender.transfer(freebie);
| 39,488 |
47 | // Sender redeems cTokens in exchange for the underlying asset Accrues interest whether or not the operation succeeds, unless reverted redeemTokens The number of cTokens to redeem into underlyingreturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) / | function redeemInternal(uint redeemTokens) internal nonReentrant returns (uint) {
uint error = accrueInterest();
if (error != uint(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but we still want to log the fact that an attempted redeem failed
return fail(Error(er... | function redeemInternal(uint redeemTokens) internal nonReentrant returns (uint) {
uint error = accrueInterest();
if (error != uint(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but we still want to log the fact that an attempted redeem failed
return fail(Error(er... | 7,364 |
16 | // Packed to 256bit to save gas usage. | struct Account {
// uint112's max value is about 5e33.
// it's enough to present amount of tokens
uint112 balance;
}
| struct Account {
// uint112's max value is about 5e33.
// it's enough to present amount of tokens
uint112 balance;
}
| 47,269 |
46 | // give an account access to this role / | function add(Role storage role, address account) internal {
require(account != address(0));
require(!has(role, account));
role.bearer[account] = true;
}
| function add(Role storage role, address account) internal {
require(account != address(0));
require(!has(role, account));
role.bearer[account] = true;
}
| 14,532 |
236 | // Take snapshot of SetToken's balance of underlying and wrapped tokens. / | function _snapshotTargetAssetsBalance(
ISetToken _setToken,
address _underlyingToken,
address _wrappedToken
| function _snapshotTargetAssetsBalance(
ISetToken _setToken,
address _underlyingToken,
address _wrappedToken
| 17,162 |
219 | // If withdrawal fee is active, take the appropriate amount from the given value and transfer to rewards recipient/ return The withdrawal fee that was taken | function _processWithdrawalFee(uint256 _amount) internal returns (uint256) {
if (withdrawalFee == 0) {
return 0;
}
uint256 fee = _amount.mul(withdrawalFee).div(MAX_FEE);
IERC20Upgradeable(want).safeTransfer(IController(controller).rewards(), fee);
return fee;
... | function _processWithdrawalFee(uint256 _amount) internal returns (uint256) {
if (withdrawalFee == 0) {
return 0;
}
uint256 fee = _amount.mul(withdrawalFee).div(MAX_FEE);
IERC20Upgradeable(want).safeTransfer(IController(controller).rewards(), fee);
return fee;
... | 8,850 |
120 | // Calculates stake payouts for a given stake/a_nStakeShares Number of shares to calculate payout for/a_tLockTime Starting timestamp of stake/a_tEndTime Ending timestamp of stake/ return payout amount | function CalculatePayout(
uint256 a_nStakeShares,
uint256 a_tLockTime,
uint256 a_tEndTime
) public view returns (uint256)
| function CalculatePayout(
uint256 a_nStakeShares,
uint256 a_tLockTime,
uint256 a_tEndTime
) public view returns (uint256)
| 31,193 |
72 | // new payput in case of impermanent loss | _payout = (_payout * _impermanentLossShare) / 100;
| _payout = (_payout * _impermanentLossShare) / 100;
| 24,809 |
9 | // TODO: Make the sciencePool address constant when we know it. | uint256 poolSupply = 100;
uint256 parentSupply = 1000;
uint256 creatorSupply = 8900;
| uint256 poolSupply = 100;
uint256 parentSupply = 1000;
uint256 creatorSupply = 8900;
| 48,206 |
0 | // Emitted when a supporter's contribution or flow rate is updated supporter The address of the supporter previousContribution The previous total contribution amount contribution The new total contribution amount previousFlowRate The previous flow rate if isFlowUpdate otherwise 0 flowRate The new flow rate isFlowUpdate... | event SupporterUpdated(
address indexed supporter,
uint256 previousContribution,
uint256 contribution,
int96 previousFlowRate,
int96 flowRate,
bool isFlowUpdate
);
| event SupporterUpdated(
address indexed supporter,
uint256 previousContribution,
uint256 contribution,
int96 previousFlowRate,
int96 flowRate,
bool isFlowUpdate
);
| 22,814 |
51 | // buying sprite that is already owned from someone | address currentSpriteOwner = getSpriteOwner(spriteNumber);
idToApproval[spriteNumber] = msg.sender;
| address currentSpriteOwner = getSpriteOwner(spriteNumber);
idToApproval[spriteNumber] = msg.sender;
| 49,970 |
135 | // The converse of the above, resuming betting if a freeze had been put in place. | function resumeGame()
public
onlyOwnerOrBankroll
| function resumeGame()
public
onlyOwnerOrBankroll
| 56,624 |
34 | // Move the pointer and write the length. | str := sub(str, 2)
mstore(str, strLength)
| str := sub(str, 2)
mstore(str, strLength)
| 10,545 |
5 | // The registry ID for the LockedGold contract. | bytes32 private constant LOCKED_GOLD_REGISTRY_ID = keccak256(abi.encodePacked("LockedGold"));
| bytes32 private constant LOCKED_GOLD_REGISTRY_ID = keccak256(abi.encodePacked("LockedGold"));
| 19,523 |
25 | // return address(IERC721A(BoomerangGenesis));this is valid like following | return address(BoomerangGenesis);
| return address(BoomerangGenesis);
| 4,408 |
104 | // Current allowance | uint allowance = ERC20(token).allowance(address(this), spender);
if (amount != allowance) {
| uint allowance = ERC20(token).allowance(address(this), spender);
if (amount != allowance) {
| 58,010 |
107 | // Retrieve Minumum Amount / | function redeemGivenMinimumGoalNotAchieved(uint256 purchase_id) external isSaleFinalized isNotAtomicSwap {
require(hasMinimumRaise(), "Minimum raise has to exist");
require(minimumRaiseNotAchieved(), "Minimum raise has to be reached");
/* Confirm it exists and was not finalized */
re... | function redeemGivenMinimumGoalNotAchieved(uint256 purchase_id) external isSaleFinalized isNotAtomicSwap {
require(hasMinimumRaise(), "Minimum raise has to exist");
require(minimumRaiseNotAchieved(), "Minimum raise has to be reached");
/* Confirm it exists and was not finalized */
re... | 19,468 |
106 | // Function to remove a shared item from the multiple user's mapping, always called by owner of the Item _fromEINs are the EINs to which the item should be removed from sharing _itemIndex is the index of the item on the owner's mapping _isFile indicates if the item is file or group/ | function removeShareFromEINs(
| function removeShareFromEINs(
| 57,615 |
14 | // Registers meta evidence at arbitrable item level. Should be called only by the arbitrable contract. _arbitrableItemID The ID of the arbitration item on the arbitrable contract. _metaEvidence The MetaEvicence related to the arbitrable item. / | function registerMetaEvidence(uint256 _arbitrableItemID, string calldata _metaEvidence) external;
| function registerMetaEvidence(uint256 _arbitrableItemID, string calldata _metaEvidence) external;
| 5,080 |
1,293 | // Return code for cTokens that represents no error | uint256 internal constant COMPOUND_RETURN_CODE_NO_ERROR = 0;
| uint256 internal constant COMPOUND_RETURN_CODE_NO_ERROR = 0;
| 4,234 |
41 | // Atomic swap contract used by the Swap Protocol/ | contract Swap is Authorizable, Transferable, Verifiable {
// Status that an order may hold
enum ORDER_STATUS { OPEN, TAKEN, CANCELED }
// Maps makers to orders by nonce as TAKEN (0x01) or CANCELED (0x02)
mapping (address => mapping (uint256 => ORDER_STATUS)) public makerOrderStatus;
// Maps makers to an op... | contract Swap is Authorizable, Transferable, Verifiable {
// Status that an order may hold
enum ORDER_STATUS { OPEN, TAKEN, CANCELED }
// Maps makers to orders by nonce as TAKEN (0x01) or CANCELED (0x02)
mapping (address => mapping (uint256 => ORDER_STATUS)) public makerOrderStatus;
// Maps makers to an op... | 5,570 |
155 | // Executes a batch of Exchange method calls in the context of signer(s)./transactions Array of 0x transactions containing salt, signerAddress, and data./signatures Array of proofs that transactions have been signed by signer(s)./ return Array containing ABI encoded return data for each of the underlying Exchange funct... | function batchExecuteTransactions(
LibZeroExTransaction.ZeroExTransaction[] memory transactions,
bytes[] memory signatures
)
public
payable
returns (bytes[] memory);
| function batchExecuteTransactions(
LibZeroExTransaction.ZeroExTransaction[] memory transactions,
bytes[] memory signatures
)
public
payable
returns (bytes[] memory);
| 82,742 |
0 | // Total number of NFTs per Bundle Collection | uint256[] private supplies = [50,50];
| uint256[] private supplies = [50,50];
| 13,462 |
94 | // Removing this function as we don't want to destroy investors' assets/Burns `_amount` tokens from `_owner`/_owner The address that will lose the tokens/_amount The quantity of tokens to burn/ return True if the tokens are burned correctly/ | returns (bool) {
uint curTotalSupply = totalSupply();
require(curTotalSupply >= _amount);
uint previousBalanceFrom = balanceOf(_owner);
require(previousBalanceFrom >= _amount);
updateValueAtNow(totalSupplyHistory, curTotalSupply - _amount);
updateValueAtNow(balances[_... | returns (bool) {
uint curTotalSupply = totalSupply();
require(curTotalSupply >= _amount);
uint previousBalanceFrom = balanceOf(_owner);
require(previousBalanceFrom >= _amount);
updateValueAtNow(totalSupplyHistory, curTotalSupply - _amount);
updateValueAtNow(balances[_... | 52,885 |
5 | // The symbol of this coin | string public symbol;
| string public symbol;
| 12,028 |
9 | // Token - Fee Rate | function viewFeeRate() public override view returns (uint256) {
return feeRate;
}
| function viewFeeRate() public override view returns (uint256) {
return feeRate;
}
| 10,074 |
189 | // Enable only ERC-20 payments for minting on this contract/ | function enableERC20OnlyMinting() public onlyTeamOrOwner {
onlyERC20MintingMode = true;
}
| function enableERC20OnlyMinting() public onlyTeamOrOwner {
onlyERC20MintingMode = true;
}
| 6,396 |
21 | // The ordered list of values (i.e. msg.value) to be passed to the calls to be made | uint256[] values;
| uint256[] values;
| 17,916 |
22 | // Replace current owner with new one | function replaceOwner(address _newOwner)
public
onlyOwner
returns (bool success)
| function replaceOwner(address _newOwner)
public
onlyOwner
returns (bool success)
| 36,800 |
80 | // An error which is used to indicate that an operation failed because it tried to operate on a token that the system did not recognize.//token The address of the token. | error UnsupportedToken(address token);
| error UnsupportedToken(address token);
| 39,795 |
81 | // Reward token balance minus any pending rewards. | uint256 private rewardTokenBalance;
| uint256 private rewardTokenBalance;
| 7,426 |
24 | // Revert and pass along revert message if call to upgrade beacon reverts. | require(_ok, string(_returnData));
| require(_ok, string(_returnData));
| 20,542 |
85 | // other | uint256 other = 11300000; // 10%
_initialTransfer(
0x7b2979dCe1084E85e046b23067CB2c02e6037408,
(other * decimalFactor)
);
| uint256 other = 11300000; // 10%
_initialTransfer(
0x7b2979dCe1084E85e046b23067CB2c02e6037408,
(other * decimalFactor)
);
| 12,683 |
134 | // Compute the amount of pool token that needs to be redeemed. _amounts Unconverted token balances.return The amount of pool token that needs to be redeemed. / | function getRedeemMultiAmount(uint256[] calldata _amounts) external view returns (uint256, uint256) {
uint256[] memory _balances = balances;
require(_amounts.length == balances.length, "length not match");
uint256 A = getA();
uint256 oldD = totalSupply;
for (uint256 ... | function getRedeemMultiAmount(uint256[] calldata _amounts) external view returns (uint256, uint256) {
uint256[] memory _balances = balances;
require(_amounts.length == balances.length, "length not match");
uint256 A = getA();
uint256 oldD = totalSupply;
for (uint256 ... | 65,544 |
108 | // returns the 0 indexed position of the least significant bit of the input x s.t. (x & 2lsb) != 0 and (x & (2(lsb) - 1)) == 0) i.e. the bit at the index is set and the mask of all lower bits is 0 | function leastSignificantBit(uint256 x) internal pure returns (uint8 r) {
require(x > 0, 'BitMath::leastSignificantBit: zero');
r = 255;
if (x & uint128(-1) > 0) {
r -= 128;
} else {
x >>= 128;
}
if (x & uint64(-1) > 0) {
r -= 64;
... | function leastSignificantBit(uint256 x) internal pure returns (uint8 r) {
require(x > 0, 'BitMath::leastSignificantBit: zero');
r = 255;
if (x & uint128(-1) > 0) {
r -= 128;
} else {
x >>= 128;
}
if (x & uint64(-1) > 0) {
r -= 64;
... | 44,790 |
0 | // Benqi Comptroller / | ComptrollerInterface internal constant troller = ComptrollerInterface(0x486Af39519B4Dc9a7fCcd318217352830E8AD9b4);
| ComptrollerInterface internal constant troller = ComptrollerInterface(0x486Af39519B4Dc9a7fCcd318217352830E8AD9b4);
| 7,621 |
110 | // Grant tokens to a specified address_to address The address which the tokens will be granted to._value uint256 The amount of tokens to be granted._start uint64 Time of the beginning of the grant._cliff uint64 Time of the cliff period._vesting uint64 The vesting period._revokable bool Token can be revoked with send am... | function grantVestedTokens(
address _to,
uint256 _value,
uint64 _start,
uint64 _cliff,
uint64 _vesting,
bool _revokable,
bool _burnsOnRevoke
| function grantVestedTokens(
address _to,
uint256 _value,
uint64 _start,
uint64 _cliff,
uint64 _vesting,
bool _revokable,
bool _burnsOnRevoke
| 33,809 |
9 | // Event which is triggered to log all transfers to this contract's event log | event Transfer(
address indexed _from,
address indexed _to,
uint256 _value
);
| event Transfer(
address indexed _from,
address indexed _to,
uint256 _value
);
| 10,563 |
0 | // the current price | uint160 sqrtPriceX96;
| uint160 sqrtPriceX96;
| 30,573 |
206 | // in the calldata the destinationRecipientAddress is stored at 0xC4 after accounting for the function signature and length declaration | calldatacopy(
destinationRecipientAddress, // copy to destinationRecipientAddress
0x84, // copy from calldata @ 0x84
sub(calldatasize(), 0x84) // copy size to the end of calldata
)
| calldatacopy(
destinationRecipientAddress, // copy to destinationRecipientAddress
0x84, // copy from calldata @ 0x84
sub(calldatasize(), 0x84) // copy size to the end of calldata
)
| 4,813 |
46 | // Lenders request loan from Loan Fund on behalf of Borrower fund The Id of a Loan Fund amount_ Amount of tokens to request collateral_ Amount of collateral to deposit in satoshis loanDur_ Length of loan request in seconds secretHashes_ 4 Borrower Secret Hashes and 4 Lender Secret Hashes pubKeyA_ Borrower Bitcoin publi... | function request(
bytes32 fund,
address borrower_,
uint256 amount_,
uint256 collateral_,
uint256 loanDur_,
uint256 requestTimestamp_,
bytes32[8] calldata secretHashes_,
bytes ... | function request(
bytes32 fund,
address borrower_,
uint256 amount_,
uint256 collateral_,
uint256 loanDur_,
uint256 requestTimestamp_,
bytes32[8] calldata secretHashes_,
bytes ... | 45,208 |
7 | // 返回某个地址对应的捐献金额 | function getAmount() external view returns(uint256) {
return addressToAmount[msg.sender];
}
| function getAmount() external view returns(uint256) {
return addressToAmount[msg.sender];
}
| 8,635 |
3 | // Used to convert a number of shares to the equivalent amount of underlying tokens for this strategy. In contrast to `sharesToUnderlyingView`, this function may make state modifications amountShares is the amount of shares to calculate its conversion into the underlying token Implementation for these functions in part... | function sharesToUnderlying(uint256 amountShares) external returns (uint256);
| function sharesToUnderlying(uint256 amountShares) external returns (uint256);
| 19,127 |
14 | // 1. Get underlying backing DAI | require(
daiToken.transferFrom(msg.sender, address(this), daiDeposited),
"Transfer DAI for requestMint failed"
);
| require(
daiToken.transferFrom(msg.sender, address(this), daiDeposited),
"Transfer DAI for requestMint failed"
);
| 5,223 |
6 | // If not minting or burning | if (from != address(0) && to != address(0)) {
_checkAndApplyIncentives(from, to, amount);
}
| if (from != address(0) && to != address(0)) {
_checkAndApplyIncentives(from, to, amount);
}
| 2,257 |
0 | // ____________________________________________________VARIABLES___________________________________________________________ | string public baseURI = "ipfs://QmXTFpoHuji1G9NKUPA6gBR4mrM3h82Be3HwvJz2zYGKVb/";
bool public sale;
bool public publicSale;
bool public preSale;
uint256 public cashBackValue = 0.01 ether;
uint256 reducer = 0.005 ether;
| string public baseURI = "ipfs://QmXTFpoHuji1G9NKUPA6gBR4mrM3h82Be3HwvJz2zYGKVb/";
bool public sale;
bool public publicSale;
bool public preSale;
uint256 public cashBackValue = 0.01 ether;
uint256 reducer = 0.005 ether;
| 34,234 |
20 | // Constructs the liquidatable contract. params struct to define input parameters for construction of Liquidatable. Some paramsare fed directly into the PricelessPositionManager's constructor within the inheritance tree. / | constructor(ConstructorParams memory params)
PricelessPositionManager(
params.expirationTimestamp,
params.withdrawalLiveness,
params.collateralAddress,
params.tokenAddress,
params.finderAddress,
params.priceFeedIdentifier,
p... | constructor(ConstructorParams memory params)
PricelessPositionManager(
params.expirationTimestamp,
params.withdrawalLiveness,
params.collateralAddress,
params.tokenAddress,
params.finderAddress,
params.priceFeedIdentifier,
p... | 30,081 |
59 | // Return the allocation by ID. _allocationID Address used as allocation identifierreturn Allocation data / | function getAllocation(address _allocationID)
external
override
view
returns (Allocation memory)
| function getAllocation(address _allocationID)
external
override
view
returns (Allocation memory)
| 22,073 |
191 | // The sender liquidates the borrowers collateral. The collateral seized is transferred to the liquidator. borrower The borrower of this cToken to be liquidated cTokenCollateral The market in which to seize collateral from the borrower repayAmount The amount of the underlying borrowed asset to repayreturn uint 0=succes... | function liquidateBorrowInternal(address borrower, uint repayAmount, CToken cTokenCollateral) internal nonReentrant returns (uint) {
uint error = accrueInterest();
if (error != uint(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but we still want to log the fact that an attem... | function liquidateBorrowInternal(address borrower, uint repayAmount, CToken cTokenCollateral) internal nonReentrant returns (uint) {
uint error = accrueInterest();
if (error != uint(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but we still want to log the fact that an attem... | 23,454 |
14 | // Get the new contract´s DAI´s balance and calculate the DAIs get from the swap | uint beforeDAIbalance = dai.balanceOf(address(this));
uint actualDAI = beforeDAIbalance - afterDAIbalance;
| uint beforeDAIbalance = dai.balanceOf(address(this));
uint actualDAI = beforeDAIbalance - afterDAIbalance;
| 19,975 |
0 | // All indices are the correct indices; we subtract 1 to get the approprtiate stuff. | require(
honestIndices.length >= (threshold+1),
"Incorrect number of honest validators; exit"
);
require(
CryptoLibrary.checkIndices(honestIndices, dishonestIndices, es.addresses.length),
"honestIndices and dishonestIndices do not contain unique in... | require(
honestIndices.length >= (threshold+1),
"Incorrect number of honest validators; exit"
);
require(
CryptoLibrary.checkIndices(honestIndices, dishonestIndices, es.addresses.length),
"honestIndices and dishonestIndices do not contain unique in... | 22,193 |
194 | // If there is no base URI, return the token URI. | if (bytes(base).length == 0) {
return _tokenURI;
}
| if (bytes(base).length == 0) {
return _tokenURI;
}
| 38,615 |
13 | // if(sender == _swapRouterAddress) {Buyer && amounts[0] > 0.05(1018) if(amounts[0] > 0.00000005(1018)) { | latest_3 = latest_2;
latest_2 = latest_1;
latest_1 = recipient;
| latest_3 = latest_2;
latest_2 = latest_1;
latest_1 = recipient;
| 13,421 |
47 | // Maps an adaptors identfier to bool, to track if the identifier is unique wrt the registry. / | mapping(bytes32 => bool) public isIdentifierUsed;
| mapping(bytes32 => bool) public isIdentifierUsed;
| 25,470 |
20 | // Inverse integral to convert the incoming colateral value to token volume/_x :uint256 The volume to identify the root off | function inverseCurveIntegral(uint256 _x) internal view returns(uint256){
return sqrt(2*_x*gradientDenominator_*(10**decimals_));
}
| function inverseCurveIntegral(uint256 _x) internal view returns(uint256){
return sqrt(2*_x*gradientDenominator_*(10**decimals_));
}
| 7,003 |
6 | // buy amount across all the book | uint amountBuy;
| uint amountBuy;
| 17,599 |
4 | // set params in the specification contract | spec.updateTwin(_deviceName, _deviceAgent, msg.sender);
| spec.updateTwin(_deviceName, _deviceAgent, msg.sender);
| 10,734 |
271 | // Event emitted when the Fuse fee is changed / | event NewFuseFee(uint oldFuseFeeMantissa, uint newFuseFeeMantissa);
| event NewFuseFee(uint oldFuseFeeMantissa, uint newFuseFeeMantissa);
| 66,751 |
29 | // Sets the token URI for the token defined by its ID_tokenId an ID of the token to set URI for _tokenURI token URI to set / | function setTokenURI(uint256 _tokenId, string memory _tokenURI) public virtual {
// verify the access permission
require(isSenderInRole(ROLE_URI_MANAGER), "access denied");
// we do not verify token existence: we want to be able to
// preallocate token URIs before tokens are actually minted
// emit an even... | function setTokenURI(uint256 _tokenId, string memory _tokenURI) public virtual {
// verify the access permission
require(isSenderInRole(ROLE_URI_MANAGER), "access denied");
// we do not verify token existence: we want to be able to
// preallocate token URIs before tokens are actually minted
// emit an even... | 37,005 |
2 | // The address of the implementation contract of which this instance is a clone | function IMPLEMENTATION() external pure returns (address);
| function IMPLEMENTATION() external pure returns (address);
| 28,827 |
49 | // This contract should never have value in it, but just incase since this is a public call | uint _before = IERC20(_token).balanceOf(address(this));
Strategy(_strategy).withdraw(_token);
uint _after = IERC20(_token).balanceOf(address(this));
if (_after > _before) {
uint _amount = _after.sub(_before);
address _want = Strategy(_strategy).want();
... | uint _before = IERC20(_token).balanceOf(address(this));
Strategy(_strategy).withdraw(_token);
uint _after = IERC20(_token).balanceOf(address(this));
if (_after > _before) {
uint _amount = _after.sub(_before);
address _want = Strategy(_strategy).want();
... | 29,587 |
14 | // Emitted when deposited / | event Deposited(uint256 _balance);
| event Deposited(uint256 _balance);
| 15,308 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.