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 |
|---|---|---|---|---|
66 | // See {IERC20-transfer}. Requirements: - `to` cannot be the zero address.- the caller must have a balance of at least `amount`. / | function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
}
| function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
}
| 31,407 |
3 | // address _cToken, | address _yDAI
| address _yDAI
| 9,009 |
0 | // standard ERC20 stuff | string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
bool public mintable;
| string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
bool public mintable;
| 40,832 |
5 | // Constructor The deploying account becomes contractOwner / | constructor(address airlineAddress) public {
contractOwner = msg.sender;
registeredAirlines[airlineAddress] = Airline(true, false, 0); // initialise and register first airline
++totalRegisteredAirlines;
}
| constructor(address airlineAddress) public {
contractOwner = msg.sender;
registeredAirlines[airlineAddress] = Airline(true, false, 0); // initialise and register first airline
++totalRegisteredAirlines;
}
| 16,733 |
33 | // Returns an array of 7 date units if isWeek is true.Returns an array of 6 hour units if isWeek is false.E.g. isWeek is true, returns [28, 29, 30, 31, 1, 2, 3] isWeek is false, returns [6, 7, 8, 9, 10, 11] / | function getTimeUnits(bool isWeek)
internal
view
returns (uint16[7] memory units)
| function getTimeUnits(bool isWeek)
internal
view
returns (uint16[7] memory units)
| 34,585 |
46 | // Mapping from owner address to mapping of operator addresses. / | mapping (address => mapping (address => bool)) internal ownerToOperators;
| mapping (address => mapping (address => bool)) internal ownerToOperators;
| 12,886 |
462 | // expmods_and_points.points[53] = -(g^196z). | mstore(add(expmodsAndPoints, 0xa60), point)
| mstore(add(expmodsAndPoints, 0xa60), point)
| 77,659 |
97 | // function to get Staking Total Days by Id | function getTokenStakingTotalDaysById(uint256 id) public view returns(uint256){
require(id <= _tokenStakingCount,"Unable to reterive data on specified id, Please try again!!");
return _tokenTotalDays[id];
}
| function getTokenStakingTotalDaysById(uint256 id) public view returns(uint256){
require(id <= _tokenStakingCount,"Unable to reterive data on specified id, Please try again!!");
return _tokenTotalDays[id];
}
| 22,924 |
222 | // MinimumStakeSchedule defines the minimum stake parametrization and/ schedule. It starts with a minimum stake of 100k KEEP. Over the following/ 2 years, the minimum stake is lowered periodically using a uniform stepwise/ function, eventually ending at 10k. | library MinimumStakeSchedule {
using SafeMath for uint256;
// 2 years in seconds (seconds per day * days in a year * years)
uint256 public constant schedule = 86400 * 365 * 2;
uint256 public constant steps = 10;
uint256 public constant base = 10000 * 1e18;
/// @notice Returns the current value... | library MinimumStakeSchedule {
using SafeMath for uint256;
// 2 years in seconds (seconds per day * days in a year * years)
uint256 public constant schedule = 86400 * 365 * 2;
uint256 public constant steps = 10;
uint256 public constant base = 10000 * 1e18;
/// @notice Returns the current value... | 6,905 |
19 | // zaTokens store their underlying asset address in the contract | underlyingAsset = zaToken(_address).underlyingAsset();
| underlyingAsset = zaToken(_address).underlyingAsset();
| 16,086 |
11 | // Internal function to delete bitmask associated with `_tokenId`/ | function _clearBitMask(uint256 _tokenId) internal {
delete _bitmasks[_tokenId];
emit BitMaskUpdated(_tokenId, 0);
}
| function _clearBitMask(uint256 _tokenId) internal {
delete _bitmasks[_tokenId];
emit BitMaskUpdated(_tokenId, 0);
}
| 8,445 |
1 | // Accrued token per share | uint256[] public accTokenPerShare;
uint256 public stakers;
uint256 public startBlock;
uint256 public endBlock;
uint256 public bonusStartBlock;
uint256 public bonusEndBlock;
uint256[] public rewardPerBlock;
uint256[] public rewardTokenAmounts;
uint256 public stakedTokenSupply;
| uint256[] public accTokenPerShare;
uint256 public stakers;
uint256 public startBlock;
uint256 public endBlock;
uint256 public bonusStartBlock;
uint256 public bonusEndBlock;
uint256[] public rewardPerBlock;
uint256[] public rewardTokenAmounts;
uint256 public stakedTokenSupply;
| 12,258 |
55 | // minimum vesting 3 months | require(_lockMonths >= minVestLockMonths);
| require(_lockMonths >= minVestLockMonths);
| 43,883 |
76 | // to emit Trove's debt update event, to be called from trove/ _token address of token/ _newAmount new trove's debt value/ _newCollateralization new trove's collateralization value | function emitTroveDebtUpdate(
address _token,
uint256 _newAmount,
uint256 _newCollateralization,
uint256 _feePaid
| function emitTroveDebtUpdate(
address _token,
uint256 _newAmount,
uint256 _newCollateralization,
uint256 _feePaid
| 23,393 |
81 | // 得到当前币种的统计总数,只能遍历,所以这个 bridgepair 数量不能太大!否则会超过gas限制的! 不处理 eth 或 bnb ,只处理 ERC20 | function getTokenCountAmount(address _token) public view returns (uint) {
uint result = 0;
//1, 计算当前各个UniPair中能够取出来的金额
uint i = 0;
address bp = IndexBridgePairOf[i];
while(bp != address(0)) {
address UniPair = UniswapV2Library.pairFor(factory, BridgePair(b... | function getTokenCountAmount(address _token) public view returns (uint) {
uint result = 0;
//1, 计算当前各个UniPair中能够取出来的金额
uint i = 0;
address bp = IndexBridgePairOf[i];
while(bp != address(0)) {
address UniPair = UniswapV2Library.pairFor(factory, BridgePair(b... | 33,883 |
6 | // Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted}event. Requirements: - the caller must have ``role``'s admin role. / | function grantRole(bytes32 role, address account) external;
| function grantRole(bytes32 role, address account) external;
| 57,497 |
14 | // Initialize the controller. / | function _initialize(address _controller) internal {
_setController(_controller);
}
| function _initialize(address _controller) internal {
_setController(_controller);
}
| 1,675 |
61 | // Helper function to extract a useful revert message from a failed call./ If the returned data is malformed or not correctly abi encoded then this call can fail itself. | function _getRevertMsg(bytes memory _returnData) internal pure returns (string memory) {
// If the _res length is less than 68, then the transaction failed silently (without a revert message)
if (_returnData.length < 68) return "Transaction reverted silently";
assembly {
// Slic... | function _getRevertMsg(bytes memory _returnData) internal pure returns (string memory) {
// If the _res length is less than 68, then the transaction failed silently (without a revert message)
if (_returnData.length < 68) return "Transaction reverted silently";
assembly {
// Slic... | 17,975 |
4 | // ERC20 token used for staking | address public immutable stakingToken;
| address public immutable stakingToken;
| 66,619 |
0 | // keyhash or scripthash for syscoinWitnessProgram | function freezeBurnERC20(
uint value,
uint32 assetGUID,
address erc20ContractAddress,
uint8 precision,
bytes memory
)
public
minimumValue(erc20ContractAddress, value)
returns (bool)
| function freezeBurnERC20(
uint value,
uint32 assetGUID,
address erc20ContractAddress,
uint8 precision,
bytes memory
)
public
minimumValue(erc20ContractAddress, value)
returns (bool)
| 24,622 |
15 | // ============================================================================= | }
| }
| 468 |
116 | // set validator/_validator address to add or remove from validator list/value add/remove option | function setValidator(address _validator, bool value) external;
| function setValidator(address _validator, bool value) external;
| 18,510 |
124 | // Functions -----------------------------------------------------------------------------------------------------------------/Register the given beneficiary/beneficiary Address of beneficiary to be registered | function registerBeneficiary(address beneficiary)
public
onlyDeployer
notNullAddress(beneficiary)
returns (bool)
| function registerBeneficiary(address beneficiary)
public
onlyDeployer
notNullAddress(beneficiary)
returns (bool)
| 16,709 |
56 | // uint newBalTi = poolRatio^(1/weightTi)balTi; | uint256 boo = bdiv(BONE, normalizedWeight);
uint256 tokenInRatio = bpow(poolRatio, boo);
uint256 newTokenBalanceIn = bmul(tokenInRatio, tokenBalanceIn);
uint256 tokenAmountInAfterFee = bsub(newTokenBalanceIn, tokenBalanceIn);
| uint256 boo = bdiv(BONE, normalizedWeight);
uint256 tokenInRatio = bpow(poolRatio, boo);
uint256 newTokenBalanceIn = bmul(tokenInRatio, tokenBalanceIn);
uint256 tokenAmountInAfterFee = bsub(newTokenBalanceIn, tokenBalanceIn);
| 51,153 |
2 | // solium-disable-next-line security/no-call-value | (bool success, bytes memory returnData) = target.call{value : value}(callData);
| (bool success, bytes memory returnData) = target.call{value : value}(callData);
| 943 |
9 | // Helpful function to simplify the mento relayer implementation / | function updatePriceValuesAndCleanOldReports(
uint256 proposedTimestamp,
LocationInSortedLinkedList[] calldata locationsInSortedLinkedLists
| function updatePriceValuesAndCleanOldReports(
uint256 proposedTimestamp,
LocationInSortedLinkedList[] calldata locationsInSortedLinkedLists
| 9,389 |
65 | // Add token TokenJackpotBouns | emit TokenJackpotBouns(bet.gambler,totalJackpotWin);
totalAmount = totalAmount.add(totalJackpotWin);
tokenJackpotSize = uint128(tokenJackpotSize.sub(totalJackpotWin));
| emit TokenJackpotBouns(bet.gambler,totalJackpotWin);
totalAmount = totalAmount.add(totalJackpotWin);
tokenJackpotSize = uint128(tokenJackpotSize.sub(totalJackpotWin));
| 16,214 |
5 | // ETH:WSqueeth uniswap pool | address public immutable ethWSqueethPool;
| address public immutable ethWSqueethPool;
| 3,734 |
3 | // external unseal & mint function in batch / | function unsealMintBatch(address[] calldata idolContracts, uint256[] calldata tokenIds) external payable;
| function unsealMintBatch(address[] calldata idolContracts, uint256[] calldata tokenIds) external payable;
| 13,326 |
8 | // Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first... | function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| 43,099 |
101 | // Interface to be implemented by all Transfer Manager modules / | contract ITransferManager is IModule, Pausable {
//If verifyTransfer returns:
// FORCE_VALID, the transaction will always be valid, regardless of other TM results
// INVALID, then the transfer should not be allowed regardless of other TM results
// VALID, then the transfer is valid for this TM
/... | contract ITransferManager is IModule, Pausable {
//If verifyTransfer returns:
// FORCE_VALID, the transaction will always be valid, regardless of other TM results
// INVALID, then the transfer should not be allowed regardless of other TM results
// VALID, then the transfer is valid for this TM
/... | 49,604 |
79 | // See {IERC1155-balanceOf}. Requirements: - `account` cannot be the zero address. / | function balanceOf(address account, uint256 id) public view override returns (uint256) {
require(account != address(0), "ERC1155: balance query for the zero address");
return _balances[id][account];
}
| function balanceOf(address account, uint256 id) public view override returns (uint256) {
require(account != address(0), "ERC1155: balance query for the zero address");
return _balances[id][account];
}
| 2,358 |
2 | // Estimate the amount of `assetIn` required for `swap()`.assetIn address of the ERC-20 token to swap from assetOut address of the ERC-20 token to swap to amountOut expected amount of `assetOut` after the swap / | function getAmountIn(
| function getAmountIn(
| 14,250 |
263 | // Pay any necessary fees to mint a furball/Delegated logic from Furballs; | function purchaseMint(
address from, uint8 permissions, address to, IFurballEdition edition
| function purchaseMint(
address from, uint8 permissions, address to, IFurballEdition edition
| 69,747 |
16 | // WhitelistedRole Whitelisted accounts have been approved by a WhitelistAdmin to perform certain actions (e.g. participate in acrowdsale). This role is special in that the only accounts that can add it are WhitelistAdmins (who can also removeit), and not Whitelisteds themselves. / | contract WhitelistedRole is Context, WhitelistAdminRole {
using Roles for Roles.Role;
event WhitelistedAdded(address indexed account);
event WhitelistedRemoved(address indexed account);
Roles.Role private _whitelisteds;
modifier onlyWhitelisted() {
require(
isWhitelisted(_msgS... | contract WhitelistedRole is Context, WhitelistAdminRole {
using Roles for Roles.Role;
event WhitelistedAdded(address indexed account);
event WhitelistedRemoved(address indexed account);
Roles.Role private _whitelisteds;
modifier onlyWhitelisted() {
require(
isWhitelisted(_msgS... | 11,825 |
12 | // Emitted when STRK rate is changed | event NewStrikeRate(uint oldStrikeRate, uint newStrikeRate);
| event NewStrikeRate(uint oldStrikeRate, uint newStrikeRate);
| 27,475 |
73 | // (,HT数量) = 移除流动性支持Token收转帐税(token地址,流动性数量,Token最小数量,HT最小数量,to地址,最后期限) | amountHT = removeLiquidityHTSupportingFeeOnTransferTokens(
token,
liquidity,
amountTokenMin,
amountHTMin,
to,
deadline
);
| amountHT = removeLiquidityHTSupportingFeeOnTransferTokens(
token,
liquidity,
amountTokenMin,
amountHTMin,
to,
deadline
);
| 15,669 |
110 | // Ricardo Guilherme Schmidt (Status Research & Development GmbH)Registers usernames as ENS subnodes of the domain `ensNode` / | contract UsernameRegistrar is Controlled, ApproveAndCallFallBack {
ERC20Token public token;
ENS public ensRegistry;
PublicResolver public resolver;
address public parentRegistry;
uint256 public constant releaseDelay = 365 days;
mapping (bytes32 => Account) public accounts;
mapping (byt... | contract UsernameRegistrar is Controlled, ApproveAndCallFallBack {
ERC20Token public token;
ENS public ensRegistry;
PublicResolver public resolver;
address public parentRegistry;
uint256 public constant releaseDelay = 365 days;
mapping (bytes32 => Account) public accounts;
mapping (byt... | 51,153 |
292 | // HBT tokens created per block. | uint256 public hbtPerBlock;
| uint256 public hbtPerBlock;
| 12,078 |
459 | // Get the epoch at the current block timestamp.Reverts if epoch zero has not started. return The current epoch number. / | function getCurrentEpoch()
external
view
returns (uint256)
| function getCurrentEpoch()
external
view
returns (uint256)
| 77,558 |
140 | // RmaxP2 = TAD - RmaxP1 Now it is safe to subtract without underflow | participant2_amount = total_available_deposit - participant1_amount;
| participant2_amount = total_available_deposit - participant1_amount;
| 7,482 |
28 | // Replays a cross domain message to the target messenger.@inheritdoc IL1CrossDomainMessenger / slither-disable-next-line external-function | function replayMessage(
address _target,
address _sender,
bytes memory _message,
uint256 _queueIndex,
uint32 _oldGasLimit,
uint32 _newGasLimit
| function replayMessage(
address _target,
address _sender,
bytes memory _message,
uint256 _queueIndex,
uint32 _oldGasLimit,
uint32 _newGasLimit
| 28,687 |
369 | // ===== Internal Core Implementations ===== | function _onlyNotProtectedTokens(address _asset) internal override {
require(address(want) != _asset, "want");
require(address(crv) != _asset, "crv");
require(address(cvx) != _asset, "cvx");
require(address(cvxCrv) != _asset, "cvxCrv");
}
| function _onlyNotProtectedTokens(address _asset) internal override {
require(address(want) != _asset, "want");
require(address(crv) != _asset, "crv");
require(address(cvx) != _asset, "cvx");
require(address(cvxCrv) != _asset, "cvxCrv");
}
| 8,290 |
34 | // Transfer money to previous owner (fisher) | _owner.transfer(items[_upc].productPrice);
| _owner.transfer(items[_upc].productPrice);
| 13,950 |
33 | // Token Redemption | function redeem(uint256 value, bytes calldata data) external;
function redeemFrom(address tokenHolder, uint256 value, bytes calldata data) external;
function redeemByPartition(bytes32 partition, uint256 value, bytes calldata data) external;
function operatorRedeemByPartition(bytes32 partition, address tokenHold... | function redeem(uint256 value, bytes calldata data) external;
function redeemFrom(address tokenHolder, uint256 value, bytes calldata data) external;
function redeemByPartition(bytes32 partition, uint256 value, bytes calldata data) external;
function operatorRedeemByPartition(bytes32 partition, address tokenHold... | 40,810 |
32 | // Fired if investment for `amount` of tokens performed by `to` address | event ICOTokensInvested(address indexed to, uint amount);
| event ICOTokensInvested(address indexed to, uint amount);
| 50,212 |
23 | // Owner: Destroy the contract and withdraw any balance to the owner. WARNING: This is an unrecoverable operation! / | function kill() public onlyOwner {
selfdestruct(_owner);
}
| function kill() public onlyOwner {
selfdestruct(_owner);
}
| 13,979 |
36 | // Stack too deep | bool isCorrectFee = ((flags & kCorrectMatcherFeeByOrderAmount) != 0);
if (isCorrectFee) {
| bool isCorrectFee = ((flags & kCorrectMatcherFeeByOrderAmount) != 0);
if (isCorrectFee) {
| 55,311 |
191 | // Will be used to reactivate the sale. / | function activateSale() public onlyOwner {
saleIsActive = true;
}
| function activateSale() public onlyOwner {
saleIsActive = true;
}
| 24,312 |
7 | // called by the owner to pause, triggers stopped state/ | function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
| function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
| 18,580 |
50 | // emit Offered event | emit Offered(
itemCount,
address(_nft),
_tokenId,
_price,
msg.sender
);
| emit Offered(
itemCount,
address(_nft),
_tokenId,
_price,
msg.sender
);
| 26,962 |
163 | // Deploy New GenericCompound First | {
address[] memory governorList = new address[](1);
governorList[0] = address(_governor);
address[] memory keeperList = new address[](2);
keeperList[0] = 0xcC617C6f9725eACC993ac626C7efC6B96476916E;
keeperList[1] = 0xfdA462548Ce04282f4B6D6619823a7C64Fd... | {
address[] memory governorList = new address[](1);
governorList[0] = address(_governor);
address[] memory keeperList = new address[](2);
keeperList[0] = 0xcC617C6f9725eACC993ac626C7efC6B96476916E;
keeperList[1] = 0xfdA462548Ce04282f4B6D6619823a7C64Fd... | 45,161 |
16 | // Allows for contract ownership along with multi-address authorization / | abstract contract Auth {
address internal owner;
constructor(address _owner) {
owner = _owner;
}
/**
* Function modifier to require caller to be contract deployer
*/
modifier onlyOwner() {
require(isOwner(msg.sender), "!Owner"); _;
}
/**
* Check if address i... | abstract contract Auth {
address internal owner;
constructor(address _owner) {
owner = _owner;
}
/**
* Function modifier to require caller to be contract deployer
*/
modifier onlyOwner() {
require(isOwner(msg.sender), "!Owner"); _;
}
/**
* Check if address i... | 1,249 |
71 | // Updates the maximum rank a player can reach. maxRankMaximum rank a player can reach. / | function setMaxRank(uint256 maxRank) public onlyRole(MANAGER_ROLE) {
_maxRank = maxRank;
}
| function setMaxRank(uint256 maxRank) public onlyRole(MANAGER_ROLE) {
_maxRank = maxRank;
}
| 27,241 |
20 | // First check most recent balance | if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
| if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
| 589 |
182 | // Updates the decay multipliers and amounts for the total staked and challenged pools/This function is called in most other functions as well to keep the/ decay amounts and pools accurate | function updateDecay() external;
| function updateDecay() external;
| 73,641 |
13 | // Emitted when a tier is deleted | event TierDeleted(uint256 indexed tierId, address indexed clubOwner, Tier[] tiers);
| event TierDeleted(uint256 indexed tierId, address indexed clubOwner, Tier[] tiers);
| 26,618 |
30 | // Set governance for this token | governance = msg.sender;
DOMAINSEPARATOR = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), _getChainId(), address(this)));
| governance = msg.sender;
DOMAINSEPARATOR = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), _getChainId(), address(this)));
| 23,085 |
13 | // returns the tokenURI of tokenID | function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
| function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
| 2,550 |
33 | // payment for first segment | _transferDaiToContract();
| _transferDaiToContract();
| 29,606 |
1,052 | // Cannot trade past max maturity | if (maturity > maxMaturity) return false;
| if (maturity > maxMaturity) return false;
| 4,071 |
126 | // Check whether address belongs to a EOAaddr The address of user. return bool/ | function _isEOA(address addr)
internal view
| function _isEOA(address addr)
internal view
| 23,911 |
114 | // Transfer USDT Token to Contract | getTokenFormUser_USDT(USDTToken, msg.sender, money);
| getTokenFormUser_USDT(USDTToken, msg.sender, money);
| 38,361 |
2 | // product id => covered token (ex. 0xc7ed.....1 -> yDAI) | mapping(address => address) public coveredToken;
| mapping(address => address) public coveredToken;
| 49,501 |
20 | // Alias of Fiefdoms contract owner | function overlord() external view returns (address) {
return owner();
}
| function overlord() external view returns (address) {
return owner();
}
| 33,451 |
12 | // contribute function | function() public payable {
// allow to contribute only whitelisted KYC addresses
assert(isWhitelisted[msg.sender]);
// save contributor for further use
contributors.push(Contributor({
addr: msg.sender,
amount: msg.value,
timestamp: block.timestamp,
rejected: false
}));
... | function() public payable {
// allow to contribute only whitelisted KYC addresses
assert(isWhitelisted[msg.sender]);
// save contributor for further use
contributors.push(Contributor({
addr: msg.sender,
amount: msg.value,
timestamp: block.timestamp,
rejected: false
}));
... | 48,010 |
94 | // Transfer tokens to contract address | transfer(address(this), _value);
| transfer(address(this), _value);
| 79,120 |
25 | // Did everything go to plan? | if(success) {
| if(success) {
| 25,961 |
0 | // Run before every test function | function beforeEach() public {
bytes32 keyhash = 0x6c3699283bda56ad74f6b855546325b68d482e983852a7a82979cc4807b641f4;
uint fee = 1000000000000000000;
address link = 0xa36085F69e2889c224210F603D836748e7dC0088;
address KOVAN_VRF_COORDINATOR = 0xdD3782915140c8f3b190B5D67eAc6dc5760C46E9;
diceRoller = ... | function beforeEach() public {
bytes32 keyhash = 0x6c3699283bda56ad74f6b855546325b68d482e983852a7a82979cc4807b641f4;
uint fee = 1000000000000000000;
address link = 0xa36085F69e2889c224210F603D836748e7dC0088;
address KOVAN_VRF_COORDINATOR = 0xdD3782915140c8f3b190B5D67eAc6dc5760C46E9;
diceRoller = ... | 53,156 |
19 | // Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),Reverts with custom message when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert`opcode (which leaves remaining gas untouched) while Solidity uses aninvalid opcode to revert (consuming all remain... | function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
| function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
| 44,596 |
95 | // Transfer the tokens (only accessable from the contract). | function transferTokens(address _from, address _to) onlyFromNoundles whenNotPaused external {
// Refactor this.
if(_from != address(0)){
rewards[_from] += getPendingReward(_from);
lastUpdate[_from] = block.timestamp;
}
if(_to != address(0)){
... | function transferTokens(address _from, address _to) onlyFromNoundles whenNotPaused external {
// Refactor this.
if(_from != address(0)){
rewards[_from] += getPendingReward(_from);
lastUpdate[_from] = block.timestamp;
}
if(_to != address(0)){
... | 6,581 |
21 | // 설문지 구매 | function buySurvey(address _buyer, uint _value) public {
require(!isBoughtUser[_buyer]);
uint value = calcSurveyPrice();
require(_value == value);
isBoughtUser[_buyer] = true;
// 컨트롤러의 사용자별 구매 설문 리스트에 추가
controller.addBoughtSurvey(_buyer, this);
emit BuySurvey(this, _buyer, _value);
... | function buySurvey(address _buyer, uint _value) public {
require(!isBoughtUser[_buyer]);
uint value = calcSurveyPrice();
require(_value == value);
isBoughtUser[_buyer] = true;
// 컨트롤러의 사용자별 구매 설문 리스트에 추가
controller.addBoughtSurvey(_buyer, this);
emit BuySurvey(this, _buyer, _value);
... | 49,439 |
13 | // Clear reasons for denial, entered by validators, if the application was approved. | reasonForDenial = "N/A";
| reasonForDenial = "N/A";
| 46,324 |
16 | // Returns the greater of two values. a the first value b the second valuereturn result the greater of the two values / | function max(
uint256 a,
uint256 b
| function max(
uint256 a,
uint256 b
| 10,724 |
311 | // if there isn't any redirection, nothing to be done | if(redirectionAddress == address(0)){
return;
}
| if(redirectionAddress == address(0)){
return;
}
| 55,947 |
33 | // Initializes the erc20 contract/name_ the value 'name' will be set to/symbol_ the value 'symbol' will be set to/decimals default to 18 and must be reset by an inheriting contract for/non standard decimal values | constructor(string memory name_, string memory symbol_) {
// Set the state variables
name = name_;
symbol = symbol_;
decimals = 18;
// By setting these addresses to 0 attempting to execute a transfer to
// either of them will revert. This is a gas efficient way to pr... | constructor(string memory name_, string memory symbol_) {
// Set the state variables
name = name_;
symbol = symbol_;
decimals = 18;
// By setting these addresses to 0 attempting to execute a transfer to
// either of them will revert. This is a gas efficient way to pr... | 3,857 |
134 | // event for token purchase logging purchaser who paid for the tokens beneficiary who got the tokens value weis paid for purchase amount amount of tokens purchased / | event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
| event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
| 44,127 |
5 | // File: node_modules\witnet-solidity-bridge\contracts\interfaces\IWitnetRequestBoardReporter.sol/The Witnet Request Board Reporter interface./The Witnet Foundation. | interface IWitnetRequestBoardReporter {
/// Reports the Witnet-provided result to a previously posted request.
/// @dev Will assume `block.timestamp` as the timestamp at which the request was solved.
/// @dev Fails if:
/// @dev - the `_queryId` is not in 'Posted' status.
/// @dev - provided `_drTxH... | interface IWitnetRequestBoardReporter {
/// Reports the Witnet-provided result to a previously posted request.
/// @dev Will assume `block.timestamp` as the timestamp at which the request was solved.
/// @dev Fails if:
/// @dev - the `_queryId` is not in 'Posted' status.
/// @dev - provided `_drTxH... | 38,009 |
19 | // Hit the 7 day pot | hitPotProcess('7', send7Pot, pickTime);
| hitPotProcess('7', send7Pot, pickTime);
| 69,297 |
18 | // VARS / | function init() public onlyAdmin {
require(!initDone);
initDone = true;
whaleCard = 544244940971561611450182022165966101192029151941515963475380724124;
companiesMap[0] = 865561039198320994090019029559199471223345461753643689577969591538;
companiesMap[1] = 8655610391983209930541794447396827651... | function init() public onlyAdmin {
require(!initDone);
initDone = true;
whaleCard = 544244940971561611450182022165966101192029151941515963475380724124;
companiesMap[0] = 865561039198320994090019029559199471223345461753643689577969591538;
companiesMap[1] = 8655610391983209930541794447396827651... | 11,750 |
0 | // _ctsiAddress address of token instance being used/_stakingAddress address of StakingInterface/_workerAuthAddress address of worker manager contract/_difficultyAdjustmentParameter how quickly the difficulty gets updated/_targetInterval how often we want to elect a block producer/_rewardValue reward that reward manage... | function createNewChain(
address _ctsiAddress,
address _stakingAddress,
address _workerAuthAddress,
| function createNewChain(
address _ctsiAddress,
address _stakingAddress,
address _workerAuthAddress,
| 6,880 |
128 | // YairNieto Yair Nieto / | contract YairNieto is ERC1155, ERC1155Supply, ERC1155Burnable, Ownable {
string public name;
string public symbol;
mapping(uint => string) private tokenURI;
constructor()
ERC1155(
""
) {
name = "Yair Nieto";
symbol = "YN";
}
function mint(
address... | contract YairNieto is ERC1155, ERC1155Supply, ERC1155Burnable, Ownable {
string public name;
string public symbol;
mapping(uint => string) private tokenURI;
constructor()
ERC1155(
""
) {
name = "Yair Nieto";
symbol = "YN";
}
function mint(
address... | 28,660 |
4 | // Set the job id _jobId This is the jobid from the list of jobs available in our case it is a HTTP GET request / | function setJobId(bytes32 _jobId) external onlyOwner {
jobId = _jobId;
}
| function setJobId(bytes32 _jobId) external onlyOwner {
jobId = _jobId;
}
| 20,570 |
172 | // Private function to remove a token from this extension's token tracking data structures. This has O(1) time complexity, but alters the order of the _allTokens array.tokenId uint256 ID of the token to be removed from the tokens list/ | function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap... | function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap... | 76,364 |
2 | // Check is created | require(!uniquePairs[pairKey], "You've already followed this address.");
_tokenIds.increment();
uint256 newItemId = _tokenIds.current();
_mint(tx.origin, newItemId);
| require(!uniquePairs[pairKey], "You've already followed this address.");
_tokenIds.increment();
uint256 newItemId = _tokenIds.current();
_mint(tx.origin, newItemId);
| 28,221 |
1 | // Symbol or Ticker | string public symbol = "DEV";
| string public symbol = "DEV";
| 9,739 |
160 | // We calculate bonus based on percent left. Eg 100% of the time remaining, means a 30% bonus. 50% of the time remaining, means a 15% bonus. MAX_TIME_BONUS_PERCENT is a constant set to 30 (double-check on review) Max example with 1 ETH contribute: 301001eth / 10000 = 0.3eth Low end (towards the end of LSW) > 0 example ... | uint256 bonus = MAX_TIME_BONUS_PERCENT.mul(percentLeft).mul(depositValue).div(10000);
require(depositValue.mul(31).div(100) > bonus , "Sanity check failure bonus");
return bonus;
| uint256 bonus = MAX_TIME_BONUS_PERCENT.mul(percentLeft).mul(depositValue).div(10000);
require(depositValue.mul(31).div(100) > bonus , "Sanity check failure bonus");
return bonus;
| 79,255 |
50 | // transfer all pud to owner account. | pud.transfer(msg.sender, pudBalance);
| pud.transfer(msg.sender, pudBalance);
| 39,611 |
138 | // swap on Smoothy | swapOnSmoothyV1(
fromToken,
toToken,
fromAmount.mul(route[i].percent).div(10000),
route[i].targetExchange,
route[i].payload
);
| swapOnSmoothyV1(
fromToken,
toToken,
fromAmount.mul(route[i].percent).div(10000),
route[i].targetExchange,
route[i].payload
);
| 36,251 |
55 | // - Steps the Queue be replacing the first element with the next valid credit line's ID - Only works if the first element in the queue is null / | function stepQ() external {
ids.stepQ();
}
| function stepQ() external {
ids.stepQ();
}
| 3,804 |
277 | // Approvals: Staking Pool | cvxToken.approve(address(cvxRewardsPool), MAX_UINT_256);
| cvxToken.approve(address(cvxRewardsPool), MAX_UINT_256);
| 61,927 |
91 | // 返回当前参与到投注的彩民人数 | function getPlayersNum() public view returns(uint){
uint _sum = 0;
for(uint i=0; i<12; i++){
_sum += lotteryPlayers[i].length;
}
return _sum;
}
| function getPlayersNum() public view returns(uint){
uint _sum = 0;
for(uint i=0; i<12; i++){
_sum += lotteryPlayers[i].length;
}
return _sum;
}
| 2,719 |
1 | // someValue = 321; | Dummy dummyInstance = new Dummy();
dummyInstance.initialize();
emit Debug(address(dummyInstance));
| Dummy dummyInstance = new Dummy();
dummyInstance.initialize();
emit Debug(address(dummyInstance));
| 2,742 |
242 | // The yield reawrd token | address public token;
| address public token;
| 70,333 |
217 | // masterchef rewards pool ID | function _setPoolId(uint256 _value) internal {
setUint256(_POOLID_SLOT, _value);
}
| function _setPoolId(uint256 _value) internal {
setUint256(_POOLID_SLOT, _value);
}
| 37,263 |
25 | // Ico constants | uint public icoStart = 1521867660; //24.03.2018
uint public icoFinish = 1524632340; //24.04.2018
uint icoMinCap = 100000000*pow(10,decimals);
uint icoMaxCap = 550000000*pow(10,decimals);
| uint public icoStart = 1521867660; //24.03.2018
uint public icoFinish = 1524632340; //24.04.2018
uint icoMinCap = 100000000*pow(10,decimals);
uint icoMaxCap = 550000000*pow(10,decimals);
| 36,843 |
25 | // Set the AddressManager in the ProxyAdmin. | config.globalConfig.proxyAdmin.setAddressManager(config.globalConfig.addressManager);
| config.globalConfig.proxyAdmin.setAddressManager(config.globalConfig.addressManager);
| 23,816 |
174 | // Get the current valid order for the asset or fail | Order memory order = _getValidOrder(
_nftAddress,
_orderId
);
IERC20 acceptedToken = IERC20(order.payTokenAddress);
| Order memory order = _getValidOrder(
_nftAddress,
_orderId
);
IERC20 acceptedToken = IERC20(order.payTokenAddress);
| 21,837 |
6 | // This contract is a helper that will create new Proposal (i.e. voting) if the action is not allowed directly | contract AutoDaoBaseActionCaller is GenericCaller {
function AutoDaoBaseActionCaller(IDaoBase _mc)public
GenericCaller(_mc)
{
}
function addGroupMemberAuto(string _group, address _a) public returns(address proposalOut){
// TODO: implement
assert(false);
/*
bytes32[] memory params = new bytes32[](2);
... | contract AutoDaoBaseActionCaller is GenericCaller {
function AutoDaoBaseActionCaller(IDaoBase _mc)public
GenericCaller(_mc)
{
}
function addGroupMemberAuto(string _group, address _a) public returns(address proposalOut){
// TODO: implement
assert(false);
/*
bytes32[] memory params = new bytes32[](2);
... | 1,824 |
40 | // Definition of the structure of a Key. Specification: Keys are cryptographic public keys, or contract addresses associated with this identity.The structure should be as follows:- key: A public key owned by this identity - purposes: uint256[] Array of the key purposes, like 1 = MANAGEMENT, 2 = EXECUTION - keyType: The... | struct Key {
uint256[] purposes;
uint256 keyType;
bytes32 key;
}
| struct Key {
uint256[] purposes;
uint256 keyType;
bytes32 key;
}
| 86,688 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.