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 |
|---|---|---|---|---|
33 | // 将`HT数量`的`HT`token发送到`pair合约`地址 | assert(IWHT(WHT).transfer(pair, amountHT));
| assert(IWHT(WHT).transfer(pair, amountHT));
| 15,646 |
271 | // Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. / | function revokeRole(bytes32 role, address account) external;
| function revokeRole(bytes32 role, address account) external;
| 5,198 |
284 | // Increase the boost total proportionately. | totalFeiBoosted += feiAmount;
| totalFeiBoosted += feiAmount;
| 11,048 |
90 | // Anyone: query value associated with address.returns zero if absent. | function get(address a) external view override returns (uint256) {
return theList.contains(a) ? theList.get(a) : 0;
}
| function get(address a) external view override returns (uint256) {
return theList.contains(a) ? theList.get(a) : 0;
}
| 23,388 |
60 | // missing alright | _finalizeSlashing(schainId, toNodeIndex);
return;
| _finalizeSlashing(schainId, toNodeIndex);
return;
| 26,947 |
6 | // Add to token to cToken mapping. Add to token to cToken mapping. _cTokens list of cToken addresses to be added to the mapping. / | function addTokenToCToken(address[] memory _cTokens) public {
for (uint256 i = 0; i < _cTokens.length; i++) {
(bool isMarket_, , ) = troller.markets(_cTokens[i]);
require(isMarket_, "unvalid-ctoken");
address token_ = CTokenInterface(_cTokens[i]).underlying();
... | function addTokenToCToken(address[] memory _cTokens) public {
for (uint256 i = 0; i < _cTokens.length; i++) {
(bool isMarket_, , ) = troller.markets(_cTokens[i]);
require(isMarket_, "unvalid-ctoken");
address token_ = CTokenInterface(_cTokens[i]).underlying();
... | 19,585 |
91 | // returns the allowance for a spender | function allowance(address owner, address spender) public view virtual override returns (uint256) {
return allowances[owner][spender];
}
| function allowance(address owner, address spender) public view virtual override returns (uint256) {
return allowances[owner][spender];
}
| 11,398 |
138 | // Tellor Getters LibraryThis is the getter library for all variables in the Tellor Tributes system. TellorGetters references this libary for the getters logic/ | library TellorGettersLibrary {
using SafeMath for uint256;
event NewTellorAddress(address _newTellor); //emmited when a proposed fork is voted true
/*Functions*/
//The next two functions are onlyOwner functions. For Tellor to be truly decentralized, we will need to transfer the Deity to the 0 addres... | library TellorGettersLibrary {
using SafeMath for uint256;
event NewTellorAddress(address _newTellor); //emmited when a proposed fork is voted true
/*Functions*/
//The next two functions are onlyOwner functions. For Tellor to be truly decentralized, we will need to transfer the Deity to the 0 addres... | 26,048 |
141 | // S1 + S2 + SL1 + SL2 == TAD | assert(total_available_deposit == (
participant1_amount +
participant2_amount +
participant1_locked_amount +
participant2_locked_amount
));
return (
participant1_amount,
participant2_amount,
| assert(total_available_deposit == (
participant1_amount +
participant2_amount +
participant1_locked_amount +
participant2_locked_amount
));
return (
participant1_amount,
participant2_amount,
| 16,952 |
7 | // delegateTransferBatch is a part of off-chain operations like withdrawing assets. / | function delegateTransferBatch(
address[] calldata from,
address[] calldata to,
uint256[] calldata tokens,
uint256[] calldata expireAt,
bytes[] calldata sig
| function delegateTransferBatch(
address[] calldata from,
address[] calldata to,
uint256[] calldata tokens,
uint256[] calldata expireAt,
bytes[] calldata sig
| 26,191 |
118 | // this portion of earned rewards go to referrer | uint public REFERRAL_FEE_RATE_X_100 = 500;
| uint public REFERRAL_FEE_RATE_X_100 = 500;
| 25,222 |
9 | // Set one or more DNS records.Records are supplied in wire-format.Records with the same node/name/resource must be supplied one after theother to ensure the data is updated correctly. For example, if the datawas supplied:a.example.com IN A 1.2.3.4a.example.com IN A 5.6.7.8www.example.com IN CNAME a.example.com.then th... | function setDNSRecords(bytes32 node, bytes calldata data) external authorised(node) {
uint16 resource = 0;
uint256 offset = 0;
bytes memory name;
bytes memory value;
bytes32 nameHash;
// Iterate over the data to add the resource records
for (RRUtils.RRIterator... | function setDNSRecords(bytes32 node, bytes calldata data) external authorised(node) {
uint16 resource = 0;
uint256 offset = 0;
bytes memory name;
bytes memory value;
bytes32 nameHash;
// Iterate over the data to add the resource records
for (RRUtils.RRIterator... | 29,605 |
21 | // Changes canvas.bookFor variable. Only for the owner of the contract./ | function bookCanvasFor(uint32 _canvasId, address _bookFor) external onlyOwner {
Canvas storage _canvas = _getCanvas(_canvasId);
_canvas.bookedFor = _bookFor;
}
| function bookCanvasFor(uint32 _canvasId, address _bookFor) external onlyOwner {
Canvas storage _canvas = _getCanvas(_canvasId);
_canvas.bookedFor = _bookFor;
}
| 19,738 |
269 | // UserManager Interface Manages the Union members credit lines, and their vouchees and borrowers info. / | interface IUserManager {
/**
* @dev Check if the account is a valid member
* @param account Member address
* @return Address whether is member
*/
function checkIsMember(address account) external view returns (bool);
/**
* @dev Get member borrowerAddresses
* @param account... | interface IUserManager {
/**
* @dev Check if the account is a valid member
* @param account Member address
* @return Address whether is member
*/
function checkIsMember(address account) external view returns (bool);
/**
* @dev Get member borrowerAddresses
* @param account... | 70,480 |
164 | // Deposit assets into the Sett, and return corresponding shares to the user/Only callable by EOA accounts that pass the _defend() check | function deposit(uint256 _amount) public whenNotPaused {
_defend();
_blockLocked();
_lockForBlock(msg.sender);
_depositWithAuthorization(_amount, new bytes32[](0));
}
| function deposit(uint256 _amount) public whenNotPaused {
_defend();
_blockLocked();
_lockForBlock(msg.sender);
_depositWithAuthorization(_amount, new bytes32[](0));
}
| 28,102 |
222 | // Update cumulative fee factor with new fees The cumulativeFeeFactor is used to calculate fees for all delegators including the transcoder (self-delegated) Note that delegatorsFees includes transcoderRewardStakeFees, but no delegator will claim that amount using the earnings claiming algorithm and instead that amount ... | earningsPool.updateCumulativeFeeFactor(prevEarningsPool, delegatorsFees);
t.lastFeeRound = currentRound;
| earningsPool.updateCumulativeFeeFactor(prevEarningsPool, delegatorsFees);
t.lastFeeRound = currentRound;
| 35,238 |
36 | // This contract : The address for the database contract used by this platform | constructor(address _database, address _events, address _kyber)
| constructor(address _database, address _events, address _kyber)
| 11,586 |
29 | // Transfer tokens from msg.sender to this contract on this blockchain,and request tokens on the remote blockchain be given to the requestedaccount on the destination blockchain. NOTE: msg.sender must have called approve() on the token contract._srcTokenContract Address of ERC 20 contract on this blockchain. _recipient... | function transferToOtherBlockchain(
uint256 _destBcId,
address _srcTokenContract,
address _recipient,
uint256 _tokenId
| function transferToOtherBlockchain(
uint256 _destBcId,
address _srcTokenContract,
address _recipient,
uint256 _tokenId
| 7,893 |
53 | // Bird's BErc20 Interface/ | contract BErc20Interface is BErc20Storage {
/*** User Interface ***/
function mint(uint mintAmount) external returns (uint);
function redeem(uint redeemTokens) external returns (uint);
function redeemUnderlying(uint redeemAmount) external returns (uint);
function borrow(uint borrowAmount) external... | contract BErc20Interface is BErc20Storage {
/*** User Interface ***/
function mint(uint mintAmount) external returns (uint);
function redeem(uint redeemTokens) external returns (uint);
function redeemUnderlying(uint redeemAmount) external returns (uint);
function borrow(uint borrowAmount) external... | 20,148 |
224 | // If the user specifies -1 amount to repay (“max”), repayAmount => the lesser of the senders ERC-20 balance and borrowCurrent | if (amount == uint(-1)) {
localResults.repayAmount = min(getBalanceOf(asset, msg.sender), localResults.userBorrowCurrent);
} else {
| if (amount == uint(-1)) {
localResults.repayAmount = min(getBalanceOf(asset, msg.sender), localResults.userBorrowCurrent);
} else {
| 3,657 |
5 | // if status == open, then no whitelist [no mapping needed]. But then we need a removeListing function for contracts we subsequently/ return open | bool public open;
| bool public open;
| 19,137 |
178 | // KO commission on every sale | uint256 public platformPrimarySaleCommission = 15_00000; // 15.00000%
constructor(IKOAccessControlsLookup _accessControls, IKODAV3 _koda, address _platformAccount)
| uint256 public platformPrimarySaleCommission = 15_00000; // 15.00000%
constructor(IKOAccessControlsLookup _accessControls, IKODAV3 _koda, address _platformAccount)
| 23,967 |
25 | // Allows to add a new _owner. Transaction has to be sent by wallet./_owner Address of new owner./_ownerName Name of new owner. | function addOwner(address payable _owner, bytes32 _ownerName)
public
onlyWallet
ownerDoesNotExist(_owner)
notNull(_owner)
validRequirement(owners.length + 1, required)
| function addOwner(address payable _owner, bytes32 _ownerName)
public
onlyWallet
ownerDoesNotExist(_owner)
notNull(_owner)
validRequirement(owners.length + 1, required)
| 40,995 |
3 | // if owner is not contract, return | if (!owner.isContract()) {
return owner;
}
| if (!owner.isContract()) {
return owner;
}
| 437 |
39 | // get the reserve-configuration of the converter | for (uint i = 0; i < reserveTokenCount; i++) {
IERC20Token reserveToken = _converter.connectorTokens(i);
reserveTokens[i] = reserveToken;
reserveRatios[i] = getReserveRatio(_converter, reserveToken);
}
| for (uint i = 0; i < reserveTokenCount; i++) {
IERC20Token reserveToken = _converter.connectorTokens(i);
reserveTokens[i] = reserveToken;
reserveRatios[i] = getReserveRatio(_converter, reserveToken);
}
| 2,203 |
10 | // Send funds to the addresses provided needsFunding the list of addresses to fund (addresses must be pre-approved) / | function topUpExact(address[] memory needsFunding) internal whenNotPaused {
uint256 minWaitPeriodSeconds = MinWaitPeriodSeconds;
Target memory target;
for (uint256 idx = 0; idx < needsFunding.length; idx++) {
target = recipientConfigs[needsFunding[idx]];
uint256 delta... | function topUpExact(address[] memory needsFunding) internal whenNotPaused {
uint256 minWaitPeriodSeconds = MinWaitPeriodSeconds;
Target memory target;
for (uint256 idx = 0; idx < needsFunding.length; idx++) {
target = recipientConfigs[needsFunding[idx]];
uint256 delta... | 13,326 |
11 | // Stores a new address in the EIP1967 admin slot. / | function _setAdmin(address newAdmin) private {
require(newAdmin != address(0), 'ERC1967: new admin is the zero address');
StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
}
| function _setAdmin(address newAdmin) private {
require(newAdmin != address(0), 'ERC1967: new admin is the zero address');
StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
}
| 30,022 |
142 | // requirement below is satisfied by statements aboverequire(!_isPricedLtOrEq(id, prev_id)); | _rank[prev_id].next = id;
_rank[id].prev = prev_id;
| _rank[prev_id].next = id;
_rank[id].prev = prev_id;
| 39,566 |
4 | // ECN to 1 wei ratio. | uint256 public constant ECN_PER_WEI = 40000;
| uint256 public constant ECN_PER_WEI = 40000;
| 19,599 |
17 | // untistupids function | function transferAnyTokens(address _erc20, address _receiver, uint _amount) public onlyOwner {
BaseERC20(_erc20).transfer(_receiver, _amount);
}
| function transferAnyTokens(address _erc20, address _receiver, uint _amount) public onlyOwner {
BaseERC20(_erc20).transfer(_receiver, _amount);
}
| 42,476 |
27 | // data layer | BitSTDData private data;
constructor(address dataAddress) {
data = BitSTDData(dataAddress);
owner = msg.sender;
}
| BitSTDData private data;
constructor(address dataAddress) {
data = BitSTDData(dataAddress);
owner = msg.sender;
}
| 18,798 |
241 | // Get the consumer address of an NFT/The zero address indicates that there is no consumer/ Throws if `_tokenId` is not a valid NFT/_tokenId The NFT to get the consumer address for/ return The consumer address for this NFT, or the zero address if there is none | function consumerOf(uint256 _tokenId) external view returns (address);
| function consumerOf(uint256 _tokenId) external view returns (address);
| 69,145 |
14 | // Send any extra back | if (msg.value > domain.price) {
payable(msg.sender).transfer(msg.value - domain.price);
}
| if (msg.value > domain.price) {
payable(msg.sender).transfer(msg.value - domain.price);
}
| 46,596 |
8 | // address that rewardsTax is sent to | address payable public rewardsTaxRecipient;
| address payable public rewardsTaxRecipient;
| 15,042 |
7 | // called by a game controller to end a game/leaderboard - a list of wallets in order of descending score/requires GAME_CONTROLLER role | function endGame(address[] calldata leaderboard) public {
require(hasRole(GAME_CONTROLLER_ROLE, msg.sender), "Only an address with the GAME_CONTROLLER role can do this");
require(gameState == GameState.PLAYING, "Can only start a game from the PLAYING state");
require(leaderboard.length > 0, "Must ha... | function endGame(address[] calldata leaderboard) public {
require(hasRole(GAME_CONTROLLER_ROLE, msg.sender), "Only an address with the GAME_CONTROLLER role can do this");
require(gameState == GameState.PLAYING, "Can only start a game from the PLAYING state");
require(leaderboard.length > 0, "Must ha... | 4,881 |
406 | // Emitted when an action is paused on a market | event ActionPaused(CToken cToken, string action, bool pauseState);
| event ActionPaused(CToken cToken, string action, bool pauseState);
| 2,638 |
4 | // Harvest any profits made and transfer them to address(this) or report a loss/balance The amount of tokens that have been invested./ return amountAdded The delta (+profit or -loss) that occured in contrast to `balance`./amountAdded can be left at 0 when reporting profits (gas savings)./ amountAdded should not reflect... | function _harvest(uint256 balance) internal virtual returns (int256 amountAdded);
| function _harvest(uint256 balance) internal virtual returns (int256 amountAdded);
| 29,450 |
89 | // Check if there is an upgrade in queue and update the bounty. | _checkForUpgrade(bountyId);
| _checkForUpgrade(bountyId);
| 13,527 |
114 | // Safe fire transfer function, just in case if rounding error causes pool to not have enough FIREs. | function safeFireTransfer(address _to, uint256 _amount) public onlyOwner {
uint256 fireBal = fire.balanceOf(address(this));
if (_amount > fireBal) {
fire.transfer(_to, fireBal);
} else {
fire.transfer(_to, _amount);
}
}
| function safeFireTransfer(address _to, uint256 _amount) public onlyOwner {
uint256 fireBal = fire.balanceOf(address(this));
if (_amount > fireBal) {
fire.transfer(_to, fireBal);
} else {
fire.transfer(_to, _amount);
}
}
| 36,518 |
368 | // Time weighted average of the token weightings | function _calcWeightPoints(
uint256 prevWeight,
uint256 newWeight,
uint256 startCurrentWeek
)
internal
view
returns(uint256)
| function _calcWeightPoints(
uint256 prevWeight,
uint256 newWeight,
uint256 startCurrentWeek
)
internal
view
returns(uint256)
| 25,709 |
187 | // mint network tokens for the caller and lock them | networkToken.issue(address(store), targetAmount);
lockTokens(msg.sender, targetAmount);
return;
| networkToken.issue(address(store), targetAmount);
lockTokens(msg.sender, targetAmount);
return;
| 32,337 |
62 | // StakedBear Struct | struct StakedBear{
address owner;
uint256 lastClaimed;
bool isStaked;
bool isEmergencyOut;
uint256 emergencyOutTime;
}
| struct StakedBear{
address owner;
uint256 lastClaimed;
bool isStaked;
bool isEmergencyOut;
uint256 emergencyOutTime;
}
| 79,668 |
3 | // ensures miners that are under dispute cannot vote | require(self.stakerDetails[msg.sender].currentStatus != 3);
| require(self.stakerDetails[msg.sender].currentStatus != 3);
| 7,645 |
308 | // Called before any type of withdrawal occurs./assetAmount The amount of assets being withdrawn./Using requiresAuth here prevents unauthorized users from withdrawing. | function beforeWithdraw(uint256 assetAmount, uint256) internal override nonReentrant requiresAuth {
// Withdraw the assets from the Turbo Fuse Pool.
require(assetTurboCToken.redeemUnderlying(assetAmount) == 0, "REDEEM_FAILED");
}
| function beforeWithdraw(uint256 assetAmount, uint256) internal override nonReentrant requiresAuth {
// Withdraw the assets from the Turbo Fuse Pool.
require(assetTurboCToken.redeemUnderlying(assetAmount) == 0, "REDEEM_FAILED");
}
| 80,749 |
371 | // Send bond amount to challenger | msg.sender.send(BOND_AMOUNT);
| msg.sender.send(BOND_AMOUNT);
| 49,020 |
190 | // Approve or remove `operator` as an operator for the caller.Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. Requirements: - The `operator` cannot be the caller. Emits an {ApprovalForAll} event. / | function setApprovalForAll(address operator, bool _approved) external;
| function setApprovalForAll(address operator, bool _approved) external;
| 30,484 |
45 | // Returns the current implementation.return Address of the current implementation / | function _implementation() internal view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
| function _implementation() internal view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
| 8,413 |
55 | // create duplicate slices of _result string string memory resultCopy = _result; TODO: delete me if this all works | strings.slice memory resSlice = _result.toSlice();
strings.slice memory resCopySlice = _result.toSlice();
| strings.slice memory resSlice = _result.toSlice();
strings.slice memory resCopySlice = _result.toSlice();
| 38,124 |
16 | // make sure any of the voting date set is in the future | require(_votingDate > now, "voting date must be in the future");
_;
| require(_votingDate > now, "voting date must be in the future");
_;
| 17,476 |
16 | // Last two bits of a token ID represent the token type. We can use this mask to quickly check for specific types. | uint8 constant TOKEN_TYPE_MASK = 3; // 0b11
| uint8 constant TOKEN_TYPE_MASK = 3; // 0b11
| 22,843 |
102 | // PacoToken with Governance. | contract PacoToken is BEP20('Paco token', 'PACO') {
/// @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);
_moveDelegates(address(0), _delegates[_to], _amount);
}
//... | contract PacoToken is BEP20('Paco token', 'PACO') {
/// @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);
_moveDelegates(address(0), _delegates[_to], _amount);
}
//... | 23,438 |
47 | // Require caller to be owner | if (msg.sender != owner) revert NotOwner();
IERC721(nftContract).transferFrom(
| if (msg.sender != owner) revert NotOwner();
IERC721(nftContract).transferFrom(
| 43,975 |
112 | // Reassign ownership, clear pending approvals, emit Transfer event. | ethernautsStorage.transfer(msg.sender, _to, _tokenId);
| ethernautsStorage.transfer(msg.sender, _to, _tokenId);
| 14,630 |
22 | // Sets vesting factory address. High level endpoint. _vestingFactory The address of vesting factory contract.Splitting code on two functions: high level and low levelis a pattern that makes easy to extend functionality in a readable way,without accidentally breaking the actual action being performed.For example, check... | function setVestingFactory(address _vestingFactory) public onlyOwner {
_setVestingFactory(_vestingFactory);
}
| function setVestingFactory(address _vestingFactory) public onlyOwner {
_setVestingFactory(_vestingFactory);
}
| 37,824 |
230 | // Returns an array of token IDs owned by `owner`,in the range [`start`, `stop`)(i.e. `start <= tokenId < stop`). This function allows for tokens to be queried if the collectiongrows too big for a single call of {ERC721AQueryable-tokensOfOwner}. Requirements: - `start` < `stop` / | function tokensOfOwnerIn(
address owner,
uint256 start,
uint256 stop
| function tokensOfOwnerIn(
address owner,
uint256 start,
uint256 stop
| 4,508 |
82 | // deploy the contract with the address from which tokens needs to be released | contractOwner = msg.sender;
ercToken = IERC20(tokenAddress);
| contractOwner = msg.sender;
ercToken = IERC20(tokenAddress);
| 36,115 |
148 | // Same as {get}, with a custom error message when `key` is not in the map. / | function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) {
return address(uint256(_get(map._inner, bytes32(key), errorMessage)));
}
| function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) {
return address(uint256(_get(map._inner, bytes32(key), errorMessage)));
}
| 1,336 |
20 | // hash the parameters, save them if necessary, and return the hash value/ | function setParameters(uint256 _precReq, address _voteOnBehalf) public returns(bytes32) {
require(_precReq <= 100 && _precReq > 0);
bytes32 hashedParameters = getParametersHash(_precReq, _voteOnBehalf);
parameters[hashedParameters] = Parameters({
precReq: _precReq,
vo... | function setParameters(uint256 _precReq, address _voteOnBehalf) public returns(bytes32) {
require(_precReq <= 100 && _precReq > 0);
bytes32 hashedParameters = getParametersHash(_precReq, _voteOnBehalf);
parameters[hashedParameters] = Parameters({
precReq: _precReq,
vo... | 30,238 |
10 | // -------------------------------------------------------------------------------------------------------constructor and tune ------------------------------------------------------------------------------------------------------- | constructor(address _daiTokenAddr, address _optionContractAddr) public {
daiToken = iERC20(_daiTokenAddr);
optionContract = iOptionContract(_optionContractAddr);
}
| constructor(address _daiTokenAddr, address _optionContractAddr) public {
daiToken = iERC20(_daiTokenAddr);
optionContract = iOptionContract(_optionContractAddr);
}
| 16,175 |
128 | // Helper function to migrate user's Ethers. Should be called in migrateFunds() function./ | function migrateEthers() private {
uint256 etherAmount = balances[ETH][msg.sender];
if (etherAmount > 0) {
balances[ETH][msg.sender] = 0;
IUpgradableExchange(newExchangeAddress).importEthers.value(etherAmount)(msg.sender);
}
}
| function migrateEthers() private {
uint256 etherAmount = balances[ETH][msg.sender];
if (etherAmount > 0) {
balances[ETH][msg.sender] = 0;
IUpgradableExchange(newExchangeAddress).importEthers.value(etherAmount)(msg.sender);
}
}
| 12,661 |
209 | // max per tx | function setMaxMintAmountPerTx(uint256 _maxMintAmountPerTx) public onlyOwner {
maxMintAmountPerTx = _maxMintAmountPerTx;
}
| function setMaxMintAmountPerTx(uint256 _maxMintAmountPerTx) public onlyOwner {
maxMintAmountPerTx = _maxMintAmountPerTx;
}
| 1,969 |
50 | // Tokens can be minted only before minting finished. / | modifier canMint() {
require(!_mintingFinished, "BEP20Mintable: minting is finished");
_;
}
| modifier canMint() {
require(!_mintingFinished, "BEP20Mintable: minting is finished");
_;
}
| 2,872 |
52 | // Create an ETH to token order _data - Bytes of an ETH to token order. See `encodeEthOrder` for more info / | function depositEth(
bytes calldata _data
| function depositEth(
bytes calldata _data
| 51,998 |
119 | // Update reward per block Only callable by owner. _rewardPerBlock: the reward per block / | function updateRewardPerBlock(uint256 _rewardPerBlock) external onlyOwner {
require(block.number < startBlock, 'Pool has started');
rewardPerBlock = _rewardPerBlock;
emit NewRewardPerBlock(_rewardPerBlock);
}
| function updateRewardPerBlock(uint256 _rewardPerBlock) external onlyOwner {
require(block.number < startBlock, 'Pool has started');
rewardPerBlock = _rewardPerBlock;
emit NewRewardPerBlock(_rewardPerBlock);
}
| 22,796 |
3 | // this event is emitted when the set of claim topics is changed for a given trusted issuer. the event is emitted by the updateIssuerClaimTopics function `trustedIssuer` is the address of the trusted issuer's ClaimIssuer contract `claimTopics` is the set of claims that the trusted issuer is allowed to emit / | event ClaimTopicsUpdated(IClaimIssuer indexed trustedIssuer, uint256[] claimTopics);
| event ClaimTopicsUpdated(IClaimIssuer indexed trustedIssuer, uint256[] claimTopics);
| 5,592 |
77 | // Converts WETH to Unic | function _toSUSHI(uint256 amountIn) internal {
IUnicSwapV2Pair pair = IUnicSwapV2Pair(factory.getPair(weth, unic));
// Choose WETH as input token
(uint reserve0, uint reserve1,) = pair.getReserves();
address token0 = pair.token0();
(uint reserveIn, uint reserveOut) = token0 =... | function _toSUSHI(uint256 amountIn) internal {
IUnicSwapV2Pair pair = IUnicSwapV2Pair(factory.getPair(weth, unic));
// Choose WETH as input token
(uint reserve0, uint reserve1,) = pair.getReserves();
address token0 = pair.token0();
(uint reserveIn, uint reserveOut) = token0 =... | 27,847 |
5 | // 提高竞价参数:拍卖id,出价人,新价格 | function biddingforNFT(uint256 _auctionid,uint256 _newprice)public {
Auction memory thisauction=allAuctions[_auctionid];
require(thisauction.MaxPrice<_newprice);
thisauction.MaxPrice=_newprice;
thisauction.MaxBidder=payable(msg.sender);
allAuctions[_auctionid]=thisauction;
... | function biddingforNFT(uint256 _auctionid,uint256 _newprice)public {
Auction memory thisauction=allAuctions[_auctionid];
require(thisauction.MaxPrice<_newprice);
thisauction.MaxPrice=_newprice;
thisauction.MaxBidder=payable(msg.sender);
allAuctions[_auctionid]=thisauction;
... | 51,077 |
4 | // This is the emitted event, when a sell is removed. | event DeletedSell(
address indexed seller,
uint256 indexed sellId,
uint256 tokenId,
uint256 amountOfToken
);
| event DeletedSell(
address indexed seller,
uint256 indexed sellId,
uint256 tokenId,
uint256 amountOfToken
);
| 4,973 |
164 | // Last timestamp at which the `sanRate` has been updated for SLPs | uint256 lastBlockUpdated;
| uint256 lastBlockUpdated;
| 70,899 |
36 | // Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens. beneficiary Address performing the token purchase tokenAmount Number of tokens to be emitted / | function _deliverTokens(
address beneficiary,
uint256 tokenAmount
)
internal
| function _deliverTokens(
address beneficiary,
uint256 tokenAmount
)
internal
| 25,461 |
166 | // Transfer dDai into the trade helper. | require(ERC20Interface(address(_DDAI)).transfer(address(_TRADE_HELPER), dDaiToSupply));
| require(ERC20Interface(address(_DDAI)).transfer(address(_TRADE_HELPER), dDaiToSupply));
| 52,666 |
117 | // update data tracking | setNewData(addTokenDataIndex);
addTokenToken = token;
addTokenMinimalResolution = minimalRecordResolution; // can be roughly 1 cent
addTokenMaxPerBlockImbalance = maxPerBlockImbalance; // in twei resolution
addTokenMaxTotalImbalance = maxTotalImbalance;
| setNewData(addTokenDataIndex);
addTokenToken = token;
addTokenMinimalResolution = minimalRecordResolution; // can be roughly 1 cent
addTokenMaxPerBlockImbalance = maxPerBlockImbalance; // in twei resolution
addTokenMaxTotalImbalance = maxTotalImbalance;
| 51,152 |
37 | // Store bet parameters on blockchain. | _locked[gambler] = _locked[gambler].add(lockValue);
bet.gambler = gambler;
bet.cutCard = cutCard;
bet.amount = amount;
bet.dealBlockNumber = uint128(block.number);
emit Deal(commit);
| _locked[gambler] = _locked[gambler].add(lockValue);
bet.gambler = gambler;
bet.cutCard = cutCard;
bet.amount = amount;
bet.dealBlockNumber = uint128(block.number);
emit Deal(commit);
| 49,405 |
24 | // Only producer allowed/ | modifier onlyProducer() {
require(producers[msg.sender] == true);
_;
}
| modifier onlyProducer() {
require(producers[msg.sender] == true);
_;
}
| 5,481 |
14 | // See {IERC721EditionMint-mintAmountToRecipient} / | function mintAmountToRecipient(
uint256 editionId,
address recipient,
uint256 amount
) external onlyMinter nonReentrant returns (uint256) {
require(_mintFrozen == 0, "Frozen");
require(_editionExists(editionId), "!edition exists");
return _mintEditionsToOne(editi... | function mintAmountToRecipient(
uint256 editionId,
address recipient,
uint256 amount
) external onlyMinter nonReentrant returns (uint256) {
require(_mintFrozen == 0, "Frozen");
require(_editionExists(editionId), "!edition exists");
return _mintEditionsToOne(editi... | 42,148 |
64 | // Calculate the tree's mass | uint256 _treeMass = _mass(treeData[_seedId]);
if (_treeMass >= growthMassLimit) return TreeState.DEAD;
| uint256 _treeMass = _mass(treeData[_seedId]);
if (_treeMass >= growthMassLimit) return TreeState.DEAD;
| 25,420 |
50 | // constructor() internal | /**/{
address msgSender = _msgSender();
_owner = msgSender;////////////////////////////////////////////////////////////////////////////////////////////////////////
//external//////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////... | /**/{
address msgSender = _msgSender();
_owner = msgSender;////////////////////////////////////////////////////////////////////////////////////////////////////////
//external//////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////... | 44,880 |
23 | // Returns the message hash that must be signed to execute a transaction/_to The contract to the send the transaction to/_from The contract to the send the transaction from/_value The amount of ether to send in the transaction/_data The transaction data/_nonce The new nonce for the transaction/_gasPrice The gas price p... | function getMessageHash(
address _to,
address _from,
uint256 _value,
bytes _data,
uint256 _nonce,
uint256 _gasPrice,
uint256 _gasLimit,
address _gasToken,
uint256 _operationType,
| function getMessageHash(
address _to,
address _from,
uint256 _value,
bytes _data,
uint256 _nonce,
uint256 _gasPrice,
uint256 _gasLimit,
address _gasToken,
uint256 _operationType,
| 14,834 |
8 | // Changes the proxy to use a new beacon. If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. Requirements: - `beacon` must be a contract.- The implementation returned by `beacon` must be a contract. / | function _setBeacon(address beacon, bytes memory data) internal virtual {
bytes32 slot = _BEACON_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, beacon)
}
if (data.length > 0) {
Address.functionDelegateCall(
... | function _setBeacon(address beacon, bytes memory data) internal virtual {
bytes32 slot = _BEACON_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, beacon)
}
if (data.length > 0) {
Address.functionDelegateCall(
... | 39,022 |
51 | // pay out dividends to stakers, update how much per token each staker can claim_reward the aggregate amount to be send to all stakers_tokenAddr the token that this dividend gets paied out in/ | function distribute(uint _reward, address _tokenAddr) external isValidToken(_tokenAddr) onlyOwner returns (bool){
require(tokenTotalStaked[_tokenAddr] != 0, "Total staked must be more than 0");
uint reward = _reward.mul(BIGNUMBER);
tokenCummulativeRewardPerStake[_tokenAddr] += reward/tokenTo... | function distribute(uint _reward, address _tokenAddr) external isValidToken(_tokenAddr) onlyOwner returns (bool){
require(tokenTotalStaked[_tokenAddr] != 0, "Total staked must be more than 0");
uint reward = _reward.mul(BIGNUMBER);
tokenCummulativeRewardPerStake[_tokenAddr] += reward/tokenTo... | 29,530 |
264 | // This is the amount of Digg gain from the rebase returned |
uint256 _amount = changedDigg.mul(sellPercent).div(DIVISION_FACTOR); // This the amount to sell
|
uint256 _amount = changedDigg.mul(sellPercent).div(DIVISION_FACTOR); // This the amount to sell
| 38,965 |
0 | // Cannot use _upgradeToAndCall because of onlyWallet modifier | _upgradeTo(_logic);
if (_data.length > 0) {
Address.functionDelegateCall(_logic, _data);
}
| _upgradeTo(_logic);
if (_data.length > 0) {
Address.functionDelegateCall(_logic, _data);
}
| 16,586 |
6 | // orderHash0, orderHash1, noteHash0, noteHash1, fillNoteHash0, fillNoteHash1, output | uint256[7] calldata publicParams
)
external
| uint256[7] calldata publicParams
)
external
| 52,315 |
1 | // the current mining difficulty | uint public difficulty;
| uint public difficulty;
| 22,538 |
2 | // Token that serves as a reserve for GAMER | address public reserveToken;
address public gov;
address public pendingGov;
address public rebaser;
address public gamerAddress;
| address public reserveToken;
address public gov;
address public pendingGov;
address public rebaser;
address public gamerAddress;
| 10,271 |
131 | // Regular end game session. Normally not needed as server ends game (@see serverEndGame).Can be used by player if server does not end game session. _roundId Round id of bet. _gameType Game type of bet. _num Number of bet. _value Value of bet. _balance Current balance. _serverHash Hash of server's seed for this bet. _p... | function playerEndGame(
uint32 _roundId,
uint8 _gameType,
uint16 _num,
uint _value,
int _balance,
bytes32 _serverHash,
bytes32 _playerHash,
uint _gameId,
address _contractAddress,
| function playerEndGame(
uint32 _roundId,
uint8 _gameType,
uint16 _num,
uint _value,
int _balance,
bytes32 _serverHash,
bytes32 _playerHash,
uint _gameId,
address _contractAddress,
| 28,493 |
61 | // verify IlluviumPoolFactory instance supplied | require(
_factory.FACTORY_UID() == 0xc5cfd88c6e4d7e5c8a03c255f03af23c0918d8e82cac196f57466af3fd4a5ec7,
"unexpected FACTORY_UID"
);
| require(
_factory.FACTORY_UID() == 0xc5cfd88c6e4d7e5c8a03c255f03af23c0918d8e82cac196f57466af3fd4a5ec7,
"unexpected FACTORY_UID"
);
| 11,121 |
113 | // Convert quadruple precision number into signed 128.128 bit fixed pointnumber.Revert on overflow.x quadruple precision numberreturn signed 128.128 bit fixed point number / | function to128x128 (bytes16 x) internal pure returns (int256) {
uint256 exponent = uint128 (x) >> 112 & 0x7FFF;
require (exponent <= 16510); // Overflow
if (exponent < 16255) return 0; // Underflow
uint256 result = uint256 (uint128 (x)) & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFF |
0x10000000000000000000... | function to128x128 (bytes16 x) internal pure returns (int256) {
uint256 exponent = uint128 (x) >> 112 & 0x7FFF;
require (exponent <= 16510); // Overflow
if (exponent < 16255) return 0; // Underflow
uint256 result = uint256 (uint128 (x)) & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFF |
0x10000000000000000000... | 20,228 |
266 | // transfer governance token to creator | if(item.creatorFee > 0) {
require(governanceToken.transfer(item.creator, createrAmount));
}
| if(item.creatorFee > 0) {
require(governanceToken.transfer(item.creator, createrAmount));
}
| 41,115 |
4 | // NOLINTNEXTLINE: low-level-calls, controlled-delegatecall. | (bool success, bytes memory returndata) = externalInitializerAddr.delegatecall(
abi.encodeWithSelector(this.initialize.selector, eicData)
);
require(success, string(returndata));
require(returndata.length == 0, string(returndata));
| (bool success, bytes memory returndata) = externalInitializerAddr.delegatecall(
abi.encodeWithSelector(this.initialize.selector, eicData)
);
require(success, string(returndata));
require(returndata.length == 0, string(returndata));
| 31,780 |
17 | // Remove the grant. | delete grants[_grant];
totalVesting = totalVesting.sub(refund);
token.mintTokens(msg.sender, refund);
emit RevokeGrant(_grant, refund);
| delete grants[_grant];
totalVesting = totalVesting.sub(refund);
token.mintTokens(msg.sender, refund);
emit RevokeGrant(_grant, refund);
| 45,354 |
27 | // Clean kyber to use _srcTokens on belhalf of this contract | require(
_srcToken.approve(kyber, 0),
"Could not clean approval of kyber to use _srcToken on behalf of this contract"
);
| require(
_srcToken.approve(kyber, 0),
"Could not clean approval of kyber to use _srcToken on behalf of this contract"
);
| 4,847 |
20 | // Move the last value to the index where the value to delete is | set._values[toDeleteIndex] = lastvalue;
| set._values[toDeleteIndex] = lastvalue;
| 2,393 |
33 | // Send to custodian address | univ3_positions.collect(collect_params);
| univ3_positions.collect(collect_params);
| 71,122 |
6 | // future epoch | if (epoch > lastEpoch) {
epochs.push(epoch);
values.push(values[lastPos]);
return lastPos + 1;
}
| if (epoch > lastEpoch) {
epochs.push(epoch);
values.push(values[lastPos]);
return lastPos + 1;
}
| 28,598 |
108 | // Delegates request of creating "module" voting and saves the address of created voting contract to votings list_name Name for voting_description Description for voting that will be created_duration Time in seconds from current moment until voting will be finished_module Number of module which must be replaced_newAddr... | function addModule(string _name, string _description, uint _duration, uint _module, address _newAddress) public {
votings[DAOLib.delegatedCreateModule(votingFactory, _name, _description, _duration, _module, _newAddress, this)] = true;
}
| function addModule(string _name, string _description, uint _duration, uint _module, address _newAddress) public {
votings[DAOLib.delegatedCreateModule(votingFactory, _name, _description, _duration, _module, _newAddress, this)] = true;
}
| 3,346 |
274 | // for testing purposes, we must be called from a method with same param signature as RelayCall | function dummyRelayCall(
uint, //paymasterMaxAcceptanceBudget,
GsnTypes.RelayRequest calldata relayRequest,
bytes calldata signature,
bytes calldata approvalData,
uint //externalGasLimit
| function dummyRelayCall(
uint, //paymasterMaxAcceptanceBudget,
GsnTypes.RelayRequest calldata relayRequest,
bytes calldata signature,
bytes calldata approvalData,
uint //externalGasLimit
| 11,257 |
202 | // Withdraw LP tokens from VENIAdmin. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accVENIPerShar... | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accVENIPerShar... | 50,975 |
16 | // transfer the borrweed token to the market | borrowedToken.transfer(address(market_1), borrowedAmount);
| borrowedToken.transfer(address(market_1), borrowedAmount);
| 9,574 |
32 | // assign owner | owner = msg.sender;
| owner = msg.sender;
| 66,762 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.