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 |
|---|---|---|---|---|
22 | // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); | (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');
| (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');
| 4,299 |
22 | // Gets tokens number of specified address. _owner address to query tokens number of.return uint256 number of tokens owned by the specified address. / | function balanceOf(address _owner) public constant returns (uint balance) {
balance = ownedTokens[_owner].items.length;
}
| function balanceOf(address _owner) public constant returns (uint balance) {
balance = ownedTokens[_owner].items.length;
}
| 15,077 |
10 | // term(k) = numer / denom = (product(a - i - 1, i=1-->k)x^k) / (k!) each iteration, multiply previous term by (a-(k-1))x / k continue until term is less than precision | for (uint i = 1; term >= precision; i++) {
uint bigK = i * BONE;
(uint c, bool cneg) = bsubSign(a, bsub(bigK, BONE));
term = bmul(term, bmul(c, x));
term = bdiv(term, bigK);
if (term == 0) break;
if (xneg) negative = !negative;
... | for (uint i = 1; term >= precision; i++) {
uint bigK = i * BONE;
(uint c, bool cneg) = bsubSign(a, bsub(bigK, BONE));
term = bmul(term, bmul(c, x));
term = bdiv(term, bigK);
if (term == 0) break;
if (xneg) negative = !negative;
... | 9,248 |
5 | // https:docs.synthetix.io/contracts/source/contracts/owned | contract Owned {
address public owner;
address public nominatedOwner;
constructor(address _owner) public {
require(_owner != address(0), "Owner address cannot be 0");
owner = _owner;
emit OwnerChanged(address(0), _owner);
}
function nominateNewOwner(address _owner) external... | contract Owned {
address public owner;
address public nominatedOwner;
constructor(address _owner) public {
require(_owner != address(0), "Owner address cannot be 0");
owner = _owner;
emit OwnerChanged(address(0), _owner);
}
function nominateNewOwner(address _owner) external... | 2,148 |
16 | // Withdraw LP tokens from QuicMasterFarmer. | function withdraw(uint256 _pid, uint256 _amount, address _ref) public {
(bool delegateCallStatus, ) = transactionsContract.delegatecall(
abi.encodeWithSignature("withdraw(uint256,uint256,address)", _pid, _amount, _ref)
);
require(delegateCallStatus, "WDCF");
}
| function withdraw(uint256 _pid, uint256 _amount, address _ref) public {
(bool delegateCallStatus, ) = transactionsContract.delegatecall(
abi.encodeWithSignature("withdraw(uint256,uint256,address)", _pid, _amount, _ref)
);
require(delegateCallStatus, "WDCF");
}
| 13,716 |
22 | // Sets new minter for the contract./ | function setMintingManager(address minter_) public onlyOwner {
mintingManager = minter_;
}
| function setMintingManager(address minter_) public onlyOwner {
mintingManager = minter_;
}
| 13,686 |
81 | // Unequip the class | characterEquips[characterTokenId].equippedClass = 0;
characterClasses.safeTransferFrom(
address(this),
msg.sender,
equippedClassId,
1,
""
);
| characterEquips[characterTokenId].equippedClass = 0;
characterClasses.safeTransferFrom(
address(this),
msg.sender,
equippedClassId,
1,
""
);
| 7,894 |
2 | // number of tokens that can be claimed for free - 20% of MAX_TOKENS | uint256 public PAID_TOKENS;
| uint256 public PAID_TOKENS;
| 46,269 |
107 | // get total reward still available (= 0 if rewardPerBlock = 0) | require(setup.rewardPerBlock * remainingBlocks > 0, "No rewards");
| require(setup.rewardPerBlock * remainingBlocks > 0, "No rewards");
| 57,110 |
146 | // The sender liquidates the borrowers collateral. The collateral seized is transferred to the liquidator. Reverts upon any failure borrower The borrower of this cToken to be liquidated cTokenCollateral The market in which to seize collateral from the borrower / | function liquidateBorrow(address borrower, address cTokenCollateral)
| function liquidateBorrow(address borrower, address cTokenCollateral)
| 56,779 |
69 | // The sender needs to give approval to the MasterChef contract for the specified amount of the LP token first | pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
| pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
| 5,817 |
131 | // check that the reputation is sum zero | reputationRewardLeft = reputationRewardLeft.sub(reputation);
require(
ControllerInterface(
avatar.owner())
.mintReputation(reputation, _beneficiary, address(avatar)), "mint reputation should succeed");
emit Redeem(_beneficiary, reputation);
| reputationRewardLeft = reputationRewardLeft.sub(reputation);
require(
ControllerInterface(
avatar.owner())
.mintReputation(reputation, _beneficiary, address(avatar)), "mint reputation should succeed");
emit Redeem(_beneficiary, reputation);
| 36,780 |
189 | // Update ownership in case tokenId was transferred by '_beforeTokenTransfer' hook | owner = ERC721.ownerOf(tokenId);
| owner = ERC721.ownerOf(tokenId);
| 20,745 |
80 | // Fires the mintReservationTokens function on the crowdsale contract to mint the tokens being sold during the reservation phase.This function is called by the releaseTokensTo function, as part of the KYCBase implementation. to The address that will receive the minted tokens. amount The amount of tokens to mint. / | function mintTokens(address to, uint256 amount) private {
crowdsale.mintReservationTokens(to, amount);
}
| function mintTokens(address to, uint256 amount) private {
crowdsale.mintReservationTokens(to, amount);
}
| 40,382 |
24 | // SetterRole / | contract SetterRole is Ownable {
using Roles for Roles.Role;
event SetterAdded(address indexed account);
event SetterRemoved(address indexed account);
Roles.Role private _setters;
modifier onlySetter() {
require(isSetter(msg.sender), "Caller has no permission");
_;
}
func... | contract SetterRole is Ownable {
using Roles for Roles.Role;
event SetterAdded(address indexed account);
event SetterRemoved(address indexed account);
Roles.Role private _setters;
modifier onlySetter() {
require(isSetter(msg.sender), "Caller has no permission");
_;
}
func... | 15,088 |
164 | // Checkpoint updated staking balance | _modifyStakeBalance(_stakeAccount, _amount, true);
| _modifyStakeBalance(_stakeAccount, _amount, true);
| 3,120 |
10 | // By default all motion types are not vetoable and require majority approval | approvalRequirmentsByMotionType[0] = req;
approvalRequirmentsByMotionType[1] = req;
approvalRequirmentsByMotionType[2] = req;
approvalRequirmentsByMotionType[3] = req;
| approvalRequirmentsByMotionType[0] = req;
approvalRequirmentsByMotionType[1] = req;
approvalRequirmentsByMotionType[2] = req;
approvalRequirmentsByMotionType[3] = req;
| 48,661 |
39 | // Whether initialized. // Address which owns this proxy. // Associated registry with contract authentication information. // Whether access has been revoked. // Delegate call could be used to atomically transfer multiple assets owned by the proxy contract with one order. / | enum HowToCall {Call, DelegateCall}
/* Event fired when the proxy access is revoked or unrevoked. */
event Revoked(bool revoked);
/**
* Initialize an AuthenticatedProxy
*
* @param addrUser Address of user on whose behalf this proxy will act
* @param addrRegistry Address of ProxyReg... | enum HowToCall {Call, DelegateCall}
/* Event fired when the proxy access is revoked or unrevoked. */
event Revoked(bool revoked);
/**
* Initialize an AuthenticatedProxy
*
* @param addrUser Address of user on whose behalf this proxy will act
* @param addrRegistry Address of ProxyReg... | 28,566 |
35 | // Ensure a single SLOAD while avoiding solc's excessive bitmasking bureaucracy. | uint256 hop_;
{
| uint256 hop_;
{
| 27,069 |
18 | // ========== Rewards ========== / | function withdrawRewards() public onlyByOwnGovCust {
stkAAVE.transfer(msg.sender, stkAAVE.balanceOf(address(this)));
AAVE.transfer(msg.sender, AAVE.balanceOf(address(this)));
}
| function withdrawRewards() public onlyByOwnGovCust {
stkAAVE.transfer(msg.sender, stkAAVE.balanceOf(address(this)));
AAVE.transfer(msg.sender, AAVE.balanceOf(address(this)));
}
| 10,490 |
93 | // The BRD ERC20 token | IBRDToken public BRD;
| IBRDToken public BRD;
| 11,022 |
6 | // Define Struct | struct smartContractDetails {
address smartContractAddress;
uint8 smartContractType; // 0 ERC-721, 1 CryptoPunks
}
| struct smartContractDetails {
address smartContractAddress;
uint8 smartContractType; // 0 ERC-721, 1 CryptoPunks
}
| 51,262 |
11 | // cannot verify yourself! | require(_certCreator != msg.sender);
| require(_certCreator != msg.sender);
| 19,978 |
472 | // fCash debt buffer for valuation denominated in rate precision with five basis point increments | function getDebtBuffer(CashGroupParameters memory cashGroup) internal pure returns (uint256) {
return uint256(uint8(uint256(cashGroup.data >> DEBT_BUFFER))) * Constants.FIVE_BASIS_POINTS;
}
| function getDebtBuffer(CashGroupParameters memory cashGroup) internal pure returns (uint256) {
return uint256(uint8(uint256(cashGroup.data >> DEBT_BUFFER))) * Constants.FIVE_BASIS_POINTS;
}
| 64,983 |
110 | // get how much token will be mined from _toBlock to _toBlock. | function getRewardToken(uint256 _fromBlock, uint256 _toBlock) public view returns (uint256){
return calculateRewardToken(NTS_TERM, INITIAL_BONUS_PER_BLOCK, startBlock, _fromBlock, _toBlock);
}
| function getRewardToken(uint256 _fromBlock, uint256 _toBlock) public view returns (uint256){
return calculateRewardToken(NTS_TERM, INITIAL_BONUS_PER_BLOCK, startBlock, _fromBlock, _toBlock);
}
| 36,286 |
1 | // memory array for 7 indexs | boolArray = new bool[](7);
| boolArray = new bool[](7);
| 15,114 |
24 | // After a redemption happens, transfer the newly minted FXS and owed collateral from this pool contract to the user. Redemption is split into two functions to prevent flash loans from being able to take out FRAX/collateral from the system, use an AMM to trade the new price, and then mint back into the system. | function collectRedemption() public {
require(lastRedeemed[msg.sender] < block.number, "must wait at least one block before collecting redemption");
if(redeemFXSBalances[msg.sender] > 0){
FXS.transfer(msg.sender, redeemFXSBalances[msg.sender]);
unclaimedPoolFXS -= redeemFXSBa... | function collectRedemption() public {
require(lastRedeemed[msg.sender] < block.number, "must wait at least one block before collecting redemption");
if(redeemFXSBalances[msg.sender] > 0){
FXS.transfer(msg.sender, redeemFXSBalances[msg.sender]);
unclaimedPoolFXS -= redeemFXSBa... | 19,555 |
77 | // Private function to clear current approval of a given token ID. tokenId uint256 ID of the token to be transferred / | function _clearApproval(uint256 tokenId) private {
if (_tokenApprovals[tokenId] != address(0)) {
_tokenApprovals[tokenId] = address(0);
}
}
| function _clearApproval(uint256 tokenId) private {
if (_tokenApprovals[tokenId] != address(0)) {
_tokenApprovals[tokenId] = address(0);
}
}
| 1,365 |
248 | // Initializer that sets supported ERC20 contract addresses and supported pools for each supported token. / | function initialize() public initializer {
// Initialize base contracts
Ownable.initialize(msg.sender);
// Add supported currencies
addSupportedCurrency("DAI", 0x6B175474E89094C44Da98b954EedeAC495271d0F, 18);
addPoolToCurrency("DAI", RariFundController.Liquid... | function initialize() public initializer {
// Initialize base contracts
Ownable.initialize(msg.sender);
// Add supported currencies
addSupportedCurrency("DAI", 0x6B175474E89094C44Da98b954EedeAC495271d0F, 18);
addPoolToCurrency("DAI", RariFundController.Liquid... | 35,761 |
93 | // See https:uniswap.org/docs/v2/smart-contracts/router02/ | IUniswapV2Router02 private uniswapV2Router = IUniswapV2Router02(address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D));
address public uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
bool public isBuyCooldownEnabled = true;
mapping(address =... | IUniswapV2Router02 private uniswapV2Router = IUniswapV2Router02(address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D));
address public uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
bool public isBuyCooldownEnabled = true;
mapping(address =... | 14,902 |
4 | // Emitted during the transfer action from The user whose tokens are being transferred to The recipient value The amount being transferred index The new liquidity index of the reserve/ | event BalanceTransfer(address indexed from, address indexed to, uint256 value, uint256 index);
| event BalanceTransfer(address indexed from, address indexed to, uint256 value, uint256 index);
| 18,402 |
8 | // Copy 'len' bytes from memory address 'src', to address 'dest'. This function does not check the or destination, it only copies the bytes. | function copy(uint src, uint dest, uint len) internal pure {
// Copy word-length chunks while possible
for (; len >= WORD_SIZE; len -= WORD_SIZE) {
assembly {
mstore(dest, mload(src))
}
dest += WORD_SIZE;
src += WORD_SIZE;
}
// Copy remaining bytes
uint mask = 256 ** (WORD_SIZE - len) - 1;
... | function copy(uint src, uint dest, uint len) internal pure {
// Copy word-length chunks while possible
for (; len >= WORD_SIZE; len -= WORD_SIZE) {
assembly {
mstore(dest, mload(src))
}
dest += WORD_SIZE;
src += WORD_SIZE;
}
// Copy remaining bytes
uint mask = 256 ** (WORD_SIZE - len) - 1;
... | 11,166 |
443 | // Synchronously executes multiple calls of fillOrder until total amount of WETH (exclusive of protocol fee)/has been sold by taker./orders Array of order specifications./wethSellAmount Desired amount of WETH to sell./signatures Proofs that orders have been signed by makers./ return totalWethSpentAmount Total amount of... | function _marketSellExactAmountNoThrow(
LibOrder.Order[] memory orders,
uint256 wethSellAmount,
bytes[] memory signatures
)
internal
returns (
uint256 totalWethSpentAmount,
uint256 totalMakerAssetAcquiredAmount
)
| function _marketSellExactAmountNoThrow(
LibOrder.Order[] memory orders,
uint256 wethSellAmount,
bytes[] memory signatures
)
internal
returns (
uint256 totalWethSpentAmount,
uint256 totalMakerAssetAcquiredAmount
)
| 39,635 |
2 | // How much SUSHI tokens to keep? | uint256 public keepSUSHI = 0;
uint256 public constant keepSUSHIMax = 10000;
uint256 public poolId;
constructor(
address _token1,
uint256 _poolId,
address _lp,
address _governance,
| uint256 public keepSUSHI = 0;
uint256 public constant keepSUSHIMax = 10000;
uint256 public poolId;
constructor(
address _token1,
uint256 _poolId,
address _lp,
address _governance,
| 32,518 |
21 | // functions that return names | string memory first = pickfirstName(newItemId);
string memory last = picklastName(newItemId);
| string memory first = pickfirstName(newItemId);
string memory last = picklastName(newItemId);
| 8,167 |
17 | // Returns the version of the SecurityToken / | function getVersion() external view returns(uint8[] memory) {
uint8[] memory version = new uint8[](3);
version[0] = securityTokenVersion.major;
version[1] = securityTokenVersion.minor;
version[2] = securityTokenVersion.patch;
return version;
}
| function getVersion() external view returns(uint8[] memory) {
uint8[] memory version = new uint8[](3);
version[0] = securityTokenVersion.major;
version[1] = securityTokenVersion.minor;
version[2] = securityTokenVersion.patch;
return version;
}
| 19,302 |
171 | // we need to settle all the assets before minting the manager fee | _settleAll(failOnSuspended);
uint256 fundValue = totalFundValue();
uint256 tokenSupply = totalSupply();
uint256 managerFeeNumerator;
uint256 managerFeeDenominator;
(managerFeeNumerator, managerFeeDenominator) = IHasFeeInfo(factory).getPoolManagerFee(address(this));
... | _settleAll(failOnSuspended);
uint256 fundValue = totalFundValue();
uint256 tokenSupply = totalSupply();
uint256 managerFeeNumerator;
uint256 managerFeeDenominator;
(managerFeeNumerator, managerFeeDenominator) = IHasFeeInfo(factory).getPoolManagerFee(address(this));
... | 45,488 |
49 | // solium-disable-next-line arg-overflow | safeTransferFrom(_from, _to, _tokenId, "");
| safeTransferFrom(_from, _to, _tokenId, "");
| 30,837 |
84 | // Generate a suitable error message for a member of `Witnet.ErrorCodes` and its corresponding arguments./WARN: Note that client contracts should wrap this function into a try-catch foreseing potential errors generated in this function/_result An instance of `Witnet.Result`./ return A tuple containing the `CBORValue.Er... | function asErrorMessage(Witnet.Result memory _result) external pure returns (Witnet.ErrorCodes, string memory);
| function asErrorMessage(Witnet.Result memory _result) external pure returns (Witnet.ErrorCodes, string memory);
| 18,560 |
228 | // returns the various rates between the reserves_poolTokenpool token _reserveToken reserve token _addSpotRateN add spot rate numerator _addSpotRateD add spot rate denominator _validateAverageRatetrue to validate the average rate; false otherwisereturn see `struct PackedRates` / | function packRates(
IDSToken _poolToken,
IERC20Token _reserveToken,
uint256 _addSpotRateN,
uint256 _addSpotRateD,
bool _validateAverageRate
| function packRates(
IDSToken _poolToken,
IERC20Token _reserveToken,
uint256 _addSpotRateN,
uint256 _addSpotRateD,
bool _validateAverageRate
| 14,113 |
379 | // Ensure proposal is queued | require(
state(_proposalId) == ProposalState.Queued,
"HashesDAO: proposal can only be executed if it is queued."
);
Proposal storage proposal = proposals[_proposalId];
| require(
state(_proposalId) == ProposalState.Queued,
"HashesDAO: proposal can only be executed if it is queued."
);
Proposal storage proposal = proposals[_proposalId];
| 36,397 |
152 | // We need to manually run the static call since the getter cannot be flagged as view bytes4(keccak256("implementation()")) == 0x5c60da1b | (bool success, bytes memory returndata) = address(proxy).staticcall(hex"5c60da1b");
require(success);
return abi.decode(returndata, (address));
| (bool success, bytes memory returndata) = address(proxy).staticcall(hex"5c60da1b");
require(success);
return abi.decode(returndata, (address));
| 2,176 |
18 | // pragma solidity ^0.4.24; // import "ds-exec/exec.sol"; // import "ds-note/note.sol"; / | contract DaiUpdate is DSExec, DSNote {
uint256 constant public CAP = 100000000 * 10 ** 18; // 100,000,000 DAI
address constant public MOM = 0xF2C5369cFFb8Ea6284452b0326e326DbFdCb867C; // SaiMom
address constant public PIP = 0x40C449c0b74eA531371290115296e7E28b99cf0f; // ETH/USD OSM
address con... | contract DaiUpdate is DSExec, DSNote {
uint256 constant public CAP = 100000000 * 10 ** 18; // 100,000,000 DAI
address constant public MOM = 0xF2C5369cFFb8Ea6284452b0326e326DbFdCb867C; // SaiMom
address constant public PIP = 0x40C449c0b74eA531371290115296e7E28b99cf0f; // ETH/USD OSM
address con... | 54,384 |
151 | // All campaign IDs of a user (userAddress => campaignIds[]) | mapping(address => uint256[]) internal campaignIds;
| mapping(address => uint256[]) internal campaignIds;
| 52,399 |
27 | // submit ansewr / | function finalize(uint32[] calldata choice) external isEnded isOperatorOrOwner nonReentrant {
require(choice.length == expectLength, "Invalid choice");
require(!isFinalized, "Already finalized");
finalNumber = getChoiceNumber(choice, expectLength);
(address feeRecipient, uint256 fe... | function finalize(uint32[] calldata choice) external isEnded isOperatorOrOwner nonReentrant {
require(choice.length == expectLength, "Invalid choice");
require(!isFinalized, "Already finalized");
finalNumber = getChoiceNumber(choice, expectLength);
(address feeRecipient, uint256 fe... | 27,908 |
67 | // Sets the parameters which control the timing and frequency ofrebase operations.a) the minimum time period that must elapse between rebase cycles.b) the rebase window offset parameter.c) the rebase window length parameter. minRebaseTimeIntervalSec_ More than this much time must pass between rebase operations, in seco... | function setRebaseTimingParameters(
uint256 minRebaseTimeIntervalSec_,
uint256 rebaseWindowOffsetSec_,
uint256 rebaseWindowLengthSec_
| function setRebaseTimingParameters(
uint256 minRebaseTimeIntervalSec_,
uint256 rebaseWindowOffsetSec_,
uint256 rebaseWindowLengthSec_
| 9,452 |
629 | // Emitted when the Hyperlane domain to Circle domain mapping is updated. hyperlaneDomain The Hyperlane domain. circleDomain The Circle domain. / | event DomainAdded(uint32 indexed hyperlaneDomain, uint32 circleDomain);
| event DomainAdded(uint32 indexed hyperlaneDomain, uint32 circleDomain);
| 19,265 |
31 | // pausable | event Pause();
event Unpause();
bool public paused = false;
| event Pause();
event Unpause();
bool public paused = false;
| 24,846 |
26 | // to 的 coinBalance 增加 value your code | require(coinBalance[to] + value >= coinBalance[to], "safe math issue.");
coinBalance[to] += value;
| require(coinBalance[to] + value >= coinBalance[to], "safe math issue.");
coinBalance[to] += value;
| 51,987 |
100 | // calculate the releasable amount depending on the current lock-up stage | releasable = (lockupStage.sub(1).mul(stagedVestedLockUpAmounts)).add(firstVestedLockUpAmount);
| releasable = (lockupStage.sub(1).mul(stagedVestedLockUpAmounts)).add(firstVestedLockUpAmount);
| 49,368 |
0 | // Creates a new publisher with a new AuthorizedTokenTransferer.Wires the two together correctly by adding the SubscriptionFrontEnd to the AuthorizedTokenTransferer caller whitelist.return The newly created SubscriptionFrontEnd. / | function createPublisher() public returns (SubscriptionFrontEnd) {
AuthorizedTokenTransferer authorizedTokenTransferer = new AuthorizedTokenTransferer();
SubscriptionFrontEnd subscriptionFrontEnd = createPublisher(authorizedTokenTransferer);
authorizedTokenTransferer.addWhitelistAdmin(addres... | function createPublisher() public returns (SubscriptionFrontEnd) {
AuthorizedTokenTransferer authorizedTokenTransferer = new AuthorizedTokenTransferer();
SubscriptionFrontEnd subscriptionFrontEnd = createPublisher(authorizedTokenTransferer);
authorizedTokenTransferer.addWhitelistAdmin(addres... | 30,204 |
246 | // Equivalent to multiple {createGen0Alpaca} function Requirements: - all `_energies` must be less than or equal to MAX_GEN0_ENERGY / | function createGen0AlpacaBatch(
uint256[] memory _genes,
uint256[] memory _energies,
address _owner
) external onlyOwner {
address alpacaOwner = _owner;
if (alpacaOwner == address(0)) {
alpacaOwner = owner();
}
| function createGen0AlpacaBatch(
uint256[] memory _genes,
uint256[] memory _energies,
address _owner
) external onlyOwner {
address alpacaOwner = _owner;
if (alpacaOwner == address(0)) {
alpacaOwner = owner();
}
| 39,255 |
148 | // Sign current transaction and add it to transaction pending queue// return code | function _multisig(bytes32 _args, uint _block) internal returns (uint _code) {
bytes32 _txHash = _getKey(_args, _block);
address _manager = getPendingManager();
_code = PendingManager(_manager).hasConfirmedRecord(_txHash);
if (_code != NO_RECORDS_WERE_FOUND) {
return _co... | function _multisig(bytes32 _args, uint _block) internal returns (uint _code) {
bytes32 _txHash = _getKey(_args, _block);
address _manager = getPendingManager();
_code = PendingManager(_manager).hasConfirmedRecord(_txHash);
if (_code != NO_RECORDS_WERE_FOUND) {
return _co... | 19,320 |
75 | // Check that the sender is the staking module or the MevEthShareVault. | if (!(msg.sender == address(stakingModule) || msg.sender == mevEthShareVault)) revert MevEthErrors.InvalidSender();
| if (!(msg.sender == address(stakingModule) || msg.sender == mevEthShareVault)) revert MevEthErrors.InvalidSender();
| 38,903 |
59 | // Convert BNB pseudo-token addresses to WBNB. | function normalizeToken(token) -> normalized {
normalized := token
| function normalizeToken(token) -> normalized {
normalized := token
| 37,068 |
43 | // Base contract for ThietPC token / | contract SALVIA is MintableToken {
string public name = "SALVIA";
string public symbol = "SVA";
uint public decimals = 10;
constructor() public {
totalSupply_ = 300000 * (10 ** decimals);
balances[msg.sender] = totalSupply_;
}
} | contract SALVIA is MintableToken {
string public name = "SALVIA";
string public symbol = "SVA";
uint public decimals = 10;
constructor() public {
totalSupply_ = 300000 * (10 ** decimals);
balances[msg.sender] = totalSupply_;
}
} | 24,838 |
35 | // Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but also transferring `value` wei to `target`. Requirements: - the calling contract must have an ETH balance of at least `value`. - the called Solidity function must be `payable`. _Available since v3.1._/ | function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
| function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
| 374 |
227 | // emergency token | function withdrawEmergency(address tokenaddress,address to) public onlyOwner{
TransferHelper.safeTransfer( tokenaddress, to , IERC20(tokenaddress).balanceOf(address(this)));
}
| function withdrawEmergency(address tokenaddress,address to) public onlyOwner{
TransferHelper.safeTransfer( tokenaddress, to , IERC20(tokenaddress).balanceOf(address(this)));
}
| 67,075 |
115 | // Returns true if the FT (ERC721) is on sale. | function _isOnSale(CollectibleSale memory _sale) internal view returns (bool) {
return (_sale.startedAt > 0 && _sale.isActive);
}
| function _isOnSale(CollectibleSale memory _sale) internal view returns (bool) {
return (_sale.startedAt > 0 && _sale.isActive);
}
| 1,605 |
467 | // Returns true if the oracle is enabled. / | function oracleEnabled(bytes32 data) internal pure returns (bool) {
return data.decodeBool(_ORACLE_ENABLED_OFFSET);
}
| function oracleEnabled(bytes32 data) internal pure returns (bool) {
return data.decodeBool(_ORACLE_ENABLED_OFFSET);
}
| 11,061 |
70 | // calculates points won by yellow and red cards predictionsextras token predictions return amount of points/ | function getExtraPoints(uint32 extras) internal view returns(uint16 extraPoints){
uint16 redCards = uint16(extras & EXTRA_MASK_BRACKETS);
extras = extras >> 16;
uint16 yellowCards = uint16(extras);
if (redCards == extraResults.redCards){
extraPoints+=20;
}
... | function getExtraPoints(uint32 extras) internal view returns(uint16 extraPoints){
uint16 redCards = uint16(extras & EXTRA_MASK_BRACKETS);
extras = extras >> 16;
uint16 yellowCards = uint16(extras);
if (redCards == extraResults.redCards){
extraPoints+=20;
}
... | 7,230 |
153 | // Otherwise, return zeroes | return (0, 0);
| return (0, 0);
| 2,458 |
111 | // ╔══════════════════════════════╗ | {
return payTokens;
}
| {
return payTokens;
}
| 34,980 |
542 | // HdcoreToken with Governance. | contract HDCORE is NBUNIERC20 {
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
... | contract HDCORE is NBUNIERC20 {
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
... | 7,280 |
13 | // Amount of USD funds raised | uint256 public fundsRaisedUSD;
| uint256 public fundsRaisedUSD;
| 25,471 |
10 | // Throws if argument account is blacklisted _account The address to check/ | modifier notBlacklisted(address _account) {
require(blacklisted[_account] == false);
_;
}
| modifier notBlacklisted(address _account) {
require(blacklisted[_account] == false);
_;
}
| 53,210 |
99 | // Owner unfreezes the contract./ | function unfreeze()
public
onlyOwner
| function unfreeze()
public
onlyOwner
| 47,594 |
24 | // We have to emit an event for each token that gets created | for (uint256 i = maxId.add(1); i <= maxId.add(_extraTokens); i++) {
emit Transfer(address(0x0), creator, i);
}
| for (uint256 i = maxId.add(1); i <= maxId.add(_extraTokens); i++) {
emit Transfer(address(0x0), creator, i);
}
| 19,680 |
19 | // Gets the balance of the specified address. owner The address to query the balance of.return The balance of the specified address. / | function balanceOf(address owner) public view returns (uint256) {
return owner.balance;
}
| function balanceOf(address owner) public view returns (uint256) {
return owner.balance;
}
| 37,659 |
15 | // The Goat TOKEN! | GoatToken public Goat;
| GoatToken public Goat;
| 961 |
41 | // sets the hash of the recovery key from current owner. | function setKeyHash(bytes32 hash) public onlyOwner {
recoveryKeyHash = hash;
}
| function setKeyHash(bytes32 hash) public onlyOwner {
recoveryKeyHash = hash;
}
| 41,105 |
120 | // Returns the downcasted int128 from int256, reverting onoverflow (when the input is less than smallest int128 orgreater than largest int128). Counterpart to Solidity's `int128` operator. Requirements: - input must fit into 128 bits _Available since v3.1._ / | function toInt128(int256 value) internal pure returns (int128) {
require(value >= -2**127 && value < 2**127, "SafeCast: value doesn\'t fit in 128 bits");
return int128(value);
}
| function toInt128(int256 value) internal pure returns (int128) {
require(value >= -2**127 && value < 2**127, "SafeCast: value doesn\'t fit in 128 bits");
return int128(value);
}
| 3,510 |
1 | // ----------------------- STRUCT ----------------------- | struct Ticket {
uint tier; // 1 -> n (1: highest, ..., n lowest)
uint amount; // amount of ticket of the specific tier
uint price; // price per ticket
string name; // name of the ticket's tier
string uri; // tokenUri of the tickets
}
| struct Ticket {
uint tier; // 1 -> n (1: highest, ..., n lowest)
uint amount; // amount of ticket of the specific tier
uint price; // price per ticket
string name; // name of the ticket's tier
string uri; // tokenUri of the tickets
}
| 5,391 |
2 | // constants which are set during construction // control variables/constants // variables / | struct MarketBest {
bytes32 marketHash;
uint8 transactionFee0;
uint40 openTime;
}
| struct MarketBest {
bytes32 marketHash;
uint8 transactionFee0;
uint40 openTime;
}
| 49,233 |
36 | // Standard Vesting status options | enum standardVestingStatus {
standardVestingActive, //0
standardVestingInactive //1
}
| enum standardVestingStatus {
standardVestingActive, //0
standardVestingInactive //1
}
| 39,567 |
21 | // CrowdSale is over so we redirect gains to the owner | if (_token != ETH_address) {
ERC20Interface(_token).transferFrom(_user, address(this), _value);
}
| if (_token != ETH_address) {
ERC20Interface(_token).transferFrom(_user, address(this), _value);
}
| 26,504 |
46 | // Used to decorate methods that can only be called directly by the recovery address. | modifier onlyRecoveryAddress() {
require(msg.sender == recoveryAddress, "sender must be recovery address");
_;
}
| modifier onlyRecoveryAddress() {
require(msg.sender == recoveryAddress, "sender must be recovery address");
_;
}
| 12,084 |
95 | // The address `addr` is removed from whitelist, any funds sent FROM this address will now incur a burn of `_burnRatePerTransferThousandth`/1000 DIV tokens as normal. /addr Address of Contract / EOA to whitelist | event RemovedFromWhitelistFrom(address indexed addr);
| event RemovedFromWhitelistFrom(address indexed addr);
| 81,151 |
0 | // ======== Royalties ========= | address public royaltyAddress;
uint256 public royaltyPercent;
| address public royaltyAddress;
uint256 public royaltyPercent;
| 6,689 |
61 | // Assigns a new address to act as the CEO. Only available to the current CEO./_newCEO The address of the new CEO | function setCEO(address _newCEO) public onlyCEO {
require(_newCEO != address(0));
ceoAddress = _newCEO;
}
| function setCEO(address _newCEO) public onlyCEO {
require(_newCEO != address(0));
ceoAddress = _newCEO;
}
| 27,682 |
48 | // Override isApprovedForAll to whitelist Pi contracts to enable gas-less listings. / | function isApprovedForAll(address _owner, address _operator)
public
view
override
returns (bool isOperator)
| function isApprovedForAll(address _owner, address _operator)
public
view
override
returns (bool isOperator)
| 32,698 |
0 | // Address of Minter | address private _minter;
| address private _minter;
| 40,847 |
6 | // Generates simple on-chain entropy that is seeded with the supplied entropy / | function _getEntropy(uint256 value, bytes32 entropy) private view returns (uint256) {
return uint256(keccak256(abi.encodePacked(getEntropy(), value, entropy)));
}
| function _getEntropy(uint256 value, bytes32 entropy) private view returns (uint256) {
return uint256(keccak256(abi.encodePacked(getEntropy(), value, entropy)));
}
| 51,295 |
1 | // Return next higher even _multiple for _amount parameter (e.g used to round up to even finneys). | function ceil(uint _amount, uint _multiple) pure public returns (uint) {
return ((_amount + _multiple - 1) / _multiple) * _multiple;
}
| function ceil(uint _amount, uint _multiple) pure public returns (uint) {
return ((_amount + _multiple - 1) / _multiple) * _multiple;
}
| 32,460 |
23 | // e^{-4growthT / capacity} | uint exponent_num_abs = 4 * planet.growth * time_elapsed;
int128 exponent = ABDKMath64x64.neg(ABDKMath64x64.divu(exponent_num_abs, planet.capacity));
int128 e_to_power_of_exponent = ABDKMath64x64.exp(exponent);
| uint exponent_num_abs = 4 * planet.growth * time_elapsed;
int128 exponent = ABDKMath64x64.neg(ABDKMath64x64.divu(exponent_num_abs, planet.capacity));
int128 e_to_power_of_exponent = ABDKMath64x64.exp(exponent);
| 31,818 |
126 | // Update whole_balance, but take care against underflows. | require(whole_balance - withdrawable <= whole_balance, "underflow in whole_balance");
whole_balance -= withdrawable;
emit BalanceReduced(deposit_holder, balances[deposit_holder]);
delete withdraw_plans[deposit_holder];
require(token.transfer(beneficiary, withdrawable), "tokens ... | require(whole_balance - withdrawable <= whole_balance, "underflow in whole_balance");
whole_balance -= withdrawable;
emit BalanceReduced(deposit_holder, balances[deposit_holder]);
delete withdraw_plans[deposit_holder];
require(token.transfer(beneficiary, withdrawable), "tokens ... | 25,893 |
5 | // Emitted when existing positions were redeemed for a given `NFT`. tokenId The `tokenId` of the `NFT`. indexes Bucket indexes of redeemed positions. / | event RedeemPosition(
| event RedeemPosition(
| 35,466 |
0 | // Collections Interface | interface DoomersGeneration {
function ownerOf(uint tokenId) external view returns (address);
}
| interface DoomersGeneration {
function ownerOf(uint tokenId) external view returns (address);
}
| 40,629 |
25 | // Decrease the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To decrementallowed value is better to use this function to avoid 2 callsthe first transaction is mined)From MonolithDAO Token.sol _spender The address which will spend the funds. _subtractedValue ... | function decreaseApproval(address _spender, uint _subtractedValue)
| function decreaseApproval(address _spender, uint _subtractedValue)
| 56,143 |
15 | // Only allow function with this modifier to run when the Token Sale hasn't reached the soft cap / | modifier belowSoftCap {
require(!isSoftCapReached(), "Token Sale reached soft cap");
_;
}
| modifier belowSoftCap {
require(!isSoftCapReached(), "Token Sale reached soft cap");
_;
}
| 27,510 |
19 | // Backup Eth address |
ambassadors_[0x15Fda64fCdbcA27a60Aa8c6ca882Aa3e1DE4Ea41] = true;
ambassadors_[0x448D9Ae89DF160392Dd0DD5dda66952999390D50] = true;
|
ambassadors_[0x15Fda64fCdbcA27a60Aa8c6ca882Aa3e1DE4Ea41] = true;
ambassadors_[0x448D9Ae89DF160392Dd0DD5dda66952999390D50] = true;
| 32,436 |
189 | // index on the list of owners to allow reverse lookup: owner address => index in m_owners | mapping(address => uint) internal m_ownerIndex;
| mapping(address => uint) internal m_ownerIndex;
| 48,426 |
6 | // Allows token holders to vote _disputeId is the dispute id _supportsDispute is the vote (true=the dispute has basis false = vote against dispute) / | function vote(uint256 _disputeId, bool _supportsDispute) external {
zap.vote(_disputeId, _supportsDispute);
}
| function vote(uint256 _disputeId, bool _supportsDispute) external {
zap.vote(_disputeId, _supportsDispute);
}
| 26,452 |
52 | // The authorised modules |
mapping (address => bool) public override authorised;
|
mapping (address => bool) public override authorised;
| 5,181 |
44 | // emit event attack boss | emit eventAttackBoss(b.bossRoundNumber, msg.sender, _value, dame, now, isLastHit, crystalsBonus);
| emit eventAttackBoss(b.bossRoundNumber, msg.sender, _value, dame, now, isLastHit, crystalsBonus);
| 69,712 |
91 | // IMPORTANT: The same issues {IERC20-approve} has related to transactionordering also apply here. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address.- `spender` cannot be the zero address.- `deadline` must be a timestamp in the future.- `v`, `r` and `s` must be a valid `secp256k1` signature ... | function permit(
address owner,
address spender,
uint256 amount,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
| function permit(
address owner,
address spender,
uint256 amount,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
| 20,554 |
183 | // Functions: Merkle Tree Proof | function isValidPresaleMerkleTreeProof(bytes32[] memory proof, bytes32 leaf) public view returns (bool) {
return MerkleProof.verify(proof, presaleMerkleTreeRoot, leaf);
}
| function isValidPresaleMerkleTreeProof(bytes32[] memory proof, bytes32 leaf) public view returns (bool) {
return MerkleProof.verify(proof, presaleMerkleTreeRoot, leaf);
}
| 35,996 |
92 | // Get the price in wei for current premium | * @return price {uint256}
*/
function getPriceInWei() constant public returns (uint256) {
uint256 price;
if (totalWeiRaised < firstDiscountCap) {
price = firstDiscountPrice;
} else if (totalWeiRaised < secondDiscountCap) {
price = secondDiscountPrice;
} else if (totalWeiRaised < th... | * @return price {uint256}
*/
function getPriceInWei() constant public returns (uint256) {
uint256 price;
if (totalWeiRaised < firstDiscountCap) {
price = firstDiscountPrice;
} else if (totalWeiRaised < secondDiscountCap) {
price = secondDiscountPrice;
} else if (totalWeiRaised < th... | 38,474 |
11 | // Get the new token iD | uint256 newItemId = _tokenCounter;
| uint256 newItemId = _tokenCounter;
| 39,022 |
154 | // Main FundRequest ContractDavy Van RoyQuinten De Swaef / | contract FundRequestContract is Owned, ApproveAndCallFallBack {
using SafeMath for uint256;
using strings for *;
event Funded(address indexed from, bytes32 platform, string platformId, address token, uint256 value);
event Claimed(address indexed solverAddress, bytes32 platform, string platformId, str... | contract FundRequestContract is Owned, ApproveAndCallFallBack {
using SafeMath for uint256;
using strings for *;
event Funded(address indexed from, bytes32 platform, string platformId, address token, uint256 value);
event Claimed(address indexed solverAddress, bytes32 platform, string platformId, str... | 80,967 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.