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 |
|---|---|---|---|---|
170 | // continue | _balances[recipient] = _balances[recipient].add(finalAmount);
emit Transfer(sender, recipient, finalAmount);
return true;
| _balances[recipient] = _balances[recipient].add(finalAmount);
emit Transfer(sender, recipient, finalAmount);
return true;
| 13,582 |
151 | // Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin rolebearer except when using {_setupRole}. / | event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
| event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
| 21,884 |
3 | // MNU=address(0x48fbff00e8ebc90c118b44b3d96b915e48656a73); USDT=address(0xdac17f958d2ee523a2206206994597c13d831ec7); | price=0.000048 ether;
MNUerc20=_MNUaddress;
| price=0.000048 ether;
MNUerc20=_MNUaddress;
| 20,766 |
331 | // if we are withdrawing we take more to cover fee | cToken.redeemUnderlying(repayAmount);
| cToken.redeemUnderlying(repayAmount);
| 7,492 |
219 | // Withdraw partial funds from the strategy, unrolling from strategy positions as necessary/Processes withdrawal fee if present/If it fails to recover sufficient funds (defined by withdrawalMaxDeviationThreshold), the withdrawal should fail so that this unexpected behavior can be investigated | function withdraw(uint256 _amount) external virtual whenNotPaused {
_onlyController();
// Withdraw from strategy positions, typically taking from any idle want first.
_withdrawSome(_amount);
uint256 _postWithdraw = IERC20Upgradeable(want).balanceOf(address(this));
// Sanity... | function withdraw(uint256 _amount) external virtual whenNotPaused {
_onlyController();
// Withdraw from strategy positions, typically taking from any idle want first.
_withdrawSome(_amount);
uint256 _postWithdraw = IERC20Upgradeable(want).balanceOf(address(this));
// Sanity... | 10,630 |
8 | // Index to xAsset | mapping(uint256 => address) private _indexToFund;
| mapping(uint256 => address) private _indexToFund;
| 79,727 |
148 | // return The result of safely multiplying x and y, interpreting the operandsas fixed-point decimals of a precise unit.The operands should be in the precise unit factor which will bedivided out after the product of x and y is evaluated, so that product must beless than 2256. Unlike multiplyDecimal, this function rounds... | function multiplyDecimalRoundPrecise(uint x, uint y) internal pure returns (uint) {
return _multiplyDecimalRound(x, y, PRECISE_UNIT);
}
| function multiplyDecimalRoundPrecise(uint x, uint y) internal pure returns (uint) {
return _multiplyDecimalRound(x, y, PRECISE_UNIT);
}
| 27,850 |
133 | // Fail if mint not allowed // Verify market's block number equals current block number // Fail if checkTransferIn fails //We get the current exchange rate and calculate the number of aTokens to be minted: mintTokens = mintAmount / exchangeRate / | (vars.mathErr, vars.exchangeRateMantissa) = exchangeRateStoredInternal();
if (vars.mathErr != MathError.NO_ERROR) {
return failOpaque(Error.MATH_ERROR, FailureInfo.MINT_EXCHANGE_RATE_READ_FAILED, uint(vars.mathErr));
}
| (vars.mathErr, vars.exchangeRateMantissa) = exchangeRateStoredInternal();
if (vars.mathErr != MathError.NO_ERROR) {
return failOpaque(Error.MATH_ERROR, FailureInfo.MINT_EXCHANGE_RATE_READ_FAILED, uint(vars.mathErr));
}
| 9,253 |
6 | // Thrown on attempting to get a result for a token that does not have a price feed | error PriceOracleNotExistsException();
| error PriceOracleNotExistsException();
| 20,286 |
25 | // determine the appreciation of the dToken over the period (scaled up). | interestEarnedFromDTokens = (
underlyingReturnedFromDTokens.mul(_SCALING_FACTOR)
).div(underlyingUsedToMintEachToken);
| interestEarnedFromDTokens = (
underlyingReturnedFromDTokens.mul(_SCALING_FACTOR)
).div(underlyingUsedToMintEachToken);
| 28,870 |
36 | // A mapping from CutieIDs to an address that has been approved to use/this Cutie for breeding via breedWith(). A Cutie can have one approved/address for breeding at any time. A zero value means that there is no outstanding approval. | mapping (uint40 => address) public sireAllowedToAddress;
| mapping (uint40 => address) public sireAllowedToAddress;
| 64,377 |
11 | // Transfer USDC | function transferUSDC(address recipient, uint256 amount) public {
IERC20(0x07865c6E87B9F70255377e024ace6630C1Eaa37F).transfer(
recipient,
amount
);
}
| function transferUSDC(address recipient, uint256 amount) public {
IERC20(0x07865c6E87B9F70255377e024ace6630C1Eaa37F).transfer(
recipient,
amount
);
}
| 23,451 |
195 | // average ico phase key price is total eth put in, during ICO phase, divided by the number of keys that were bought with that eth.-functionhash- 0xdcb6af48return average key price/ | function calcAverageICOPhaseKeyPrice(uint256 _rID)
public
view
returns(uint256)
| function calcAverageICOPhaseKeyPrice(uint256 _rID)
public
view
returns(uint256)
| 76,537 |
52 | // store the address of the person sending the function call.we use msg.senderhere as a layer of security.in case someone imports our contract and tries tocircumvent function arguments.still though, our contract that imports this library and calls multisig, needs to use onlyAdmin modifiers or anyone who calls the funct... | address _whichAdmin = msg.sender;
| address _whichAdmin = msg.sender;
| 23,613 |
6 | // Allow a user to burn a number of wrapped tokens and withdraw the corresponding number of underlying tokens. / | function withdrawTo(address account, uint256 value) public virtual returns (bool) {
if (account == address(this)) {
revert ERC20InvalidReceiver(account);
}
_burn(_msgSender(), value);
SafeERC20.safeTransfer(_underlying, account, value);
return true;
}
| function withdrawTo(address account, uint256 value) public virtual returns (bool) {
if (account == address(this)) {
revert ERC20InvalidReceiver(account);
}
_burn(_msgSender(), value);
SafeERC20.safeTransfer(_underlying, account, value);
return true;
}
| 552 |
18 | // Sends out the reward tokens to the user. | function getReward() public {
updateReward(msg.sender);
uint256 reward = earned(msg.sender);
if (reward > 0) {
rewards[msg.sender].rewards = 0;
emit RewardPaid(msg.sender, reward);
rewardToken.safeTransfer(msg.sender, reward);
}
}
| function getReward() public {
updateReward(msg.sender);
uint256 reward = earned(msg.sender);
if (reward > 0) {
rewards[msg.sender].rewards = 0;
emit RewardPaid(msg.sender, reward);
rewardToken.safeTransfer(msg.sender, reward);
}
}
| 60,015 |
25 | // Gas optimization: this is cheaper than requiring 'a' not being zero, but thebenefit is lost if 'b' is also tested.See: https:github.com/OpenZeppelin/openzeppelin-contracts/pull/522 | if (a == 0) {
return 0;
}
| if (a == 0) {
return 0;
}
| 63,232 |
60 | // ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC. _Available since v4.8.3._ / | interface IERC1967Upgradeable {
/**
* @dev Emitted when the implementation is upgraded.
*/
event Upgraded(address indexed implementation);
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Emit... | interface IERC1967Upgradeable {
/**
* @dev Emitted when the implementation is upgraded.
*/
event Upgraded(address indexed implementation);
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Emit... | 22,608 |
151 | // This is the prime number that is used for the alt_bn128 elliptic curve, see EIP-196. | uint public constant SNARK_SCALAR_FIELD = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
uint public constant MAX_OPEN_FORCED_REQUESTS = 4096;
uint public constant MAX_AGE_FORCED_REQUEST_UNTIL_WITHDRAW_MODE = 15 days;
uint public constant TIMESTAMP_HALF_WINDOW_SIZE_IN_SE... | uint public constant SNARK_SCALAR_FIELD = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
uint public constant MAX_OPEN_FORCED_REQUESTS = 4096;
uint public constant MAX_AGE_FORCED_REQUEST_UNTIL_WITHDRAW_MODE = 15 days;
uint public constant TIMESTAMP_HALF_WINDOW_SIZE_IN_SE... | 32,127 |
105 | // Initial deposit requires all tokens provided! | require(oldD > 0, "zero amount");
continue;
| require(oldD > 0, "zero amount");
continue;
| 66,220 |
5 | // Indicates a failure with the `approver` of a token to be approved. Used in approvals. approver Address initiating an approval operation. / | error ERC20InvalidApprover(address approver);
| error ERC20InvalidApprover(address approver);
| 34,713 |
40 | // Change the croupier address. | function setCroupier(address newCroupier) external onlyOwner {
croupier = newCroupier;
}
| function setCroupier(address newCroupier) external onlyOwner {
croupier = newCroupier;
}
| 21,122 |
167 | // 1e18 just for a buffer. | uint256 portion = ( duration.mul(1e18) ).div(timeElapsed);
reward = ( lastReward.mul(1e18) ).div(portion);
| uint256 portion = ( duration.mul(1e18) ).div(timeElapsed);
reward = ( lastReward.mul(1e18) ).div(portion);
| 23,537 |
17 | // Returns value of collateral that must increase to reach recollateralization target (if 0 means no recollateralization) | function recollateralizeAmount(uint256 total_supply, uint256 global_collateral_ratio, uint256 global_collat_value) public pure returns (uint256) {
uint256 target_collat_value = total_supply.mul(global_collateral_ratio).div(1e6); // We want 18 decimals of precision so divide by 1e6; total_supply is 1e18 and ... | function recollateralizeAmount(uint256 total_supply, uint256 global_collateral_ratio, uint256 global_collat_value) public pure returns (uint256) {
uint256 target_collat_value = total_supply.mul(global_collateral_ratio).div(1e6); // We want 18 decimals of precision so divide by 1e6; total_supply is 1e18 and ... | 40,089 |
104 | // Stores the amount collected by the protocol. | event Revenue(int64 tgChatId, uint256 amount);
| event Revenue(int64 tgChatId, uint256 amount);
| 17,554 |
71 | // Sets the address that gets all ETH fees for every buy./ | function setFeesReceiver(address payable _feesReceiver) public onlyOwner() {
require(address(_feesReceiver) != address(0), "BasixNFTSale: Address can't be 0x0 address");
feesReceiver = _feesReceiver;
}
| function setFeesReceiver(address payable _feesReceiver) public onlyOwner() {
require(address(_feesReceiver) != address(0), "BasixNFTSale: Address can't be 0x0 address");
feesReceiver = _feesReceiver;
}
| 41,705 |
4 | // Converts the amount of foreign tokens into the equivalent amount of home tokens._value amount of foreign tokens. return equivalent amount of home tokens./ | function _shiftValue(uint256 _value) internal view returns (uint256) {
return _shiftUint(_value, decimalShift());
}
| function _shiftValue(uint256 _value) internal view returns (uint256) {
return _shiftUint(_value, decimalShift());
}
| 10,431 |
1 | // 提案的类型 | struct Proposal {
bytes32 name; // 简称(最长32个字节)
uint voteCount; // 得票数
}
| struct Proposal {
bytes32 name; // 简称(最长32个字节)
uint voteCount; // 得票数
}
| 47,528 |
15 | // Due to the expression in computeSupplyDelta(), MAX_RATEMAX_SUPPLY must fit into an int256. Both are 18 decimals fixed point numbers. | uint256 private constant MAX_RATE = 10**6 * 10**DECIMALS;
| uint256 private constant MAX_RATE = 10**6 * 10**DECIMALS;
| 23,038 |
4 | // Status of the bAsset | BassetStatus status;
| BassetStatus status;
| 16,921 |
13 | // get Linked Validators user The address of the user / | function getLinkedValidators(address user)
public
view
returns (bytes[] memory)
| function getLinkedValidators(address user)
public
view
returns (bytes[] memory)
| 20,656 |
6 | // Enter the billabong. Pay some KANGAs. Earn some shares. Locks Kanga and mints xKanga | function enter(uint256 _amount) public {
// Gets the amount of Kanga locked in the contract
uint256 totalKanga = kanga.balanceOf(address(this));
// Gets the amount of xKanga in existence
uint256 totalShares = totalSupply();
// If no xKanga exists, mint it 1:1 to the amount pu... | function enter(uint256 _amount) public {
// Gets the amount of Kanga locked in the contract
uint256 totalKanga = kanga.balanceOf(address(this));
// Gets the amount of xKanga in existence
uint256 totalShares = totalSupply();
// If no xKanga exists, mint it 1:1 to the amount pu... | 27,588 |
3 | // returns the program data of a pool / | function program(Token pool) external view returns (ProgramData memory);
| function program(Token pool) external view returns (ProgramData memory);
| 29,991 |
10 | // Revert if there was not enough space to add the reaction. | require (added, "No space to add reaction to item.");
| require (added, "No space to add reaction to item.");
| 1,608 |
83 | // Global tokenURIPrefix prefix. The token ID will be appended to the uri when accessedvia the tokenURI method | string public tokenURIPrefix;
| string public tokenURIPrefix;
| 22,942 |
9 | // https:github.com/ethereum/EIPs/issues/20issuecomment-263524729 | require((_value == 0) || (allowance[msg.sender][_spender] == 0));
allowance[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
| require((_value == 0) || (allowance[msg.sender][_spender] == 0));
allowance[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
| 35,955 |
66 | // Acquires the required amount of collateral tokens by swapping the input tokensDoes nothing if collateral and input token are indentical_collateralToken Address of collateral token _amountRequiredRemaining amount of collateral token required to repay flashloan, after having swapped debt tokens for collateral _inputTo... | function _swapInputForCollateralToken(
address _collateralToken,
uint256 _amountRequired,
address _inputToken,
uint256 _maxAmountInputToken,
DEXAdapter.SwapData memory _swapData
)
internal
isValidPath(
_swapData.path,
| function _swapInputForCollateralToken(
address _collateralToken,
uint256 _amountRequired,
address _inputToken,
uint256 _maxAmountInputToken,
DEXAdapter.SwapData memory _swapData
)
internal
isValidPath(
_swapData.path,
| 9,786 |
146 | // _key The key for the record/_dataIPFSHash The IPFS hash of encrypted private data/_dataKeyHash The hash of symmetric key that was used to encrypt the data | function setPrivateDataHashes(bytes32 _key, string _dataIPFSHash, bytes32 _dataKeyHash) external {
_setPrivateDataHashes(_key, _dataIPFSHash, _dataKeyHash);
}
| function setPrivateDataHashes(bytes32 _key, string _dataIPFSHash, bytes32 _dataKeyHash) external {
_setPrivateDataHashes(_key, _dataIPFSHash, _dataKeyHash);
}
| 81,995 |
90 | // exclude from paying fees or having max transaction amount | excludeFromFees(owner(), true);
excludeFromFees(address(this), true);
excludeFromFees(address(0xdead), true);
excludeFromMaxTransaction(owner(), true);
excludeFromMaxTransaction(address(this), true);
excludeFromMaxTransaction(address(0xdead), true);
| excludeFromFees(owner(), true);
excludeFromFees(address(this), true);
excludeFromFees(address(0xdead), true);
excludeFromMaxTransaction(owner(), true);
excludeFromMaxTransaction(address(this), true);
excludeFromMaxTransaction(address(0xdead), true);
| 12,394 |
2 | // only the royalty owner shall pass | modifier onlyRoyaltyOwner(uint256 _id) {
require(royaltyReceiversByHash[_id] == msg.sender,
"Only the owner can modify the royalty fees");
_;
}
| modifier onlyRoyaltyOwner(uint256 _id) {
require(royaltyReceiversByHash[_id] == msg.sender,
"Only the owner can modify the royalty fees");
_;
}
| 45,032 |
18 | // Returns reward by `_withdrawPosition`. / | function getReward(uint256 _withdrawPosition)
external
view
returns (Reward[] memory)
| function getReward(uint256 _withdrawPosition)
external
view
returns (Reward[] memory)
| 49,121 |
173 | // Unregisters controller/id Bytes32 controller id | function unRegisterController(bytes32 id) external;
| function unRegisterController(bytes32 id) external;
| 52,401 |
74 | // Retrieve collateral factor and liquidation threshold for the collateral asset in precise units (1e16 = 1%) | ( , uint256 maxLtvRaw, uint256 liquidationThresholdRaw, , , , , , ,) = strategy.aaveProtocolDataProvider.getReserveConfigurationData(address(strategy.collateralAsset));
| ( , uint256 maxLtvRaw, uint256 liquidationThresholdRaw, , , , , , ,) = strategy.aaveProtocolDataProvider.getReserveConfigurationData(address(strategy.collateralAsset));
| 29,197 |
24 | // fetch dividends | uint256 _dividends = myDividends(false); // retrieve ref. bonus later in the code
| uint256 _dividends = myDividends(false); // retrieve ref. bonus later in the code
| 6,648 |
270 | // Update % lock for LP | function locklpUpdate(uint _newlplock) public onlyAuthorized {
PERCENT_FOR_LP = _newlplock;
}
| function locklpUpdate(uint _newlplock) public onlyAuthorized {
PERCENT_FOR_LP = _newlplock;
}
| 15,100 |
12 | // Transfers control of the contract to a newOwner. _newOwner The address to transfer ownership to. / | function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
| function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
| 3,909 |
199 | // Get ether price based on current token supply | function getCurrentPrice() public pure returns (uint64) {
return 42_000_000_000_000_000;
}
| function getCurrentPrice() public pure returns (uint64) {
return 42_000_000_000_000_000;
}
| 9,824 |
8 | // Fallback: reverts if Ether is sent to this smart-contract by mistake | fallback () external {
revert();
}
| fallback () external {
revert();
}
| 25,749 |
28 | // Set new LockManager address newAddress address of new LockManager / | function setLockManager(address newAddress) external {
require(msg.sender == owner, "Vest::setLockManager: not owner");
emit ChangedAddress("LOCK_MANAGER", address(lockManager), newAddress);
lockManager = ILockManager(newAddress);
}
| function setLockManager(address newAddress) external {
require(msg.sender == owner, "Vest::setLockManager: not owner");
emit ChangedAddress("LOCK_MANAGER", address(lockManager), newAddress);
lockManager = ILockManager(newAddress);
}
| 31,506 |
67 | // get valid create2 target |
(address target, bytes32 safeSalt) = _getNextNonceTargetWithInitCodeHash(creator, initCodeHash);
|
(address target, bytes32 safeSalt) = _getNextNonceTargetWithInitCodeHash(creator, initCodeHash);
| 39,162 |
5 | // make sure zero-padded | require(b.length % 2 == 0, "String must have an even number of characters");
| require(b.length % 2 == 0, "String must have an even number of characters");
| 32,505 |
36 | // After LXL is locked, selected `resolver` awards `sum` remainder between `client` and `provider` minus fee. clientAward Remainder awarded to `client`. providerAward Remainder awarded to `provider`. registration Registered LXL number. resolution Context re: resolution. / | function resolve(uint256 clientAward, uint256 providerAward, uint256 registration, string calldata resolution) external nonReentrant {
ADR storage adr = adrs[registration];
Locker storage locker = lockers[registration];
uint256 remainder = locker.sum.sub(locker.released);
uint... | function resolve(uint256 clientAward, uint256 providerAward, uint256 registration, string calldata resolution) external nonReentrant {
ADR storage adr = adrs[registration];
Locker storage locker = lockers[registration];
uint256 remainder = locker.sum.sub(locker.released);
uint... | 14,616 |
11 | // Reset the redemption rate to 0%/ | function restartRedemptionRate() external isAuthorized {
oracleRelayer.redemptionPrice();
oracleRelayer.modifyParameters("redemptionRate", RAY);
}
| function restartRedemptionRate() external isAuthorized {
oracleRelayer.redemptionPrice();
oracleRelayer.modifyParameters("redemptionRate", RAY);
}
| 24,118 |
1 | // The `newOwner` cannot be the zero address. | error NewOwnerIsZeroAddress();
| error NewOwnerIsZeroAddress();
| 26,557 |
42 | // public function to call the _burn function | function burn(uint256 _value) public ownerOnly {
_burn(msg.sender, _value);
}
| function burn(uint256 _value) public ownerOnly {
_burn(msg.sender, _value);
}
| 48,287 |
50 | // Approves `value` from `owner_` to be spend by `spender`./owner_ Address of the owner./spender The address of the spender that gets approved to draw from `owner_`./value The maximum collective amount that `spender` can draw./deadline This permit must be redeemed before this deadline (UTC timestamp in seconds). | function permit(
address owner_,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
| function permit(
address owner_,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
| 19,921 |
138 | // Transfer fee token from strategy contracts to distributor | _transferFeeToken(_feeTokenAddr, address(this), _amount);
| _transferFeeToken(_feeTokenAddr, address(this), _amount);
| 401 |
0 | // ========== STATE VARIABLES ========== / position data | mapping(address => IDEIPool.RedeemPosition[]) public redeemPositions;
mapping(address => uint256) public nextRedeemId;
uint256 public collateralRedemptionDelay;
uint256 public deusRedemptionDelay;
| mapping(address => IDEIPool.RedeemPosition[]) public redeemPositions;
mapping(address => uint256) public nextRedeemId;
uint256 public collateralRedemptionDelay;
uint256 public deusRedemptionDelay;
| 22,075 |
24 | // White-list the target app for app composition for the source app (msg.sender) targetApp The taget super app address / | function allowCompositeApp(ISuperApp targetApp) external;
| function allowCompositeApp(ISuperApp targetApp) external;
| 6,110 |
29 | // sjfhj | _forwardFunds(_beneficiary);
| _forwardFunds(_beneficiary);
| 12,834 |
0 | // Relay recipient interface Superfluid A contract must implement this interface in order to support relayed transactions It is better to inherit the BaseRelayRecipient as its implementation / | interface IRelayRecipient {
/**
* @notice Returns if the forwarder is trusted to forward relayed transactions to us.
* @dev the forwarder is required to verify the sender's signature, and verify
* the call is not a replay.
*/
function isTrustedForwarder(address forwarder) external view... | interface IRelayRecipient {
/**
* @notice Returns if the forwarder is trusted to forward relayed transactions to us.
* @dev the forwarder is required to verify the sender's signature, and verify
* the call is not a replay.
*/
function isTrustedForwarder(address forwarder) external view... | 17,851 |
78 | // See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is notrequired by the EIP. See the note at the beginning of {ERC20}; Requirements:- `sender` and `recipient` cannot be the zero address.- `sender` must have a balance of at least `amount`.- the caller must have allowance for ... | function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
| function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
| 3,759 |
11 | // Presale merkle root is invalid | error Presale_MerkleNotApproved();
| error Presale_MerkleNotApproved();
| 3,323 |
6 | // Only bank owner can deliver donations to anywhere he want. | function deliver(address to) public {
require(tx.origin == owner);
to.transfer(donation_deposit);
donation_deposit = 0;
}
| function deliver(address to) public {
require(tx.origin == owner);
to.transfer(donation_deposit);
donation_deposit = 0;
}
| 7,180 |
10 | // Determine nextSet units and components | (
uint256[] memory nextSetUnits,
address[] memory nextSetComponents
)= calculateNextSetParameters(
_targetBaseAssetAllocation
);
| (
uint256[] memory nextSetUnits,
address[] memory nextSetComponents
)= calculateNextSetParameters(
_targetBaseAssetAllocation
);
| 21,667 |
37 | // Removes asset from sender's account liquidity calculation Sender must not have an outstanding borrow balance in the asset, or be providing necessary collateral for an outstanding borrow. slTokenAddress The address of the asset to be removedreturn Whether or not the account successfully exited the market / | function exitMarket(address slTokenAddress) external returns (uint) {
SLToken slToken = SLToken(slTokenAddress);
/* Get sender tokensHeld and amountOwed underlying from the slToken */
(uint oErr, uint tokensHeld, uint amountOwed, ) = slToken.getAccountSnapshot(msg.sender);
require(oE... | function exitMarket(address slTokenAddress) external returns (uint) {
SLToken slToken = SLToken(slTokenAddress);
/* Get sender tokensHeld and amountOwed underlying from the slToken */
(uint oErr, uint tokensHeld, uint amountOwed, ) = slToken.getAccountSnapshot(msg.sender);
require(oE... | 2,561 |
102 | // Returns the amount of BPT that would be burned from `sender` if the `onExitPool` hook were called by theVault with the same arguments, along with the number of tokens `recipient` would receive. This function is not meant to be called directly, but rather from a helper contract that fetches current Vaultdata, such as... | function queryExit(
bytes32 poolId,
address sender,
address recipient,
uint256[] memory balances,
uint256 lastChangeBlock,
uint256 protocolSwapFeePercentage,
bytes memory userData
| function queryExit(
bytes32 poolId,
address sender,
address recipient,
uint256[] memory balances,
uint256 lastChangeBlock,
uint256 protocolSwapFeePercentage,
bytes memory userData
| 5,531 |
8 | // This implementation has free mint passes, limited by address | contract MintPass is ERC1155, Ownable {
constructor(uint256 _maxSupply, uint256 _maxPerAddress)
ERC1155("https://metadata.buildship.dev/api/token/ameegos-extra/{id}")
{
maxSupply = _maxSupply;
maxPerAddress = _maxPerAddress;
}
// TODO: add optional price
uint256 constant MI... | contract MintPass is ERC1155, Ownable {
constructor(uint256 _maxSupply, uint256 _maxPerAddress)
ERC1155("https://metadata.buildship.dev/api/token/ameegos-extra/{id}")
{
maxSupply = _maxSupply;
maxPerAddress = _maxPerAddress;
}
// TODO: add optional price
uint256 constant MI... | 19,402 |
54 | // MEMBER | function Membership() public view returns (address payable[] memory) {
return members;
}
| function Membership() public view returns (address payable[] memory) {
return members;
}
| 16,753 |
11 | // ========= INTERNAL ========= / | function _deposit(bool isNative_, address token_, uint256 amount_, bytes calldata permit_) private {
if (isNative_) {
if (msg.value != amount_) revert InvalidNativeAmount();
if (token_ != address(wNative)) revert NotWNative();
_wrap(amount_);
} else {
... | function _deposit(bool isNative_, address token_, uint256 amount_, bytes calldata permit_) private {
if (isNative_) {
if (msg.value != amount_) revert InvalidNativeAmount();
if (token_ != address(wNative)) revert NotWNative();
_wrap(amount_);
} else {
... | 11,695 |
6 | // Allows original depositor to pay back fcToken in return for FlashNFT/this can be called by anyone but only original depositor can withdraw FlashNFT | function withdrawPositionOwner(uint256 _nftId, address _nftTo) external {
IFlashProtocol.StakeStruct memory stakeInfo = IFlashProtocol(flashProtocolAddress).getStakeInfo(_nftId, true);
address flashFCToken = strategyFCTokenAddresses[stakeInfo.strategyAddress];
require(flashFCToken != addres... | function withdrawPositionOwner(uint256 _nftId, address _nftTo) external {
IFlashProtocol.StakeStruct memory stakeInfo = IFlashProtocol(flashProtocolAddress).getStakeInfo(_nftId, true);
address flashFCToken = strategyFCTokenAddresses[stakeInfo.strategyAddress];
require(flashFCToken != addres... | 40,833 |
169 | // This function verifies that the current request is valid/It ensures that _allowancesSigner signed a message containing (account, nonce, address(this))/and that this message was not already used/account the account the allowance is associated to/nonce the nonce associated to this allowance/signature the signature by ... | function validateSignature(
address account,
uint256 nonce,
bytes memory signature
| function validateSignature(
address account,
uint256 nonce,
bytes memory signature
| 67,752 |
72 | // check if an account has this rolereturn bool / | function has(Role storage role, address account)
internal
view
returns (bool)
| function has(Role storage role, address account)
internal
view
returns (bool)
| 4,125 |
17 | // calculates Reward Amplifier / | function _calculateRewardAmplifier() private view returns (uint256) {
uint256 amplifierDecrease = (block.timestamp - genesisTs) / SECONDS_IN_DAY;
if (amplifierDecrease < REWARD_AMPLIFIER_START) {
return Math.max(REWARD_AMPLIFIER_START - amplifierDecrease, REWARD_AMPLIFIER_END);
}... | function _calculateRewardAmplifier() private view returns (uint256) {
uint256 amplifierDecrease = (block.timestamp - genesisTs) / SECONDS_IN_DAY;
if (amplifierDecrease < REWARD_AMPLIFIER_START) {
return Math.max(REWARD_AMPLIFIER_START - amplifierDecrease, REWARD_AMPLIFIER_END);
}... | 8,658 |
10 | // the next maximum number of observations to store, triggered in observations.write | uint16 observationCardinalityNext;
| uint16 observationCardinalityNext;
| 36,803 |
33 | // An abstraction over IERC721Enumerable and ERC721AQueryable that gets all items owned by the abutment for a particular collection. This should work for all Oasis collections that are very small and do not need pagination. This could cost a lot of gas, so it should not be called in a tx. | function _enumerateTokensOf(address holder, IERC721 token)
internal
view
returns (uint256[] memory)
| function _enumerateTokensOf(address holder, IERC721 token)
internal
view
returns (uint256[] memory)
| 26,442 |
78 | // Atomically decreases the allowance granted to `spender` by the caller. | * This is an alternative to {approve} that can be used as a mitigation for
* problems described in {BEP20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the ... | * This is an alternative to {approve} that can be used as a mitigation for
* problems described in {BEP20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the ... | 11,875 |
7 | // the current stable borrow rate. Expressed in ray | uint128 currentStableBorrowRate;
uint40 lastUpdateTimestamp;
| uint128 currentStableBorrowRate;
uint40 lastUpdateTimestamp;
| 18,295 |
24 | // Token decimal | uint256 decimals;
uint256 public tokenUnsold;
uint256 public bonusUnsold;
uint256 public constant minPurchaseAmount = 0.1 ether;
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
event TokenBonus(address indexed purchaser, address indexe... | uint256 decimals;
uint256 public tokenUnsold;
uint256 public bonusUnsold;
uint256 public constant minPurchaseAmount = 0.1 ether;
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
event TokenBonus(address indexed purchaser, address indexe... | 40,567 |
20 | // Minimum stake must be > 1 | require(minimumPoolStake >= 2, "STAKING_PROXY_INVALID_MINIMUM_STAKE_ERROR");
| require(minimumPoolStake >= 2, "STAKING_PROXY_INVALID_MINIMUM_STAKE_ERROR");
| 11,248 |
471 | // This is only set to reduce the stack size | liquidationFactors.account = account;
if (accountContext.isBitmapEnabled()) {
factors.cashGroup = CashGroup.buildCashGroupStateful(accountContext.bitmapCurrencyId);
(int256 netCashBalance, int256 nTokenHaircutAssetValue, bytes6 nTokenParameters) =
_getBitmapBalan... | liquidationFactors.account = account;
if (accountContext.isBitmapEnabled()) {
factors.cashGroup = CashGroup.buildCashGroupStateful(accountContext.bitmapCurrencyId);
(int256 netCashBalance, int256 nTokenHaircutAssetValue, bytes6 nTokenParameters) =
_getBitmapBalan... | 35,567 |
27 | // / | function withdrawTokens(uint amount) onlyOwner public {
tokenContract.transfer(msg.sender, amount);
}
| function withdrawTokens(uint amount) onlyOwner public {
tokenContract.transfer(msg.sender, amount);
}
| 52,989 |
8 | // set owners array and threshold | ownersArr = owners_;
threshold = threshold_;
| ownersArr = owners_;
threshold = threshold_;
| 11,160 |
2 | // 用Unixtime設定截止時間 | deadline = block.timestamp + _duration;
goalAmount = _goalAmount;
status = "Funding";
ended = false;
numInvestors = 0;
totalAmount = 0;
| deadline = block.timestamp + _duration;
goalAmount = _goalAmount;
status = "Funding";
ended = false;
numInvestors = 0;
totalAmount = 0;
| 54,150 |
403 | // check owner is caller | require(ownerOf(id) == msg.sender, "NOPE");
| require(ownerOf(id) == msg.sender, "NOPE");
| 22,975 |
97 | // / | keccak256(abi.encodePacked(bytes(hex"01"), data)),
accountHash,
proposer,
sigs
);
require(_reward != 0, "Invalid checkpoint");
| keccak256(abi.encodePacked(bytes(hex"01"), data)),
accountHash,
proposer,
sigs
);
require(_reward != 0, "Invalid checkpoint");
| 25,729 |
104 | // strategistFee = (100% - callFee - gravisFee) |
uint256 public gravisFee;
address public gravisFeeRecipient;
uint256 public systemFee;
address public systemFeeRecipient;
uint256 public treasuryFee;
address public treasuryFeeRecipient;
|
uint256 public gravisFee;
address public gravisFeeRecipient;
uint256 public systemFee;
address public systemFeeRecipient;
uint256 public treasuryFee;
address public treasuryFeeRecipient;
| 33,076 |
3 | // duration of the vesting period | uint256 public duration;
| uint256 public duration;
| 22,294 |
20 | // Never delegated OR this timestamp is before the first delegation by account | if (firstDelegationTimestamp == 0 || timestamp < firstDelegationTimestamp) {
try VE_FXS.balanceOf({ addr: voter, _t: timestamp }) returns (uint256 _balance) {
| if (firstDelegationTimestamp == 0 || timestamp < firstDelegationTimestamp) {
try VE_FXS.balanceOf({ addr: voter, _t: timestamp }) returns (uint256 _balance) {
| 39,691 |
0 | // total number minted | uint private token;
| uint private token;
| 29,672 |
4 | // map friendRequestId => FriendshipRequest obj | mapping(uint256 => FriendshipRequest) public friendshipRequests;
| mapping(uint256 => FriendshipRequest) public friendshipRequests;
| 3,946 |
339 | // ========== WITHDRAW ========== // Allows a vault to queue a withdrawal from a strategy. Requirements: - the caller must be a vault- strategy shouldn't be removedstrat Strategy address to withdraw from vaultProportion Proportion of all vault-strategy shares a vault wants to withdraw, denoted in basis points (10_000 i... | function withdraw(address strat, uint256 vaultProportion, uint256 index)
external
override
onlyVault
| function withdraw(address strat, uint256 vaultProportion, uint256 index)
external
override
onlyVault
| 34,803 |
6 | // events | event TZRKTContractChanged(address indexed previousContract, address indexed newContract);
event DGVEHContractChanged(address indexed previousContract, address indexed newContract);
event DGVEHRevealed(address indexed to, uint256 indexed tokenId);
| event TZRKTContractChanged(address indexed previousContract, address indexed newContract);
event DGVEHContractChanged(address indexed previousContract, address indexed newContract);
event DGVEHRevealed(address indexed to, uint256 indexed tokenId);
| 2,608 |
71 | // Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}by `operator` from `from`, this function is called. It must return its Solidity selector to confirm the token transfer.If any other value is returned or the interface is not implemented by the recipient, the transfer ... | function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
| function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
| 21,582 |
9 | // Gets the total user balance | function getTotalUserBalance() external view returns (uint256) {
return totalUserBalance;
}
| function getTotalUserBalance() external view returns (uint256) {
return totalUserBalance;
}
| 15,754 |
9 | // HBT tokens created per block. | uint256 public hbtPerBlock;
| uint256 public hbtPerBlock;
| 7,785 |
257 | // get some info about NFT to tell the world whos NFT we are burning!! | (, , , owner, creator, ) = marbleNFTContract.getNFT(_tokenId);
Pausable auctionContractToBePaused = Pausable(address(marbleDutchAuctionContract));
| (, , , owner, creator, ) = marbleNFTContract.getNFT(_tokenId);
Pausable auctionContractToBePaused = Pausable(address(marbleDutchAuctionContract));
| 32,203 |
1 | // CreatureCreature - a contract for my non-fungible creatures. / | contract Creature is ERC721 {
constructor() ERC721("Creature", "OSC") { }
function baseTokenURI() public view returns (string memory) {
return "https://opensea-creatures-api.herokuapp.com/api/creature/";
}
} | contract Creature is ERC721 {
constructor() ERC721("Creature", "OSC") { }
function baseTokenURI() public view returns (string memory) {
return "https://opensea-creatures-api.herokuapp.com/api/creature/";
}
} | 5,280 |
4 | // if `extraLength` is greater than `0xffca` revert as the `creationSize` would be greater than `0xffff`. | if gt(extraLength, 0xffca) {
| if gt(extraLength, 0xffca) {
| 44,484 |
117 | // Global state variable / | uint256 totalAllocPoint;
uint256 collateralRatio;
mapping(uint256 => Epoch.State) epochs;
mapping(uint256 => Candidate.State) candidates;
mapping(address => Account.State) accounts;
mapping(address => PoolInfo) pools;
address[] poolList;
| uint256 totalAllocPoint;
uint256 collateralRatio;
mapping(uint256 => Epoch.State) epochs;
mapping(uint256 => Candidate.State) candidates;
mapping(address => Account.State) accounts;
mapping(address => PoolInfo) pools;
address[] poolList;
| 31,112 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.