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 |
|---|---|---|---|---|
482 | // Division with rounding up on last position, x, and y is with MD | function division(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = (x + (y / 2)) / y;
}
| function division(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = (x + (y / 2)) / y;
}
| 7,661 |
56 | // Read conduit creation code hash from runtime and place on the stack. | bytes32 conduitCreationCodeHash = _CONDUIT_CREATION_CODE_HASH;
| bytes32 conduitCreationCodeHash = _CONDUIT_CREATION_CODE_HASH;
| 32,820 |
25 | // Deposit `_value` tokens for `msg.sender` and lock until `_unlock_time`/_value Amount to deposit/_unlock_time Epoch time when tokens unlock, rounded down to whole weeks | function create_lock(uint256 _value, uint256 _unlock_time) external override nonReentrant() {
uint256 unlock_time = create_lock_check(msg.sender, _value, _unlock_time);
_deposit_for(msg.sender, _value, unlock_time, locked[msg.sender], CREATE_LOCK_TYPE);
}
| function create_lock(uint256 _value, uint256 _unlock_time) external override nonReentrant() {
uint256 unlock_time = create_lock_check(msg.sender, _value, _unlock_time);
_deposit_for(msg.sender, _value, unlock_time, locked[msg.sender], CREATE_LOCK_TYPE);
}
| 28,311 |
127 | // address nestQueryAddress | _nestQueryAddress,
| _nestQueryAddress,
| 37,247 |
2 | // Account investments | mapping (address => uint256) public bankrollMap;
| mapping (address => uint256) public bankrollMap;
| 11,965 |
126 | // https:docs.synthetix.io/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) externa... | 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) externa... | 12,098 |
12 | // The variable allCampaigns is at this point going to be an array with empty campaign structs (the same value of the number of campaigns that have be created). |
for (uint i = 0; i < numberOfCampaigns; i++) {
Campaign storage item = campaigns[i];
allCampaigns[i] = item;
}
|
for (uint i = 0; i < numberOfCampaigns; i++) {
Campaign storage item = campaigns[i];
allCampaigns[i] = item;
}
| 29,092 |
30 | // call with msg.value = amountIn | require(path[0] == WETH, 'UniswapV2Router: INVALID_PATH');
uint[] memory amounts = UniswapV2Library.getAmountsOut(factory, order.amountIn, path);
require(amounts[amounts.length - 1] >= order.amountOut, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT');
| require(path[0] == WETH, 'UniswapV2Router: INVALID_PATH');
uint[] memory amounts = UniswapV2Library.getAmountsOut(factory, order.amountIn, path);
require(amounts[amounts.length - 1] >= order.amountOut, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT');
| 34,794 |
73 | // Address of the ERC721 contract | address tokenContract;
| address tokenContract;
| 66,878 |
111 | // Returns 1 as a signed 59.18-decimal fixed-point number. | function scale() internal pure returns (int256 result) {
result = SCALE;
}
| function scale() internal pure returns (int256 result) {
result = SCALE;
}
| 64,238 |
54 | // increase defence | cities[coord].defence = defence + 1;
CityUpdate(coord, cities[coord].title, cities[coord].defence);
| cities[coord].defence = defence + 1;
CityUpdate(coord, cities[coord].title, cities[coord].defence);
| 13,335 |
2 | // Emitted when contract admin deposits reward tokens. | event PrimaryTokenRewardsDepositedByAdmin(uint256 _amount);
| event PrimaryTokenRewardsDepositedByAdmin(uint256 _amount);
| 13,771 |
9 | // Wrappers over Solidity's arithmetic operations with added overflow checks. / | library SafeMath256 {
/**
* @dev Returns the addition of two unsigned integers, reverting on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @de... | library SafeMath256 {
/**
* @dev Returns the addition of two unsigned integers, reverting on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @de... | 18,551 |
553 | // Change the TWAMM parameters | TWAMM = IUniV2TWAMMPair(_twamm_addr);
swap_period = _swap_period;
num_twamm_intervals = _swap_period / TWAMM.orderTimeInterval();
| TWAMM = IUniV2TWAMMPair(_twamm_addr);
swap_period = _swap_period;
num_twamm_intervals = _swap_period / TWAMM.orderTimeInterval();
| 12,294 |
6 | // Enter the bar. Pay some NSTs. Earn some shares. Locks NST and mints xNST | function enter(uint256 _amount) public {
// Gets the amount of NST locked in the contract
uint256 totalNST = nst.balanceOf(address(this));
// Gets the amount of xNST in existence
uint256 totalShares = totalSupply();
// If no xNST exists, mint it 1:1 to the amount put in
... | function enter(uint256 _amount) public {
// Gets the amount of NST locked in the contract
uint256 totalNST = nst.balanceOf(address(this));
// Gets the amount of xNST in existence
uint256 totalShares = totalSupply();
// If no xNST exists, mint it 1:1 to the amount put in
... | 14,395 |
18 | // Submit a order-ring for validation and settlement./addressListList of each order&39;s owner, tokenS, wallet, authAddr./ Note that next order&39;s `tokenS` equals this order&39;s/ `tokenB`./uintArgsList List of uint-type arguments in this order:/ amountS, amountB, validSince (second),/ validUntil (second), lrcFee, an... | function submitRing(
address[4][] addressList,
uint[6][] uintArgsList,
uint8[1][] uint8ArgsList,
bool[] buyNoMoreThanAmountBList,
uint8[] vList,
bytes32[] rList,
bytes32[] sList,
address miner,
... | function submitRing(
address[4][] addressList,
uint[6][] uintArgsList,
uint8[1][] uint8ArgsList,
bool[] buyNoMoreThanAmountBList,
uint8[] vList,
bytes32[] rList,
bytes32[] sList,
address miner,
... | 21,533 |
122 | // Formats function data call so we can call it through DSProxy/_amount Amount of FL/_fee Fee of the FL/_params Saver proxy params/ return proxyData Formated function call data | function packFunctionCall(uint _amount, uint _fee, bytes memory _params) internal pure returns (bytes memory proxyData, address payable) {
(
bytes memory exDataBytes,
address[2] memory cAddresses, // cCollAddress, cBorrowAddress
uint256 gasCost,
bool isRepay,
... | function packFunctionCall(uint _amount, uint _fee, bytes memory _params) internal pure returns (bytes memory proxyData, address payable) {
(
bytes memory exDataBytes,
address[2] memory cAddresses, // cCollAddress, cBorrowAddress
uint256 gasCost,
bool isRepay,
... | 26,274 |
27 | // eg. ETH - USDC | sushiOut = _toSUSHI(
weth,
_swap(token1, weth, amount1, address(this)).add(amount0)
);
| sushiOut = _toSUSHI(
weth,
_swap(token1, weth, amount1, address(this)).add(amount0)
);
| 27,551 |
78 | // Leave the bar. Claim back your SUSHIs. | function leave(uint256 _share) public {
uint256 totalShares = totalSupply();
uint256 what = _share.mul(stnd.balanceOf(address(this))).div(totalShares);
_burn(msg.sender, _share);
stnd.transfer(msg.sender, what);
}
| function leave(uint256 _share) public {
uint256 totalShares = totalSupply();
uint256 what = _share.mul(stnd.balanceOf(address(this))).div(totalShares);
_burn(msg.sender, _share);
stnd.transfer(msg.sender, what);
}
| 30,845 |
1 | // An abbreviated name for NFTokens. / | string internal nftSymbol;
| string internal nftSymbol;
| 3,675 |
236 | // Withdraw funds from the contract | function withdraw() public onlyOwner {
uint256 totalBalance = address(this).balance;
require(totalBalance > 0, "No funds to withdraw");
//percentages
uint256 team1Share = (totalBalance * 64) / 100;
uint256 team2Share = (totalBalance * 20) ... | function withdraw() public onlyOwner {
uint256 totalBalance = address(this).balance;
require(totalBalance > 0, "No funds to withdraw");
//percentages
uint256 team1Share = (totalBalance * 64) / 100;
uint256 team2Share = (totalBalance * 20) ... | 50,198 |
0 | // Bool to pause transfers | bool transferResumed = false;
| bool transferResumed = false;
| 50,939 |
63 | // Clear listing data and remove from tracking array | _removeListing(listing);
return;
| _removeListing(listing);
return;
| 47,289 |
5 | // Byte size of Uniswap V3 encoded path addresses and pool fees | uint256 private constant UNISWAP_V3_PATH_ADDRESS_SIZE = 20;
uint256 private constant UNISWAP_V3_PATH_FEE_SIZE = 3;
| uint256 private constant UNISWAP_V3_PATH_ADDRESS_SIZE = 20;
uint256 private constant UNISWAP_V3_PATH_FEE_SIZE = 3;
| 23,053 |
23 | // Get the amount of wrapped MRX in the caller's account in satoshi./ return The caller's balance in satoshi. | function balance() public view virtual returns (uint256)
| function balance() public view virtual returns (uint256)
| 43,610 |
204 | // total cunning scores staked | uint256 public totalCunningStaked = 0;
| uint256 public totalCunningStaked = 0;
| 36,210 |
47 | // convert USDT amount to CAD amount amount amount of USDT in 6 decimal placesreturn amount of CAD in 18 decimal places / | function usdtToCad(uint256 amount) external view returns (uint256);
| function usdtToCad(uint256 amount) external view returns (uint256);
| 47,010 |
150 | // internal implementation of staking methods staker address to do deposit of staking tokens beneficiary address to gain credit for this stake operation amount number of staking tokens to deposit / | function _stake(
address staker,
address beneficiary,
uint256 amount
| function _stake(
address staker,
address beneficiary,
uint256 amount
| 34,148 |
47 | // Did the sender accidently pay over? - if so track the amount over | uint256 totalToPay = getTokenPrice(tokenId);
require(msg.value >= totalToPay, "Not paying enough");
| uint256 totalToPay = getTokenPrice(tokenId);
require(msg.value >= totalToPay, "Not paying enough");
| 46,120 |
357 | // Set seed. | seed += uint32(now);
| seed += uint32(now);
| 36,402 |
528 | // INTERNAL FUNCTIONS / This settles a liquidation if it is in the PendingDispute state. If not, it will immediately return. If the liquidation is in the PendingDispute state, but a price is not available, this will revert. | function _settle(uint256 liquidationId, address sponsor) internal {
LiquidationData storage liquidation = _getLiquidationData(sponsor, liquidationId);
// Settlement only happens when state == PendingDispute and will only happen once per liquidation.
// If this liquidation is not ready to be... | function _settle(uint256 liquidationId, address sponsor) internal {
LiquidationData storage liquidation = _getLiquidationData(sponsor, liquidationId);
// Settlement only happens when state == PendingDispute and will only happen once per liquidation.
// If this liquidation is not ready to be... | 17,389 |
6 | // @inheritdoc IERC721Permit | function DOMAIN_SEPARATOR() public view override returns (bytes32) {
return
keccak256(
abi.encode(
// keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)')
0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b17... | function DOMAIN_SEPARATOR() public view override returns (bytes32) {
return
keccak256(
abi.encode(
// keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)')
0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b17... | 49,734 |
39 | // Fire a "proposal rejected" event | emit ProposalRejected(_currentProposal.yay, _currentProposal.nay);
transferTokensBackToVoters();
delete _currentProposal;
delete _balances;
| emit ProposalRejected(_currentProposal.yay, _currentProposal.nay);
transferTokensBackToVoters();
delete _currentProposal;
delete _balances;
| 40,112 |
10 | // Update a vendor's payment address | function updateVendorAddress(uint256 _vendorId, address _newVendorAddress) external onlyOwner {
require(
_newVendorAddress != address(0),
"New vendor address cannot be the zero address"
);
require(
vendors[_vendorId] != address(0),
"Vendor ID i... | function updateVendorAddress(uint256 _vendorId, address _newVendorAddress) external onlyOwner {
require(
_newVendorAddress != address(0),
"New vendor address cannot be the zero address"
);
require(
vendors[_vendorId] != address(0),
"Vendor ID i... | 2,135 |
206 | // Should not still be in-use in the year 2106 | assert(uint256(uint32(block.timestamp)) == block.timestamp);
assert(block.timestamp > 0);
return uint32(block.timestamp);
| assert(uint256(uint32(block.timestamp)) == block.timestamp);
assert(block.timestamp > 0);
return uint32(block.timestamp);
| 17,792 |
1 | // check whether address `who` is given superOperator rights./who The address to query./ return whether the address has superOperator rights. | function isSuperOperator(address who) public view returns (bool) {
return _superOperators[who];
}
| function isSuperOperator(address who) public view returns (bool) {
return _superOperators[who];
}
| 30,651 |
57 | // Parameters for a payment through Curve/The`route`, `swapParams` and `factoryAddresses` should be determined client-side by the CurveJS client./ The `returnRemainder` boolean determines if the excess token out should be returned to the user. | struct YodlCurveParams {
address sender;
address receiver;
uint256 amountIn; // amount of tokenIn needed to satisfy amountOut
// The exact amount expected by merchant in tokenOut
// If we are using price feeds, this is in terms of the invoice amount, but it must have the same... | struct YodlCurveParams {
address sender;
address receiver;
uint256 amountIn; // amount of tokenIn needed to satisfy amountOut
// The exact amount expected by merchant in tokenOut
// If we are using price feeds, this is in terms of the invoice amount, but it must have the same... | 21,861 |
14 | // This emits when an operator is enabled or disabled for an owner. The operator can manageall NFTs of the owner. / | event ApprovalForAll(
| event ApprovalForAll(
| 38,199 |
8 | // mint to address, using int representation of address as token ID | _mint(to, uint256(uint160(to)));
| _mint(to, uint256(uint160(to)));
| 6,855 |
10 | // Require that sender is the assigned destructor | require(destructor() == msg.sender);
| require(destructor() == msg.sender);
| 16,662 |
34 | // Swap the desired amount of BUIDL and send gained ETHs to the DFO's Wallet | uniswapV1Exchange.tokenToEthTransferInput(
tokenAmountToSwapForEtherInV1,
uniswapV1Exchange.getTokenToEthInputPrice(tokenAmountToSwapForEtherInV1),
block.timestamp + 1000,
dfoWalletAddress
);
| uniswapV1Exchange.tokenToEthTransferInput(
tokenAmountToSwapForEtherInV1,
uniswapV1Exchange.getTokenToEthInputPrice(tokenAmountToSwapForEtherInV1),
block.timestamp + 1000,
dfoWalletAddress
);
| 35,643 |
52 | // Amount of managers | uint256 public managerCountInt = 0;
| uint256 public managerCountInt = 0;
| 6,558 |
4 | // OpenLevDelegatorOpenLeverage/ | contract XOLEDelegator is DelegatorInterface, Adminable {
constructor(
address _oleToken,
DexAggregatorInterface _dexAgg,
uint _devFundRatio,
address _dev,
address payable _admin,
address implementation_){
admin = msg.sender;
// Creator of the contrac... | contract XOLEDelegator is DelegatorInterface, Adminable {
constructor(
address _oleToken,
DexAggregatorInterface _dexAgg,
uint _devFundRatio,
address _dev,
address payable _admin,
address implementation_){
admin = msg.sender;
// Creator of the contrac... | 31,536 |
318 | // Event emitted when tokens are claimed by a recipient from a grant | event Claimed(address indexed recipient, uint256 indexed amountClaimed);
| event Claimed(address indexed recipient, uint256 indexed amountClaimed);
| 744 |
25 | // require character is a space | _temp[i] == 0x20 ||
| _temp[i] == 0x20 ||
| 14,869 |
168 | // Internals | string private _baseTokenURI;
uint256 public startingIndexBlock;
uint256 public startingIndex;
| string private _baseTokenURI;
uint256 public startingIndexBlock;
uint256 public startingIndex;
| 16,390 |
15 | // Read and consume the next 2 bytes from the buffer as an `uint16`._buffer An instance of `BufferLib.Buffer`. return The `uint16` value of the next 2 bytes in the buffer counting from the cursor position./ | function readUint16(Buffer memory _buffer) internal pure returns (uint16) {
bytes memory bytesValue = _buffer.data;
uint64 offset = _buffer.cursor;
uint16 value;
assembly {
value := mload(add(add(bytesValue, 2), offset))
}
_buffer.cursor += 2;
return value;
}
| function readUint16(Buffer memory _buffer) internal pure returns (uint16) {
bytes memory bytesValue = _buffer.data;
uint64 offset = _buffer.cursor;
uint16 value;
assembly {
value := mload(add(add(bytesValue, 2), offset))
}
_buffer.cursor += 2;
return value;
}
| 6,656 |
43 | // H <- D - B | let h := d
if lt(h, add(b, 1)) {
h := add(h, localQ)
}
| let h := d
if lt(h, add(b, 1)) {
h := add(h, localQ)
}
| 42,714 |
1 | // DSAuth | function authority() public view returns (address);
function owner() public view returns (address);
| function authority() public view returns (address);
function owner() public view returns (address);
| 22,999 |
4 | // best guess ETH price | uint public constant dollarsPerETH = 1552;
uint public constant tokensPerDollar = 4;
uint public constant tokensPerETH = dollarsPerETH * tokensPerDollar;
uint public constant maxPerWallet = 5 ether * dollarsPerETH * tokensPerDollar;
| uint public constant dollarsPerETH = 1552;
uint public constant tokensPerDollar = 4;
uint public constant tokensPerETH = dollarsPerETH * tokensPerDollar;
uint public constant maxPerWallet = 5 ether * dollarsPerETH * tokensPerDollar;
| 4,376 |
5 | // Part 2 | txDataOffset = OFFSET_TO_TRANSACTIONS +
blockSize * ExchangeData.TX_DATA_AVAILABILITY_SIZE_PART_1 +
txIdx * ExchangeData.TX_DATA_AVAILABILITY_SIZE_PART_2;
assembly {
| txDataOffset = OFFSET_TO_TRANSACTIONS +
blockSize * ExchangeData.TX_DATA_AVAILABILITY_SIZE_PART_1 +
txIdx * ExchangeData.TX_DATA_AVAILABILITY_SIZE_PART_2;
assembly {
| 27,592 |
59 | // Creator of the contract is gov during initialization | gov = msg.sender;
| gov = msg.sender;
| 50,831 |
34 | // Allows a Module to execute a Safe transaction without any further confirmations./to Destination address of module transaction./value Ether value of module transaction./data Data payload of module transaction./operation Operation type of module transaction. | function execTransactionFromModule(address to, uint256 value, bytes memory data, Enum.Operation operation)
public
returns (bool success)
| function execTransactionFromModule(address to, uint256 value, bytes memory data, Enum.Operation operation)
public
returns (bool success)
| 16,425 |
13 | // Returns the downcasted uint216 from uint256, reverting onoverflow (when the input is greater than largest uint216). Counterpart to Solidity's `uint216` operator. Requirements: - input must fit into 216 bits _Available since v4.7._ / | function toUint216(uint256 value) internal pure returns (uint216) {
require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits");
return uint216(value);
}
| function toUint216(uint256 value) internal pure returns (uint216) {
require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits");
return uint216(value);
}
| 7,439 |
2 | // add an extension.Can only be called by contract owner or admin.extension address must point to a contract implementing ICreatorExtension.Returns True if newly added, False if already added. / | function registerExtension(address extension, string calldata baseURI) external;
| function registerExtension(address extension, string calldata baseURI) external;
| 13,099 |
21 | // same result as completeWithdraw | userState.releasedCounterPartyAssetAmount = uint256(userState
.releasedCounterPartyAssetAmount)
.sub(_amount).toUint128();
_option.totalReleasedCounterPartyAssetAmount = uint256(_option
.totalReleasedCounterPartyAssetAmount)
.sub(_a... | userState.releasedCounterPartyAssetAmount = uint256(userState
.releasedCounterPartyAssetAmount)
.sub(_amount).toUint128();
_option.totalReleasedCounterPartyAssetAmount = uint256(_option
.totalReleasedCounterPartyAssetAmount)
.sub(_a... | 14,839 |
73 | // Reward variables | uint256 private _maxSupplyFirstYear = 1000000000000000000000000; // Max emission during the first year, max 1,000,000 Stablize Token
uint256 private _rewardPercentLP = 50000; // This is the percent of rewards reserved for LP pools. Represents 50% of all Stabilize Token rewards
uint256 constant _rewardPerce... | uint256 private _maxSupplyFirstYear = 1000000000000000000000000; // Max emission during the first year, max 1,000,000 Stablize Token
uint256 private _rewardPercentLP = 50000; // This is the percent of rewards reserved for LP pools. Represents 50% of all Stabilize Token rewards
uint256 constant _rewardPerce... | 12,472 |
26 | // Increment and get the counter, which is used as the unique identifier for post/ return The unique identifier | function incrementAndGet()
internal
returns (uint)
| function incrementAndGet()
internal
returns (uint)
| 23,047 |
79 | // internal function to determine if the token is still accepted timewise. _ad Token contract addressreturn bool / | function isValid(address _ad) internal view returns(bool) {
uint endTime = acceptedTokens[_ad].validUntil;
if (block.timestamp < endTime) return true;
return false;
}
| function isValid(address _ad) internal view returns(bool) {
uint endTime = acceptedTokens[_ad].validUntil;
if (block.timestamp < endTime) return true;
return false;
}
| 15,519 |
329 | // Defi99's DErc20ZRXDelegate Contract DTokens which wrap an EIP-20 underlying and are delegated to / | contract DErc20ZRXDelegate is DErc20, DDelegateInterface {
/**
* @notice Construct an empty delegate
*/
constructor() public {}
/**
* @notice Called by the delegator on a delegate to initialize it for duty
* @param data The encoded bytes data for any initialization
*/
function ... | contract DErc20ZRXDelegate is DErc20, DDelegateInterface {
/**
* @notice Construct an empty delegate
*/
constructor() public {}
/**
* @notice Called by the delegator on a delegate to initialize it for duty
* @param data The encoded bytes data for any initialization
*/
function ... | 39,748 |
14 | // If the user doesn't have any ETH or tokens to withdraw, get out ASAP | if(eth_to_refund == 0 || iou_purchased[msg.sender] == 0) throw;
| if(eth_to_refund == 0 || iou_purchased[msg.sender] == 0) throw;
| 38,000 |
3 | // Eth to SCL rate | uint256 public ratePreICO = 850;
uint256 public rateWaiting = 0;
uint256 public rateAngelDay = 750;
uint256 public rateFirstWeek = 700;
uint256 public rateSecondWeek = 650;
uint256 public rateThirdWeek = 600;
uint256 public rateLastWeek = 550;
uint256 public ratePreICOEnd = 10 days;
... | uint256 public ratePreICO = 850;
uint256 public rateWaiting = 0;
uint256 public rateAngelDay = 750;
uint256 public rateFirstWeek = 700;
uint256 public rateSecondWeek = 650;
uint256 public rateThirdWeek = 600;
uint256 public rateLastWeek = 550;
uint256 public ratePreICOEnd = 10 days;
... | 41,721 |
3 | // Medici/PP Token contract for Pricing Protocol | contract PPToken is ERC20{
/* ======== CONSTRUCTOR ======== */
address public SessionFactory;
address public admin;
constructor(uint _initialSupply, address _recipient) ERC20("PricingCoin", "PP") {
_mint(_recipient, _initialSupply);
admin = msg.sender;
}
function ... | contract PPToken is ERC20{
/* ======== CONSTRUCTOR ======== */
address public SessionFactory;
address public admin;
constructor(uint _initialSupply, address _recipient) ERC20("PricingCoin", "PP") {
_mint(_recipient, _initialSupply);
admin = msg.sender;
}
function ... | 13,962 |
43 | // move delegates | _moveDelegates(address(0), delegates[dst], amount);
| _moveDelegates(address(0), delegates[dst], amount);
| 22,059 |
21 | // If desired maturity is below existing date, reject operation | require(manager.fnftIdToLock(fnftId).timeLockExpiry < endTime, "E030");
| require(manager.fnftIdToLock(fnftId).timeLockExpiry < endTime, "E030");
| 23,771 |
138 | // one byte prefix | require(item.len == 33);
uint result;
uint memPtr ; //inject UNINIT LOCAL/STATE VAR
assembly {
result := mload(memPtr)
}
| require(item.len == 33);
uint result;
uint memPtr ; //inject UNINIT LOCAL/STATE VAR
assembly {
result := mload(memPtr)
}
| 23,716 |
17 | // Set the crowdsale and token addresses. | sale = _sale;
| sale = _sale;
| 12,619 |
142 | // Transfer tokens from one address to another and then execute a callback on recipient. from The address which you want to send tokens from to The address which you want to transfer to value The amount of tokens to be transferredreturn A boolean that indicates if the operation was successful. / | function transferFromAndCall(address from, address to, uint256 value) public override returns (bool) {
return transferFromAndCall(from, to, value, "");
}
| function transferFromAndCall(address from, address to, uint256 value) public override returns (bool) {
return transferFromAndCall(from, to, value, "");
}
| 6,229 |
164 | // The block number when IVAULT mining starts. | uint256 public startBlock;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
bool public initialized = false;
a... | uint256 public startBlock;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
bool public initialized = false;
a... | 1,377 |
0 | // The price of each VRF request in Juels. 1 LINK = 1e18 Juels. | uint256 public immutable PRICE;
uint256 public s_responseCount;
constructor(
address _vrfCoordinator,
address _link,
uint256 _price
| uint256 public immutable PRICE;
uint256 public s_responseCount;
constructor(
address _vrfCoordinator,
address _link,
uint256 _price
| 42,961 |
50 | // Need to call to update the combined weights | _updateRewardAndBalance(msg.sender, false);
| _updateRewardAndBalance(msg.sender, false);
| 11,558 |
6 | // sumBPS distribution | uint256 sumBPS = 0;
for (uint256 index = 0; index < recipients.length; index++) {
sumBPS += shareBPS[index];
}
| uint256 sumBPS = 0;
for (uint256 index = 0; index < recipients.length; index++) {
sumBPS += shareBPS[index];
}
| 23,067 |
60 | // return in interface string encoded to bytes (max len 5 bytes) / | function stringToBytes5(string _data) public pure returns (bytes5) {
return bytes5(stringToBytes32(_data));
}
| function stringToBytes5(string _data) public pure returns (bytes5) {
return bytes5(stringToBytes32(_data));
}
| 49,944 |
15 | // GuardiansOfAetherGuardiansOfAether - Angelic NFT Collectible Set. / | contract GuardiansOfAether is ERC721Enumerable, Ownable, ReentrancyGuard {
using SafeMath for uint256;
AOA private aoa = AOA(0xa57E6C1b3154016933b739ca2CD895a1B617dbB4);
bool public isSaleActive = false;
string public PROVENANCE = "-";
uint256 public maxTokensCount = 11111;
string private baseU... | contract GuardiansOfAether is ERC721Enumerable, Ownable, ReentrancyGuard {
using SafeMath for uint256;
AOA private aoa = AOA(0xa57E6C1b3154016933b739ca2CD895a1B617dbB4);
bool public isSaleActive = false;
string public PROVENANCE = "-";
uint256 public maxTokensCount = 11111;
string private baseU... | 33,414 |
235 | // remember to div with asset price unit | total /= assetPriceUnit;
return total;
| total /= assetPriceUnit;
return total;
| 41,906 |
95 | // The standard EIP-20 approval event | event Approval(address indexed owner, address indexed spender, uint amount);
| event Approval(address indexed owner, address indexed spender, uint amount);
| 39,063 |
17 | // Claim a set of winning tickets for a lottery _lotteryId: lottery id _ticketIds: array of ticket ids _brackets: array of brackets for the ticket ids Callable by users only, not contract! / | function claimTickets(
uint256 _lotteryId,
uint256[] calldata _ticketIds,
uint32[] calldata _brackets
| function claimTickets(
uint256 _lotteryId,
uint256[] calldata _ticketIds,
uint32[] calldata _brackets
| 17,694 |
67 | // Calculate original base payment without changes | uint256 basePay = (nftProps.price * nftProps.maxSupply) /
nftProps.numberOfPayments;
| uint256 basePay = (nftProps.price * nftProps.maxSupply) /
nftProps.numberOfPayments;
| 26,377 |
0 | // https:github.com/dapphub/ds-chief | interface DSChiefAbstract {
function live() external view returns (uint256);
function launch() external;
function slates(bytes32) external view returns (address[] memory);
function votes(address) external view returns (bytes32);
function approvals(address) external view returns (uint256);
functi... | interface DSChiefAbstract {
function live() external view returns (uint256);
function launch() external;
function slates(bytes32) external view returns (address[] memory);
function votes(address) external view returns (bytes32);
function approvals(address) external view returns (uint256);
functi... | 24,680 |
57 | // Adds a co-owner of a contract. Might be more than one co-owner//Allowed to only contract onwer//_partowner a co-owner of a contract// return result code of an operation | function addPartOwner(address _partowner) external onlyContractOwner returns (uint) {
partowners[_partowner] = true;
return OK;
}
| function addPartOwner(address _partowner) external onlyContractOwner returns (uint) {
partowners[_partowner] = true;
return OK;
}
| 78,876 |
782 | // transfers currency asset to an address curr is the currency of currency asset to transfer amount is amount of currency asset to transferreturn boolean to represent success or failure / | function transferCurrencyAsset(
bytes4 curr,
uint amount
)
public
onlyInternal
noReentrancy
returns(bool)
| function transferCurrencyAsset(
bytes4 curr,
uint amount
)
public
onlyInternal
noReentrancy
returns(bool)
| 33,615 |
4 | // transfers to 0x address will be burned | if (to == address(0)) {
return _internalBurn(messageSender, value);
}
| if (to == address(0)) {
return _internalBurn(messageSender, value);
}
| 33,125 |
41 | // Check we haven't sold too many tokens | totalRegularTokensSold = totalRegularTokensSold.add(tokens);
require(totalRegularTokensSold <= regularTokenMaxSales);
| totalRegularTokensSold = totalRegularTokensSold.add(tokens);
require(totalRegularTokensSold <= regularTokenMaxSales);
| 48,778 |
27 | // Internal function that burns an amount of the token of a givenaccount, deducting from the sender's allowance for said account. Uses theinternal burn function. account The account whose tokens will be burnt. value The amount that will be burnt. / | function _burnFrom(address account, uint256 value) internal {
require(value <= _allowed[account][msg.sender]);
// Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted,
// this function needs to emit an event with the updated approval.
_allowed[account][msg.sender] = _allowe... | function _burnFrom(address account, uint256 value) internal {
require(value <= _allowed[account][msg.sender]);
// Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted,
// this function needs to emit an event with the updated approval.
_allowed[account][msg.sender] = _allowe... | 10,758 |
64 | // Total fees has to be less than 50% | require(totalFee < feeDenominator/2);
| require(totalFee < feeDenominator/2);
| 57,752 |
114 | // first parse the charCount out of the data | for (uint256 i = 32; i < 64; i++) {
charCount <<= 8;
charCount += uint8(b[i]);
}
| for (uint256 i = 32; i < 64; i++) {
charCount <<= 8;
charCount += uint8(b[i]);
}
| 38,725 |
32 | // active: whether point can be linkedfalse: point belongs to prefix, cannot be configured or linkedtrue: point no longer belongs to prefix, can be configured and linked | bool active;
| bool active;
| 38,425 |
16 | // Transfer the payment to the owner's account | payable(owner()).transfer(msg.value);
emit TokenMinted(tokenId, msg.sender, uri);
return uri;
| payable(owner()).transfer(msg.value);
emit TokenMinted(tokenId, msg.sender, uri);
return uri;
| 23,500 |
5 | // Adding new Item to article: `String(constitutionalArticles[_articleNum].article)`Add a new Item to an article denoted by articleNum which is the article's index in the constitutionalArticles array._articleNum The index ofthe article in the constitutionalArticles array which the item is added to_itemText The Content/... | function addArticleItem(uint _articleNum, bytes _itemText) external
founderCheck
articleSet(_articleNum)
ratified
homeIsSet
| function addArticleItem(uint _articleNum, bytes _itemText) external
founderCheck
articleSet(_articleNum)
ratified
homeIsSet
| 11,282 |
10 | // A mapping from PersonIDs to an address that has been approved to call/transferFrom(). Each Person can only have one approved address for transfer/at any time. A zero value means no approval is outstanding. | mapping (uint256 => address) public personIndexToApproved;
| mapping (uint256 => address) public personIndexToApproved;
| 46,366 |
19 | // Setup the current block as the last claimed Block | lastClaimedIssuanceBlock = issuanceBlock;
return totalReward;
| lastClaimedIssuanceBlock = issuanceBlock;
return totalReward;
| 36,087 |
36 | // Updates the set of claim topics that a trusted issuer is allowed to emit.Requires that this ClaimIssuer contract already exists in the registryRequires that the provided claimTopics set is not empty _trustedIssuer the claim issuer to update. _claimTopics the set of claim topics that the trusted issuer is allowed to ... | function updateIssuerClaimTopics(IClaimIssuer _trustedIssuer, uint[] calldata _claimTopics) external;
| function updateIssuerClaimTopics(IClaimIssuer _trustedIssuer, uint[] calldata _claimTopics) external;
| 4,373 |
4 | // SaleKindInterface Project Wyvern Developers / | library SaleKindInterface {
enum SaleKind { FixedPrice, EnglishAuction, DutchAuction }
struct Bid {
/* Address of the bidder. */
address bidder;
/* Amount of the bid. */
uint amount;
/* Timestamp of bid placement. */
uint timestamp;
}
function requir... | library SaleKindInterface {
enum SaleKind { FixedPrice, EnglishAuction, DutchAuction }
struct Bid {
/* Address of the bidder. */
address bidder;
/* Amount of the bid. */
uint amount;
/* Timestamp of bid placement. */
uint timestamp;
}
function requir... | 51,211 |
53 | // Get the balance for a particular token holder _holder The token holder's addressreturn The holder's balance / | function balanceOf(address _holder) public view returns (uint256 balance) {
balance = balances[_holder];
}
| function balanceOf(address _holder) public view returns (uint256 balance) {
balance = balances[_holder];
}
| 19,602 |
4 | // for (uint256 i = 0; i < recipients.length; i++) {address stakeholder = recipients[i];uint256 number = total_number(recipients);uint256 reward = amount/number;usdt.safeTransfer(stakeholder, reward);} | return(true);
| return(true);
| 13,885 |
22 | // SafeMathMath operations with safety checks that throw on error / | library SafeMath {
/**
* Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
if (a =... | library SafeMath {
/**
* Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
if (a =... | 75,338 |
78 | // This function calculates slippage as a %age of the amount in, and normalizesThat to the `_out` decimals.This ONLY works for 1:1 assets_in The decimals of the asset in / amount in _out The decimals of the target asset _amountIn The starting amount for the swap _slippage The slippage allowed for the swap, in BPSreturn... | function calculateSlippageBoundary(
uint8 _in,
uint8 _out,
uint256 _amountIn,
uint256 _slippage
| function calculateSlippageBoundary(
uint8 _in,
uint8 _out,
uint256 _amountIn,
uint256 _slippage
| 30,175 |
261 | // File: contracts/NFT.sol |
pragma solidity 0.8.9;
|
pragma solidity 0.8.9;
| 27,097 |
63 | // Allows contract owner to withdraw any fees earned _receiver The address of the receiver / | function withdrawFees(address payable _receiver) public onlyOwner {
// Withdraw Collected Fees from Escrow
bridge.withdrawFees(_receiver);
// Withdraw Type-Creation Fees
uint256 _amount = collectedFees;
if (_amount > 0) {
collectedFees = 0;
_receiver.... | function withdrawFees(address payable _receiver) public onlyOwner {
// Withdraw Collected Fees from Escrow
bridge.withdrawFees(_receiver);
// Withdraw Type-Creation Fees
uint256 _amount = collectedFees;
if (_amount > 0) {
collectedFees = 0;
_receiver.... | 27,144 |
263 | // Only the reward managers can take back their reward tokens Also, other tokens, like the staking token, airdrops, or accidental deposits, can be withdrawn by the owner | if (
(isRewTkn && rewardManagers[tokenAddress] == msg.sender)
|| (!isRewTkn && (msg.sender == owner))
) {
TransferHelper.safeTransfer(tokenAddress, msg.sender, tokenAmount);
return;
}
| if (
(isRewTkn && rewardManagers[tokenAddress] == msg.sender)
|| (!isRewTkn && (msg.sender == owner))
) {
TransferHelper.safeTransfer(tokenAddress, msg.sender, tokenAmount);
return;
}
| 16,459 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.