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 |
|---|---|---|---|---|
43 | // Emit event to the logs so can be effectively used later | emit CowsArrived(master, cows);
| emit CowsArrived(master, cows);
| 57,695 |
21 | // calculates number of FFEIF received given X eth _curEth current amount of eth in contract _newEth eth being spentreturn amount of ticket purchased / | function keysRec(uint256 _curEth, uint256 _newEth)
internal
view
returns (uint256)
| function keysRec(uint256 _curEth, uint256 _newEth)
internal
view
returns (uint256)
| 32,209 |
11 | // Compute the cost of arbitration. It is recommended not to increase it often, as it can be highly time and gas consuming for the arbitrated contracts to cope with fee augmentation._extraData Can be used to give additional info on the dispute to be created. return fee Amount to be paid. / | function arbitrationCost(bytes _extraData) public view returns(uint fee);
| function arbitrationCost(bytes _extraData) public view returns(uint fee);
| 42,838 |
46 | // gets the current number of tokens staked for a day lockedTS the timestamp to get the staked tokens for / | function getCurrentStakedUntil(uint256 lockedTS) external view returns (uint96) {
uint32 nCheckpoints = numTotalStakingCheckpoints[lockedTS];
return nCheckpoints > 0 ? totalStakingCheckpoints[lockedTS][nCheckpoints - 1].stake : 0;
}
| function getCurrentStakedUntil(uint256 lockedTS) external view returns (uint96) {
uint32 nCheckpoints = numTotalStakingCheckpoints[lockedTS];
return nCheckpoints > 0 ? totalStakingCheckpoints[lockedTS][nCheckpoints - 1].stake : 0;
}
| 17,037 |
241 | // Transfer asset from this contract to sender./assetData Byte array encoded for the respective asset proxy./amount Amount of asset to transfer to sender. | function transferOut(
bytes memory assetData,
uint256 amount
)
internal
{
assetData.transferFrom(
address(this),
msg.sender,
amount
| function transferOut(
bytes memory assetData,
uint256 amount
)
internal
{
assetData.transferFrom(
address(this),
msg.sender,
amount
| 49,088 |
48 | // Updates LXL management settings. _manager Account that governs LXL contract settings. _swiftResolverToken Token to mark participants in swift resolution. _userRewardToken Token for LXL user rewards. _wETH Standard contract reference to wrap ether._MAX_DURATION Time limit in seconds on token lockup - default 63113904... | function updateLockerSettings(
address _manager,
address _swiftResolverToken,
address _userRewardToken,
address _wETH,
uint256 _MAX_DURATION,
uint256 _resolutionRate,
uint256 _swiftResolverTokenBalance,
uint256 _userReward,
string calldata... | function updateLockerSettings(
address _manager,
address _swiftResolverToken,
address _userRewardToken,
address _wETH,
uint256 _MAX_DURATION,
uint256 _resolutionRate,
uint256 _swiftResolverTokenBalance,
uint256 _userReward,
string calldata... | 64,612 |
0 | // ========== DEPENDENCIES ========== // ====== VARIABLES ====== // ====== STRUCTS ====== / | struct Info {
uint256 rate; // in ten-thousandths ( 5000 = 0.5% )
address recipient;
}
| struct Info {
uint256 rate; // in ten-thousandths ( 5000 = 0.5% )
address recipient;
}
| 47,038 |
9 | // track intt nodes | mapping(bytes32 => bool) public parentNodeActive;
| mapping(bytes32 => bool) public parentNodeActive;
| 12,092 |
64 | // update balances | walletTokenBalance[_tokenAddress][_withdrawalAddress] = walletTokenBalance[_tokenAddress][_withdrawalAddress].add(_amount);
tokenBalance[_tokenAddress] = tokenBalance[_tokenAddress].add(_amount);
_id = depositId++;
lockedToken[_id].tokenAddress = _tokenAddress;
lockedTok... | walletTokenBalance[_tokenAddress][_withdrawalAddress] = walletTokenBalance[_tokenAddress][_withdrawalAddress].add(_amount);
tokenBalance[_tokenAddress] = tokenBalance[_tokenAddress].add(_amount);
_id = depositId++;
lockedToken[_id].tokenAddress = _tokenAddress;
lockedTok... | 51,577 |
2 | // Can only draw after this time. | uint256 public drawTime;
| uint256 public drawTime;
| 7,903 |
56 | // Upgrades a proxy to the newest implementation of a contract and forwards a function call to it.This is useful to initialize the proxied contract. proxy Proxy to be upgraded. implementation Address of the Implementation. data Data to send as msg.data in the low level call.It should include the signature and the param... | function upgradeAndCall(AdminUpgradeabilityProxy proxy, address implementation, bytes memory data) payable public onlyOwner {
proxy.upgradeToAndCall.value(msg.value)(implementation, data);
}
| function upgradeAndCall(AdminUpgradeabilityProxy proxy, address implementation, bytes memory data) payable public onlyOwner {
proxy.upgradeToAndCall.value(msg.value)(implementation, data);
}
| 6,455 |
233 | // Gets the current votes balance for `account` account The address to get votes balancereturn The number of current votes for `account` / | function getCurrentVotes(address account)
external
view
returns (uint256)
| function getCurrentVotes(address account)
external
view
returns (uint256)
| 23,125 |
5 | // Has the user designate a delegate to vote on behalf of them/Delegate can be set to 0 or userAddress for the user to vote on/ their own behalf/delegate Delegate address | function updateDelegate(address delegate)
external
override
| function updateDelegate(address delegate)
external
override
| 8,859 |
163 | // Reverts if the first 32 bytes of the bytes array is not equal to requestId requestId bytes32 data bytes / | modifier validateMultiWordResponseId(
bytes32 requestId,
bytes memory data
| modifier validateMultiWordResponseId(
bytes32 requestId,
bytes memory data
| 52,899 |
284 | // Override parent bind function and disable. / | function bind(
address token,
uint256 balance,
uint256 denorm
| function bind(
address token,
uint256 balance,
uint256 denorm
| 10,722 |
20 | // 通过存入nest来初始化资金池,没存入x个nest,资金池增加x个dcu和x个nest,同时用户得到x个dcu/amount 存入数量 | function deposit(uint amount) external;
| function deposit(uint amount) external;
| 26,773 |
4 | // do bitwise comparison, if i-th bit is turned on, multiply ratio by hardcoded values of sqrt(1.0001^-(2^i))2^128 where 0 <= i <= 19 | uint256 ratio = (absTick & 0x1 != 0)
? 0xfffcb933bd6fad37aa2d162d1a594001
: 0x100000000000000000000000000000000;
if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;
if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;
... | uint256 ratio = (absTick & 0x1 != 0)
? 0xfffcb933bd6fad37aa2d162d1a594001
: 0x100000000000000000000000000000000;
if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;
if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;
... | 26,937 |
179 | // Static call into ERC20.allowance(). Reverts if the call fails for some reason (should never fail)./ | function staticAllowance(ERC20 _token, address _owner, address _spender) internal view returns (uint256) {
bytes memory allowanceCallData = abi.encodeWithSelector(
_token.allowance.selector,
_owner,
_spender
);
(bool success, uint256 allowance) = staticIn... | function staticAllowance(ERC20 _token, address _owner, address _spender) internal view returns (uint256) {
bytes memory allowanceCallData = abi.encodeWithSelector(
_token.allowance.selector,
_owner,
_spender
);
(bool success, uint256 allowance) = staticIn... | 17,595 |
14 | // {_pid} Id of the pool {_amount} Amount to be staked return {bool} Status of stake/ | function stake(uint256 _pid, uint256 _amount) external override returns (bool) {
Pool memory pool = poolInfo[_pid];
IERC20Upgradeable token = IERC20Upgradeable(pool.token);
require(
token.allowance(msg.sender, address(this)) >= _amount,
"Decubate : Set allowance first!"
);
bool succe... | function stake(uint256 _pid, uint256 _amount) external override returns (bool) {
Pool memory pool = poolInfo[_pid];
IERC20Upgradeable token = IERC20Upgradeable(pool.token);
require(
token.allowance(msg.sender, address(this)) >= _amount,
"Decubate : Set allowance first!"
);
bool succe... | 23,015 |
40 | // Handler safely corrects allowance if allowance is insufficient. _token Evaluates allowance of this token. _spender Address gaining allowance. _amount Required allowance amount. / | function _handleAllowance(
IERC20 _token,
address _spender,
uint256 _amount
| function _handleAllowance(
IERC20 _token,
address _spender,
uint256 _amount
| 9,892 |
51 | // Convert rate to 1ETH to token or token to 1 ETH | rate = ((rate * 10**18) / _amount);
| rate = ((rate * 10**18) / _amount);
| 35,173 |
12 | // Try to make flash-loan exploit harder to do by only allowing externally owned addresses. | require(msg.sender == tx.origin, "Jeweler: must use EOA");
_;
| require(msg.sender == tx.origin, "Jeweler: must use EOA");
_;
| 12,993 |
2 | // manage voters and vote state | mapping(address => bool) public voters;
| mapping(address => bool) public voters;
| 31,752 |
0 | // EVENTS //The Birth event is fired whenever a new team comes into existence. | event Birth(uint256 teamId, string name, address owner);
| event Birth(uint256 teamId, string name, address owner);
| 47,372 |
1 | // Lock the Ichi in the contract | IERC20(Ichi).transferFrom(msg.sender, address(this), _amount);
| IERC20(Ichi).transferFrom(msg.sender, address(this), _amount);
| 31,238 |
287 | // Clear the reference to sire from the matron (REQUIRED! Having siringWithId set is what marks a matron as being pregnant.) | delete matron.siringWithId;
| delete matron.siringWithId;
| 41,055 |
273 | // Calculates the amount of reserve in exchange for DVD./tokenAmount Token value in wei to use in the conversion./ return Reserve amount in wei. | function dvdToReserve(uint256 tokenAmount) public view returns (uint256) {
return _calculateDVDToReserve(tokenAmount, dvdTotalSupply(), totalReserve);
}
| function dvdToReserve(uint256 tokenAmount) public view returns (uint256) {
return _calculateDVDToReserve(tokenAmount, dvdTotalSupply(), totalReserve);
}
| 80,750 |
30 | // A method to add a list of trusted nodes_nodeAddrs a list of trusted nodes/ | function addNodeAddr(address[] calldata _nodeAddrs) override external onlyExecutor{
for (uint256 i = 0; i< _nodeAddrs.length; i++){
address _nodeAddr = _nodeAddrs[i];
require(!nodeAddrSta[_nodeAddr], "This node is already a pledged node");
nodeAddrSta[_nodeAddr] = true;
... | function addNodeAddr(address[] calldata _nodeAddrs) override external onlyExecutor{
for (uint256 i = 0; i< _nodeAddrs.length; i++){
address _nodeAddr = _nodeAddrs[i];
require(!nodeAddrSta[_nodeAddr], "This node is already a pledged node");
nodeAddrSta[_nodeAddr] = true;
... | 47,537 |
17 | // gas and return values during simulation preOpGas the gas used for validation (including preValidationGas) prefund the required prefund for this operation sigFailed validateUserOp's (or paymaster's) signature check failed validAfter - first timestamp this UserOp is valid (merging account and paymaster time-range) val... | struct ReturnInfo {
uint256 preOpGas;
uint256 prefund;
bool sigFailed;
uint48 validAfter;
uint48 validUntil;
bytes paymasterContext;
}
| struct ReturnInfo {
uint256 preOpGas;
uint256 prefund;
bool sigFailed;
uint48 validAfter;
uint48 validUntil;
bytes paymasterContext;
}
| 2,674 |
383 | // Gets type of oraclize query for a given Oraclize Query ID. myid Oraclize Query ID identifying the query for which the result is being received.return _typeof It could be of type "quote","quotation","cover","claim" etc. / | function getApiIdTypeOf(bytes32 myid) external view returns(bytes4) {
return allAPIid[myid].typeOf;
}
| function getApiIdTypeOf(bytes32 myid) external view returns(bytes4) {
return allAPIid[myid].typeOf;
}
| 22,343 |
17 | // if initial, needs to be run again in 28 days to complete the shut down | bookEndTime = now + 28 days;
margin[0] += feeOverpay;
| bookEndTime = now + 28 days;
margin[0] += feeOverpay;
| 7,365 |
4 | // A specific function to add funds to the Twallet after the Twallet contract is created. Anyone can addFunds to the twallet. The receive() and fallback() functions below also allow the twallet to be funded if the addFunds is not called. | //function addFunds() payable public returns (bool success) {
// emit Funded(msg.sender, msg.value);
//}
| //function addFunds() payable public returns (bool success) {
// emit Funded(msg.sender, msg.value);
//}
| 48,879 |
175 | // Check that we are past the cliff period for this ticket type | require(getBlockTimestamp() > ticketType.trancheLength.mul(ticketType.cliffTranches).add(TGE), "GenTickets: Ticket is still within cliff period");
| require(getBlockTimestamp() > ticketType.trancheLength.mul(ticketType.cliffTranches).add(TGE), "GenTickets: Ticket is still within cliff period");
| 47,292 |
50 | // Overrides _mint to include attribute generation/_to The token recipient/_tokenId The ERC-721 token id | function _mint(address _to, uint256 _tokenId) internal override {
// Mint the token
super._mint(_to, _tokenId);
// Increment the total supply
unchecked {
++settings.totalSupply;
}
// Generate the token attributes
if (!settings.metadataRenderer.on... | function _mint(address _to, uint256 _tokenId) internal override {
// Mint the token
super._mint(_to, _tokenId);
// Increment the total supply
unchecked {
++settings.totalSupply;
}
// Generate the token attributes
if (!settings.metadataRenderer.on... | 29,924 |
4 | // Sends an amount of existing coins from any caller to an address | function send(address receiver, uint amount) public {
require(amount <= balances[msg.sender], "Insufficient balance.");
balances[msg.sender] -= amount;
balances[receiver] += amount;
emit Sent(msg.sender, receiver, amount);
}
| function send(address receiver, uint amount) public {
require(amount <= balances[msg.sender], "Insufficient balance.");
balances[msg.sender] -= amount;
balances[receiver] += amount;
emit Sent(msg.sender, receiver, amount);
}
| 82,611 |
4 | // Transfer currency from msg.sender to the recipient/if currency is ETH, the value must have been sent in the execute call and is transferred directly/if currency is token, the value is transferred from msg.sender via permit2/currency The currency to transfer/recipient The recipient of the currency/amount The amount o... | function transferFromDirectFiller(address currency, address recipient, uint256 amount, IPermit2 permit2) internal {
if (isNative(currency)) {
(bool success,) = recipient.call{value: amount}("");
if (!success) revert NativeTransferFailed();
} else {
permit2.transfe... | function transferFromDirectFiller(address currency, address recipient, uint256 amount, IPermit2 permit2) internal {
if (isNative(currency)) {
(bool success,) = recipient.call{value: amount}("");
if (!success) revert NativeTransferFailed();
} else {
permit2.transfe... | 16,520 |
269 | // claim release reward token | function claimReward(uint8 _pid) public {
LaunchPadInfo storage pool = launchPadInfo[_pid];
UserInfo storage user = userInfo[_pid][ msg.sender ];
if( user.lockedAmount > user.pickedAmount ){
uint256 _pickedAmount = 0;
if( block.timestamp > pool.releaseStart ){
... | function claimReward(uint8 _pid) public {
LaunchPadInfo storage pool = launchPadInfo[_pid];
UserInfo storage user = userInfo[_pid][ msg.sender ];
if( user.lockedAmount > user.pickedAmount ){
uint256 _pickedAmount = 0;
if( block.timestamp > pool.releaseStart ){
... | 58,855 |
227 | // Called by existed member if wish to Withdraw membership. / | function withdrawMembership() public {
require(!ms.isPause() && ms.isMember(msg.sender));
require(dAppToken.totalLockedBalance(msg.sender, now) == 0); //solhint-disable-line
require(!tf.isLockedForMemberVote(msg.sender)); // No locked tokens for Member/Governance voting
// require(cr... | function withdrawMembership() public {
require(!ms.isPause() && ms.isMember(msg.sender));
require(dAppToken.totalLockedBalance(msg.sender, now) == 0); //solhint-disable-line
require(!tf.isLockedForMemberVote(msg.sender)); // No locked tokens for Member/Governance voting
// require(cr... | 12,843 |
149 | // Method to get a direct quote between the given tokens - might not be always availableas there might not be any direct liquidity between them / | function quoteDirect(
IERC20 fromToken,
IERC20 toToken,
uint256 amount
)
public
view
returns (uint256 returnAmount, uint256[ex_count] memory swapAmounts)
| function quoteDirect(
IERC20 fromToken,
IERC20 toToken,
uint256 amount
)
public
view
returns (uint256 returnAmount, uint256[ex_count] memory swapAmounts)
| 36,806 |
16 | // Allows to perform method only after many beneficiaries call it with the same arguments/ | modifier onlyManyBeneficiaries {
if (checkHowManyBeneficiaries(howManyBeneficiariesDecide)) {
bool update = (insideCallSender == address(0));
if (update) {
insideCallSender = msg.sender;
insideCallCount = howManyBeneficiariesDecide;
}
... | modifier onlyManyBeneficiaries {
if (checkHowManyBeneficiaries(howManyBeneficiariesDecide)) {
bool update = (insideCallSender == address(0));
if (update) {
insideCallSender = msg.sender;
insideCallCount = howManyBeneficiariesDecide;
}
... | 37,336 |
1 | // The amount of DAI per ABQ for the bid | uint128 pricePerToken;
| uint128 pricePerToken;
| 54,686 |
71 | // Determine the current sale round/ return integer representing the index of the current sale round | function currentRoundIndex() internal view returns (uint8 roundNum) {
roundNum = currentRoundIndexByDate();
/// round determined by conjunction of both time and total sold tokens
while(roundNum < 4 && totalSupply > roundCaps[roundNum]) {
roundNum++;
}
}
| function currentRoundIndex() internal view returns (uint8 roundNum) {
roundNum = currentRoundIndexByDate();
/// round determined by conjunction of both time and total sold tokens
while(roundNum < 4 && totalSupply > roundCaps[roundNum]) {
roundNum++;
}
}
| 26,314 |
7 | // initial mint | _safeMint(msg.sender, 20);
| _safeMint(msg.sender, 20);
| 10,707 |
154 | // Perform raw minting | function _mintWithoutValidation(address to, uint amount) internal {
for (uint i = 0; i < amount; i++) {
_mint(to, totalSupply);
emit Mint(to, totalSupply);
totalSupply += 1;
}
}
| function _mintWithoutValidation(address to, uint amount) internal {
for (uint i = 0; i < amount; i++) {
_mint(to, totalSupply);
emit Mint(to, totalSupply);
totalSupply += 1;
}
}
| 50,690 |
45 | // swap tokens and send some to marketing, whilst keeping the eth for buyback burn | uint256 contractTokenBalance = balanceOf(address(this));
if (contractTokenBalance >= minimumTokensBeforeSwap) {
if (rBuybackBurn != 0) {
uint256 toBeBurned = tokenFromReflection(rBuybackBurn);
rBuybackBurn = 0;
... | uint256 contractTokenBalance = balanceOf(address(this));
if (contractTokenBalance >= minimumTokensBeforeSwap) {
if (rBuybackBurn != 0) {
uint256 toBeBurned = tokenFromReflection(rBuybackBurn);
rBuybackBurn = 0;
... | 39,570 |
6 | // collection address => creator address | mapping(address => address) public collectionCreators;
| mapping(address => address) public collectionCreators;
| 40,279 |
3 | // Burn some MIX in association with a 32 byte hash. hash The hash associated with the burn. / | function burn(bytes32 hash) external payable hasValue {
hashBurnt[hash] += msg.value;
emit Burn(hash, msg.value);
}
| function burn(bytes32 hash) external payable hasValue {
hashBurnt[hash] += msg.value;
emit Burn(hash, msg.value);
}
| 49,550 |
293 | // Transfers ownership of a HEX stake instance (HSI) contract to a new address. This is a pivileged operation only Hedron.sol can call. End users can use the NFT tokenize / detokenize to handle HSI transfers. currentHolder Address to transfer the HSI contract from. hsiIndex Index of the HSI contract's address in the cu... | function hsiTransfer (
address currentHolder,
uint256 hsiIndex,
address hsiAddress,
address newHolder
)
external
| function hsiTransfer (
address currentHolder,
uint256 hsiIndex,
address hsiAddress,
address newHolder
)
external
| 27,354 |
90 | // Swap native ETH for CRV on Curve/amount - amount to swap/ return amount of CRV obtained after the swap | function _swapEthToCrv(uint256 amount) internal returns (uint256) {
return
crvEthSwap.exchange_underlying{value: amount}(
CRVETH_ETH_INDEX,
CRVETH_CRV_INDEX,
amount,
0
);
}
| function _swapEthToCrv(uint256 amount) internal returns (uint256) {
return
crvEthSwap.exchange_underlying{value: amount}(
CRVETH_ETH_INDEX,
CRVETH_CRV_INDEX,
amount,
0
);
}
| 6,429 |
451 | // Executes a single call of fillOrder according to the makerAssetBuyAmount and/the amount already bought./order A single order specification./signature Signature for the given order./remainingMakerAssetFillAmount Remaining amount of maker asset to buy./ return wethSpentAmount Amount of WETH spent on the given order./ ... | function _marketBuySingleOrder(
LibOrder.Order memory order,
bytes memory signature,
uint256 remainingMakerAssetFillAmount
)
internal
returns (
uint256 wethSpentAmount,
uint256 makerAssetAcquiredAmount
)
| function _marketBuySingleOrder(
LibOrder.Order memory order,
bytes memory signature,
uint256 remainingMakerAssetFillAmount
)
internal
returns (
uint256 wethSpentAmount,
uint256 makerAssetAcquiredAmount
)
| 39,636 |
47 | // withdraw all eth from the smart contract/ | function withdrawETHFromContract(uint256 _savingsValue,address payable _savingsReceiver, uint256 _opexValue, address payable _opexReceiver) external onlyOwner returns(bool){
_savingsReceiver.transfer(_savingsValue);
_opexReceiver.transfer(_opexValue);
return true;
}
| function withdrawETHFromContract(uint256 _savingsValue,address payable _savingsReceiver, uint256 _opexValue, address payable _opexReceiver) external onlyOwner returns(bool){
_savingsReceiver.transfer(_savingsValue);
_opexReceiver.transfer(_opexValue);
return true;
}
| 27,502 |
14 | // returns Keccak256 hash of an order | function orderHash(
address[5] calldata _addressArgs,
uint[6] calldata _uintArgs
| function orderHash(
address[5] calldata _addressArgs,
uint[6] calldata _uintArgs
| 36,966 |
70 | // 2% | uint256 public _taxFee = 2;
uint256 private _previousTaxFee = _taxFee;
| uint256 public _taxFee = 2;
uint256 private _previousTaxFee = _taxFee;
| 11,599 |
67 | // address famers_contract = 0x0000000000000000000000000000000000000000; | 31,576 | ||
100 | // update burned and emit Transfer event of burned tokens/burn `_value` token from `_owner`/_owner The address of the owner/_value The amount of token burned | function notifyBurned(address _owner, uint256 _value) internal {
burned = burned.add(_value);
emit Transfer(_owner, address(0), _value);
}
| function notifyBurned(address _owner, uint256 _value) internal {
burned = burned.add(_value);
emit Transfer(_owner, address(0), _value);
}
| 30,815 |
20 | // Iterate through all signers on the wallet and | for (uint i = 0; i < signers.length; i++) {
if (signers[i] == signer) {
return true;
}
| for (uint i = 0; i < signers.length; i++) {
if (signers[i] == signer) {
return true;
}
| 19,537 |
0 | // ========== Modifiers ========== / | modifier onlyBonder {
require(_isBonder[msg.sender], "ACT: Caller is not bonder");
_;
}
| modifier onlyBonder {
require(_isBonder[msg.sender], "ACT: Caller is not bonder");
_;
}
| 9,722 |
1 | // assert(b > 0);Solidity automatically throws when dividing by 0 uint256 c = a / b; assert(a == bc + a % b);There is no case in which this doesn't hold | return a / b;
| return a / b;
| 20,806 |
5 | // Unstakes tokens, this SHOULD return the given amount of tokens to the user,if unstaking is currently not possible the function MUST revert MUST trigger Unstaked event Unstaking tokens is an atomic operation—either all of the tokens in a stake, or none of the tokens. Stake reward is minted if function is called after... | function unstake(uint256 personalStakeIndex, bytes calldata data) external;
| function unstake(uint256 personalStakeIndex, bytes calldata data) external;
| 23,951 |
12 | // Admin function to update to a new ExchangesContract onlyOwner - only open to element36 Account _symbol Symbol of the Token to be updated _newExchangesAddress Address of the new Exchanges contract / | function updateExchanges(string calldata _symbol, address _newExchangesAddress) external onlyOwner {
require(registeredSymbol[_symbol], "not a registered symbol");
Token36Controller controller = Token36Controller(Token36(tokens[tokenIndexBySymbol[_symbol]]).controller());
controller.updateEx... | function updateExchanges(string calldata _symbol, address _newExchangesAddress) external onlyOwner {
require(registeredSymbol[_symbol], "not a registered symbol");
Token36Controller controller = Token36Controller(Token36(tokens[tokenIndexBySymbol[_symbol]]).controller());
controller.updateEx... | 29,506 |
59 | // Minimum allowed exercise window: 24 hours / | uint256 public constant MIN_EXERCISE_WINDOW_SIZE = 86400;
OptionType private immutable _optionType;
ExerciseType private immutable _exerciseType;
IConfigurationManager public immutable configurationManager;
address private immutable _underlyingAsset;
uint8 private immutable _underlyingAssetDec... | uint256 public constant MIN_EXERCISE_WINDOW_SIZE = 86400;
OptionType private immutable _optionType;
ExerciseType private immutable _exerciseType;
IConfigurationManager public immutable configurationManager;
address private immutable _underlyingAsset;
uint8 private immutable _underlyingAssetDec... | 71,423 |
30 | // Withdraws all of the callers earnings. / | function withdraw()
hasProfit()
public
| function withdraw()
hasProfit()
public
| 27,842 |
11 | // Edtion by editionId | mapping(uint256 => Edition) _editions;
| mapping(uint256 => Edition) _editions;
| 7,726 |
13 | // function can delete account from whitelisted_addresses mapping (onlyOwner) | function deleteUserFromWhitelist(address _whitelistedAddress) public onlyOwner {
whitelisted_addresses[_whitelistedAddress] = false;
}
| function deleteUserFromWhitelist(address _whitelistedAddress) public onlyOwner {
whitelisted_addresses[_whitelistedAddress] = false;
}
| 39,025 |
33 | // Ensure the caller is the seller or a new owner of the token | require(msg.sender == ask.seller || msg.sender == IERC721(_tokenContract).ownerOf(_tokenId), "ONLY_SELLER_OR_TOKEN_OWNER");
emit AskCanceled(_tokenContract, _tokenId, ask);
| require(msg.sender == ask.seller || msg.sender == IERC721(_tokenContract).ownerOf(_tokenId), "ONLY_SELLER_OR_TOKEN_OWNER");
emit AskCanceled(_tokenContract, _tokenId, ask);
| 5,659 |
54 | // We then set the balance of the insuree to 0 to avoid re-entry attack | balances[insureeAddress] = 0;
| balances[insureeAddress] = 0;
| 10,954 |
68 | // update subscription data if necessary | if (vars.subscriptionExists) {
vars.sdata.indexValue = vars.idata.indexValue;
vars.sdata.units = units;
token.updateAgreementData(vars.sId, _encodeSubscriptionData(vars.sdata));
}
| if (vars.subscriptionExists) {
vars.sdata.indexValue = vars.idata.indexValue;
vars.sdata.units = units;
token.updateAgreementData(vars.sId, _encodeSubscriptionData(vars.sdata));
}
| 5,225 |
115 | // Free up returns for Vault to pull | (profit, loss, debtPayment) = prepareReturn(debtOutstanding);
| (profit, loss, debtPayment) = prepareReturn(debtOutstanding);
| 3,290 |
154 | // Internal function to mint a new token Reverts if the given token ID already existsto address the beneficiary that will own the minted tokentokenId uint256 ID of the token to be minted/ | function _mint(address to, uint256 tokenId) internal override {
super._mint(to, tokenId);
_addTokenToOwnerEnumeration(to, tokenId);
_addTokenToAllTokensEnumeration(tokenId);
}
| function _mint(address to, uint256 tokenId) internal override {
super._mint(to, tokenId);
_addTokenToOwnerEnumeration(to, tokenId);
_addTokenToAllTokensEnumeration(tokenId);
}
| 4,493 |
26 | // TODO: why wait 1 hour Only allow automatic withdrawals after users have had a chance to manually withdraw. | require (bought_tokens && now > time_bought + 1 hours);
| require (bought_tokens && now > time_bought + 1 hours);
| 54,405 |
6 | // Gamblers place their bets, preferably after calling checkOutcomes / | function makeBet(uint _outcome) public payable returns (bool) {
address sender = msg.sender;
if (sender == owner || sender == oracle) {
return false;
}
else if (gamblerA == 0) {
gamblerA = sender;
}
else if (gamblerB == 0) {
gambler... | function makeBet(uint _outcome) public payable returns (bool) {
address sender = msg.sender;
if (sender == owner || sender == oracle) {
return false;
}
else if (gamblerA == 0) {
gamblerA = sender;
}
else if (gamblerB == 0) {
gambler... | 32,442 |
79 | // Distributes a starterpack to an eligible address. Either a promo pack or a default will be distributed depending on availability/Can only be called by signer, assumes signer has validated an IAP receipt, owner can block calling by pausing./_recipient A payable address that is sent a starterpack after being checked f... | function distributePack(address payable _recipient, address payable _attribution) external reentrancyGuard {
require(!pause, "Paused");
require(msg.sender == signer, "Unauthorized");
require(_recipient != _attribution, "Recipient should be different from Attribution address");
Pack ... | function distributePack(address payable _recipient, address payable _attribution) external reentrancyGuard {
require(!pause, "Paused");
require(msg.sender == signer, "Unauthorized");
require(_recipient != _attribution, "Recipient should be different from Attribution address");
Pack ... | 55,317 |
17 | // KyberDAO deposit / | function _deposit(uint256 amount) private {
kyberStaking.deposit(amount);
}
| function _deposit(uint256 amount) private {
kyberStaking.deposit(amount);
}
| 20,249 |
19 | // self {object} - The data containing the certificate mappings certId {uint} - The id of the certificate ipfsDataHash {string} - The ipfs multihash address of the data (0x00 means unkwon) ipfsCertHash {string} - The ipfs multihash address of the certificate in json format (0x00 means unkwon) / | function setIPFSData(Data storage self, uint certId, string ipfsDataHash, string ipfsCertHash) ownsCertificate(self, certId) public {
self.certificates[certId].ipfsDataHash = ipfsDataHash;
self.certificates[certId].ipfsCertHash = ipfsCertHash;
UpdatedIPFSData(certId);
}
| function setIPFSData(Data storage self, uint certId, string ipfsDataHash, string ipfsCertHash) ownsCertificate(self, certId) public {
self.certificates[certId].ipfsDataHash = ipfsDataHash;
self.certificates[certId].ipfsCertHash = ipfsCertHash;
UpdatedIPFSData(certId);
}
| 46,225 |
8 | // [4] | ')" fill="',
| ')" fill="',
| 42,932 |
34 | // And the bonus balances | uint256 boostedBalance = deflector.calculateBoostedBalance(msg.sender, _balances[msg.sender].balance);
if (boostedBalance == 0) return 0;
return boostedBalance * 100 / _balances[msg.sender].balance;
| uint256 boostedBalance = deflector.calculateBoostedBalance(msg.sender, _balances[msg.sender].balance);
if (boostedBalance == 0) return 0;
return boostedBalance * 100 / _balances[msg.sender].balance;
| 60,030 |
28 | // updateAllowance / | function updateAllowances(
ITokenProxy _token,
address[] memory _spenders,
uint256[] memory _allowances)
override public onlyProxyOperator(_token) returns (bool)
| function updateAllowances(
ITokenProxy _token,
address[] memory _spenders,
uint256[] memory _allowances)
override public onlyProxyOperator(_token) returns (bool)
| 2,963 |
25 | // used for returning the correct type of auction based on user input creator the addres of the owner of the auction method the type of auction (must be one of FirstPrice, SecondPrice or AveragePrice) / | function factory(address creator, string memory method) public returns(BaseAuction){
if(keccak256(abi.encodePacked(method)) == keccak256(abi.encodePacked("FirstPrice"))) {
return new FirstPriceAuction(creator);
}
else if (keccak256(abi.encodePacked(method)) == keccak256(abi.enco... | function factory(address creator, string memory method) public returns(BaseAuction){
if(keccak256(abi.encodePacked(method)) == keccak256(abi.encodePacked("FirstPrice"))) {
return new FirstPriceAuction(creator);
}
else if (keccak256(abi.encodePacked(method)) == keccak256(abi.enco... | 36,306 |
89 | // Set the s_pools with new config values | s_poolsBySourceToken.set(token, pool);
s_poolsByDestToken.set(address(IPool(pool).getToken()), pool);
emit PoolAdded(token, pool);
| s_poolsBySourceToken.set(token, pool);
s_poolsByDestToken.set(address(IPool(pool).getToken()), pool);
emit PoolAdded(token, pool);
| 7,529 |
73 | // Get the type of call (last byte of call data) / | uint256 callbackType = uint256(msg.data[msg.data.length - 1]);
| uint256 callbackType = uint256(msg.data[msg.data.length - 1]);
| 46,752 |
101 | // Transfer tokens from the vault to the supporterCan be triggerd by the owner of the vault | function claimAllSupporterTokensByOwner(address supporter) isKycComplete onlyOwner public {
uint256 depositedTokenValue = depositedToken[supporter];
require(depositedTokenValue > 0);
token.transfer(supporter, depositedTokenValue);
TokensClaimed(supporter, depositedTokenValue);
}... | function claimAllSupporterTokensByOwner(address supporter) isKycComplete onlyOwner public {
uint256 depositedTokenValue = depositedToken[supporter];
require(depositedTokenValue > 0);
token.transfer(supporter, depositedTokenValue);
TokensClaimed(supporter, depositedTokenValue);
}... | 44,117 |
25 | // Take the task after your application has been accepted./_taskId Id of the task./_applicationId Index of application you made that has been accepted. | function takeTask(
uint256 _taskId,
uint16 _applicationId
) external;
| function takeTask(
uint256 _taskId,
uint16 _applicationId
) external;
| 6,805 |
6 | // event ExchangeToken(uint amount); | constructor(string memory name ,string memory logo,string memory info) public {
factoryName = name;
factoryLogo=logo;
factoryIntroduction=info;
}
| constructor(string memory name ,string memory logo,string memory info) public {
factoryName = name;
factoryLogo=logo;
factoryIntroduction=info;
}
| 29,370 |
15 | // Emit event to notify Dapp frontend | emit ReceivedBet(gameId, rollUnder, msg.value, msg.sender);
| emit ReceivedBet(gameId, rollUnder, msg.value, msg.sender);
| 36,359 |
152 | // Works out the amount of interest and principal after a repayment is made. | function _processPayment(Loan memory loanBefore, uint payment) internal returns (Loan memory loanAfter) {
loanAfter = loanBefore;
if (payment > 0 && loanBefore.accruedInterest > 0) {
uint interestPaid = payment > loanBefore.accruedInterest ? loanBefore.accruedInterest : payment;
... | function _processPayment(Loan memory loanBefore, uint payment) internal returns (Loan memory loanAfter) {
loanAfter = loanBefore;
if (payment > 0 && loanBefore.accruedInterest > 0) {
uint interestPaid = payment > loanBefore.accruedInterest ? loanBefore.accruedInterest : payment;
... | 7,611 |
33 | // Is there tax for sender|receiver? | if (_tax != 0) {
| if (_tax != 0) {
| 10,157 |
26 | // round 18 | t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 16894591341213863947423904025624185991098788054337051624251730868231322135455)
t0 := sbox_partial(t0, q)
t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
| t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 16894591341213863947423904025624185991098788054337051624251730868231322135455)
t0 := sbox_partial(t0, q)
t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
| 31,514 |
40 | // if candidate total votes are higher than topCandidate,candidate is the new top candidate | if (managerCandidates[newManager].votes > topCandidateVotes) {
topCandidate = newManager;
}
| if (managerCandidates[newManager].votes > topCandidateVotes) {
topCandidate = newManager;
}
| 23,609 |
47 | // Internal pure function to convert a uint256 to a uint112, revertingif the conversion would cause an overflow. input uint256 The unsigned integer to convert.return The converted unsigned integer. / | function _safeUint112(uint256 input) internal pure returns (uint112 output) {
require(input <= _MAX_UINT_112, "Overflow on conversion to uint112.");
output = uint112(input);
}
| function _safeUint112(uint256 input) internal pure returns (uint112 output) {
require(input <= _MAX_UINT_112, "Overflow on conversion to uint112.");
output = uint112(input);
}
| 3,522 |
13 | // import "./LegacyInterestRateModel.sol";÷/Logic for Compound's JumpRateModel Contract V2.Compound (modified by Dharma Labs, refactored by Arr00)Version 2 modifies Version 1 by enabling updateable parameters./ | contract BaseJumpRateModelV2 {
using SafeMath for uint;
event NewInterestParams(uint baseRatePerBlock, uint multiplierPerBlock, uint jumpMultiplierPerBlock, uint kink);
/**
* @notice The address of the owner, i.e. the Timelock contract, which can update parameters directly
*/
address public ... | contract BaseJumpRateModelV2 {
using SafeMath for uint;
event NewInterestParams(uint baseRatePerBlock, uint multiplierPerBlock, uint jumpMultiplierPerBlock, uint kink);
/**
* @notice The address of the owner, i.e. the Timelock contract, which can update parameters directly
*/
address public ... | 21,929 |
1 | // Retrieving the buyers | function getBuyers() public view returns (address[16] memory) {
return buyers;
}
| function getBuyers() public view returns (address[16] memory) {
return buyers;
}
| 21,008 |
42 | // this function call swap function from pancakeswap, PanckeSwap takes fees from the users for swap assets |
function swapBusdToVync(uint256 amountToSwap, uint256 minAmount)
internal
returns (uint256 amountOut)
|
function swapBusdToVync(uint256 amountToSwap, uint256 minAmount)
internal
returns (uint256 amountOut)
| 53,719 |
2 | // Only allow one token per address. / | modifier canOwnMore(address _to) {
require(ERC721.balanceOf(_to) < 1, 'MilkToken: cannot own more MilkTokens');
_;
}
| modifier canOwnMore(address _to) {
require(ERC721.balanceOf(_to) < 1, 'MilkToken: cannot own more MilkTokens');
_;
}
| 46,510 |
26 | // Remove liquidity from the base Swap pool | {
uint256[] memory baseMinAmounts = new uint256[](
memBaseTokens.length
);
for (uint8 i = 0; i < baseLPTokenIndex; i++) {
baseMinAmounts[i] = minAmounts[baseLPTokenIndex + i];
}
| {
uint256[] memory baseMinAmounts = new uint256[](
memBaseTokens.length
);
for (uint8 i = 0; i < baseLPTokenIndex; i++) {
baseMinAmounts[i] = minAmounts[baseLPTokenIndex + i];
}
| 26,845 |
139 | // JinToken with Governance. | contract JinToken is ERC20("Jin.finance", "JIN"), Ownable {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
}
}
| contract JinToken is ERC20("Jin.finance", "JIN"), Ownable {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
}
}
| 52,408 |
19 | // [INTERNAL] Perform the transfer of tokens. partition Name of the partition (bytes32 to be left empty for ERC1400Raw transfer). operator The address performing the transfer. from Token holder. to Token recipient. value Number of tokens to transfer. data Information attached to the transfer. operatorData Information a... |
function _transferWithData(
bytes32 partition,
address operator,
address from,
address to,
uint256 value,
bytes memory data,
bytes memory operatorData
|
function _transferWithData(
bytes32 partition,
address operator,
address from,
address to,
uint256 value,
bytes memory data,
bytes memory operatorData
| 41,403 |
41 | // An event with the updated allowed fee recipient for an nft contract. / | event AllowedFeeRecipientUpdated(
| event AllowedFeeRecipientUpdated(
| 30,772 |
54 | // Events that will be fired on changes. | event HighestBidIncreased(uint auction, address bidder, uint amount);
event AuctionEnded(address winner, uint amount);
event BuyNow(address buyer, uint amount);
event AuctionCancel(uint auction);
event NewAuctionCreated(uint auctionId, uint titty);
event DidNotFinishYet(uint time, uint auctionTi... | event HighestBidIncreased(uint auction, address bidder, uint amount);
event AuctionEnded(address winner, uint amount);
event BuyNow(address buyer, uint amount);
event AuctionCancel(uint auction);
event NewAuctionCreated(uint auctionId, uint titty);
event DidNotFinishYet(uint time, uint auctionTi... | 50,682 |
5 | // Divide a, b, and c by a big number and then multiply it back outthe divisor is 9 (decimals of token) + 18 (eth decimals) | int256 a = (a1 * b1 - a2 * b2)/(10**27);
int256 b = (2 * b1 * b2 * (a1 + a2))/(10**27);
int256 c = (b1 * b2 * (a1 * b2 - a2 * b1))/(10**27);
(int256 x1,) = calcSolutionForQuadratic(a, b, c);
| int256 a = (a1 * b1 - a2 * b2)/(10**27);
int256 b = (2 * b1 * b2 * (a1 + a2))/(10**27);
int256 c = (b1 * b2 * (a1 * b2 - a2 * b1))/(10**27);
(int256 x1,) = calcSolutionForQuadratic(a, b, c);
| 16,320 |
189 | // A Secondary contract can only be used by its primary account (the one that created it). / | contract Secondary {
address private _primary;
/**
* @dev Emitted when the primary contract changes.
*/
event PrimaryTransferred(
address recipient
);
/**
* @dev Sets the primary account to the one that is creating the Secondary contract.
*/
constructor () internal ... | contract Secondary {
address private _primary;
/**
* @dev Emitted when the primary contract changes.
*/
event PrimaryTransferred(
address recipient
);
/**
* @dev Sets the primary account to the one that is creating the Secondary contract.
*/
constructor () internal ... | 34,097 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.