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 |
|---|---|---|---|---|
6 | // The OG Loot bags contract | IERC721Enumerable immutable loot;
IAdventurer immutable adventurer;
| IERC721Enumerable immutable loot;
IAdventurer immutable adventurer;
| 24,645 |
9 | // Check if player can make a move (e.g both players are registered and sender did not play) | function playersReady_canMakeMove() public constant returns (bool){
if (playersReady()) {
if ((msg.sender == player1) && (player1MoveHash == 0)) return true;
else if ((msg.sender == player2) && (player2MoveHash == 0)) return true;
}
return false;
}
| function playersReady_canMakeMove() public constant returns (bool){
if (playersReady()) {
if ((msg.sender == player1) && (player1MoveHash == 0)) return true;
else if ((msg.sender == player2) && (player2MoveHash == 0)) return true;
}
return false;
}
| 6,736 |
93 | // Amount to unstake each time. | uint256[] private amounts;
| uint256[] private amounts;
| 20,022 |
31 | // Viewsfunction getSynthExchangeSuspensions(bytes32[] calldata synths)externalviewreturns (bool[] memory exchangeSuspensions, uint256[] memory reasons); |
function synthExchangeSuspension(bytes32 currencyKey)
external
view
returns (bool suspended, uint248 reason);
|
function synthExchangeSuspension(bytes32 currencyKey)
external
view
returns (bool suspended, uint248 reason);
| 57,575 |
21 | // Certain partner projects need to donate 25 ETH to the SURF community to get a beach | uint256 internal constant minimumDonationAmount = 25 * 10**18;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Claim(address indexed user, uint256 indexed pid, uint256 surfAmount, uint256 uniAmount);
event ClaimAll(address indexed user, uint256 surfAmount, uint256 uniAmount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
event MkbBuyback(address indexed user, uint256 ethSpentOnMkb, uint256 mkbBought);
event MkbPoolActive(address indexed user, uint256 mkbLiquidity, uint256 ethLiquidity);
| uint256 internal constant minimumDonationAmount = 25 * 10**18;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Claim(address indexed user, uint256 indexed pid, uint256 surfAmount, uint256 uniAmount);
event ClaimAll(address indexed user, uint256 surfAmount, uint256 uniAmount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
event MkbBuyback(address indexed user, uint256 ethSpentOnMkb, uint256 mkbBought);
event MkbPoolActive(address indexed user, uint256 mkbLiquidity, uint256 ethLiquidity);
| 7,381 |
94 | // Signature utility library | library SigTools {
/// @notice Splits a signature into r & s values, and v (the verification value).
/// @dev Note: This does not verify the version, but does require signature length = 65
/// @param signature the packed signature to be split
function _splitSignature(bytes memory signature) internal pure returns (bytes32 r, bytes32 s, uint8 v) {
// Check signature length
require(signature.length == 65, "Invalid signature length");
// We need to unpack the signature, which is given as an array of 65 bytes (like eth.sign)
// solium-disable-next-line security/no-inline-assembly
assembly {
r := mload(add(signature, 32))
s := mload(add(signature, 64))
v := and(mload(add(signature, 65)), 255)
}
if (v < 27) {
v += 27; // Ethereum versions are 27 or 28 as opposed to 0 or 1 which is submitted by some signing libs
}
// check for valid version
// removed for now, done in another function
//require((v == 27 || v == 28), "Invalid signature version");
return (r, s, v);
}
}
| library SigTools {
/// @notice Splits a signature into r & s values, and v (the verification value).
/// @dev Note: This does not verify the version, but does require signature length = 65
/// @param signature the packed signature to be split
function _splitSignature(bytes memory signature) internal pure returns (bytes32 r, bytes32 s, uint8 v) {
// Check signature length
require(signature.length == 65, "Invalid signature length");
// We need to unpack the signature, which is given as an array of 65 bytes (like eth.sign)
// solium-disable-next-line security/no-inline-assembly
assembly {
r := mload(add(signature, 32))
s := mload(add(signature, 64))
v := and(mload(add(signature, 65)), 255)
}
if (v < 27) {
v += 27; // Ethereum versions are 27 or 28 as opposed to 0 or 1 which is submitted by some signing libs
}
// check for valid version
// removed for now, done in another function
//require((v == 27 || v == 28), "Invalid signature version");
return (r, s, v);
}
}
| 18,118 |
180 | // Guard variable for re-entrancy checks / | bool internal _notEntered;
| bool internal _notEntered;
| 11,842 |
33 | // Recycle the remote rotten ones and execute the transfre | recycle(to);
cellars[msg.sender] -= potatoes;
cellars[to] += potatoes;
Transfer(msg.sender, to, potatoes);
return true;
| recycle(to);
cellars[msg.sender] -= potatoes;
cellars[to] += potatoes;
Transfer(msg.sender, to, potatoes);
return true;
| 41,882 |
10 | // if 0 free, else cost if timesUpdated = 1, cost = 2x = ethCost(timesUpdated+1) | uint256 totalCost;
| uint256 totalCost;
| 25,503 |
3 | // Farmer contract used to store interest bearing assets / and rewards / goverance tokens on behalf of the owner. This parent contract is/ to be used as the logic contract that your custom farmer inherits from. | contract Farmer is Initializable, OwnableUpgradeSafe {
/// @dev Initializer that accepts the owner of the farmer.
/// @param _owner The address that will be the owner of the farmer.
function initialize(address _owner) public {
__Farmer_init(_owner);
}
/// @dev Internal function that sets current execution context.
/// @param _owner The address that will be the owner of the farmer.
function __Farmer_init(address _owner) internal initializer {
__Context_init_unchained();
__Ownable_init_unchained();
__Farmer_init_unchained(_owner);
}
/// @dev Internal function that transfers the ownership of the farmer
/// to the owner address argument.
/// @param _owner The address that will become the owner of the farmer.
function __Farmer_init_unchained(address _owner) internal initializer {
OwnableUpgradeSafe.transferOwnership(_owner);
}
} | contract Farmer is Initializable, OwnableUpgradeSafe {
/// @dev Initializer that accepts the owner of the farmer.
/// @param _owner The address that will be the owner of the farmer.
function initialize(address _owner) public {
__Farmer_init(_owner);
}
/// @dev Internal function that sets current execution context.
/// @param _owner The address that will be the owner of the farmer.
function __Farmer_init(address _owner) internal initializer {
__Context_init_unchained();
__Ownable_init_unchained();
__Farmer_init_unchained(_owner);
}
/// @dev Internal function that transfers the ownership of the farmer
/// to the owner address argument.
/// @param _owner The address that will become the owner of the farmer.
function __Farmer_init_unchained(address _owner) internal initializer {
OwnableUpgradeSafe.transferOwnership(_owner);
}
} | 32,145 |
3 | // assert(_b > 0);Solidity automatically throws when dividing by 0 uint256 c = _a / _b; assert(_a == _bc + _a % _b);There is no case in which this doesn't hold | return _a / _b;
| return _a / _b;
| 7,922 |
228 | // issueId => trickyNumber => buyAmountSum | mapping (uint256 => mapping(uint64 => uint256)) public userBuyAmountSum;
| mapping (uint256 => mapping(uint64 => uint256)) public userBuyAmountSum;
| 5,517 |
6 | // is it a contract and does it implement balanceOf | if(tokenCode > 0 && token.call(bytes4(0x70a08231), user)) { // bytes4(keccak256("balanceOf(address)")) == bytes4(0x70a08231)
return Token(token).balanceOf(user);
} else {
| if(tokenCode > 0 && token.call(bytes4(0x70a08231), user)) { // bytes4(keccak256("balanceOf(address)")) == bytes4(0x70a08231)
return Token(token).balanceOf(user);
} else {
| 54,182 |
13 | // mint OT&XYT for users | (ot, xyt, amountTokenMinted) = forge.mintOtAndXyt(
_underlyingAsset,
_expiry,
_amountToTokenize,
_to
);
| (ot, xyt, amountTokenMinted) = forge.mintOtAndXyt(
_underlyingAsset,
_expiry,
_amountToTokenize,
_to
);
| 33,666 |
338 | // check if there's a bid to accept | require(pendingBids[tokenId].exists);
| require(pendingBids[tokenId].exists);
| 15,361 |
373 | // Transfer collateral from contract to caller and burn callers synthetic tokens. | collateralCurrency.safeTransfer(msg.sender, amountWithdrawn.rawValue);
tokenCurrency.safeTransferFrom(msg.sender, address(this), numTokens.rawValue);
tokenCurrency.burn(numTokens.rawValue);
| collateralCurrency.safeTransfer(msg.sender, amountWithdrawn.rawValue);
tokenCurrency.safeTransferFrom(msg.sender, address(this), numTokens.rawValue);
tokenCurrency.burn(numTokens.rawValue);
| 5,744 |
6 | // Adds two numbers, throws on overflow. / | function add(uint256 a, uint256 b)
internal
pure
returns(uint256 c)
| function add(uint256 a, uint256 b)
internal
pure
returns(uint256 c)
| 14,087 |
5 | // YOUR CODE HERE | return numOccupied == 0;
| return numOccupied == 0;
| 9,027 |
31 | // src/DrillBase.sol/ pragma solidity ^0.6.7; // import "zeppelin-solidity/proxy/Initializable.sol"; // import "ds-auth/auth.sol"; // import "./interfaces/ISettingsRegistry.sol"; // import "./interfaces/IObjectOwnership.sol"; / | contract DrillBase is Initializable, DSAuth {
event Create(
address indexed owner,
uint256 indexed tokenId,
uint16 grade,
uint256 createTime
);
event Destroy(address indexed owner, uint256 indexed tokenId);
uint256 internal constant _CLEAR_HIGH =
0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff;
// 0x434f4e54524143545f4f424a4543545f4f574e45525348495000000000000000
bytes32 public constant CONTRACT_OBJECT_OWNERSHIP =
"CONTRACT_OBJECT_OWNERSHIP";
/*** STORAGE ***/
uint128 public lastDrillObjectId;
ISettingsRegistry public registry;
/**
* @dev Same with constructor, but is used and called by storage proxy as logic contract.
*/
function initialize(address _registry) public initializer {
owner = msg.sender;
emit LogSetOwner(msg.sender);
registry = ISettingsRegistry(_registry);
}
/**
* @dev create a Drill.
* @param grade - Drill grade.
* @param to - owner of the Drill.
* @return - tokenId.
*/
function createDrill(uint16 grade, address to)
public
auth
returns (uint256)
{
return _createDrill(grade, to);
}
function _createDrill(uint16 grade, address to) internal returns (uint256) {
lastDrillObjectId += 1;
require(
lastDrillObjectId < 5192296858534827628530496329220095,
"Drill: object id overflow."
);
uint128 objectId = (uint128(grade) << 112) | lastDrillObjectId;
uint256 tokenId =
IObjectOwnership(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP))
.mintObject(to, objectId);
emit Create(
to,
tokenId,
grade,
now // solhint-disable-line
);
return tokenId;
}
/**
* @dev destroy a Drill.
* @param to owner of the drill.
* @param tokenId tokenId of the drill.
*/
function destroyDrill(address to, uint256 tokenId) public auth {
IObjectOwnership(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).burn(
to,
tokenId
);
emit Destroy(to, tokenId);
}
function getGrade(uint256 tokenId) public pure returns (uint16) {
uint128 objectId = uint128(tokenId & _CLEAR_HIGH);
return uint16(objectId >> 112);
}
} | contract DrillBase is Initializable, DSAuth {
event Create(
address indexed owner,
uint256 indexed tokenId,
uint16 grade,
uint256 createTime
);
event Destroy(address indexed owner, uint256 indexed tokenId);
uint256 internal constant _CLEAR_HIGH =
0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff;
// 0x434f4e54524143545f4f424a4543545f4f574e45525348495000000000000000
bytes32 public constant CONTRACT_OBJECT_OWNERSHIP =
"CONTRACT_OBJECT_OWNERSHIP";
/*** STORAGE ***/
uint128 public lastDrillObjectId;
ISettingsRegistry public registry;
/**
* @dev Same with constructor, but is used and called by storage proxy as logic contract.
*/
function initialize(address _registry) public initializer {
owner = msg.sender;
emit LogSetOwner(msg.sender);
registry = ISettingsRegistry(_registry);
}
/**
* @dev create a Drill.
* @param grade - Drill grade.
* @param to - owner of the Drill.
* @return - tokenId.
*/
function createDrill(uint16 grade, address to)
public
auth
returns (uint256)
{
return _createDrill(grade, to);
}
function _createDrill(uint16 grade, address to) internal returns (uint256) {
lastDrillObjectId += 1;
require(
lastDrillObjectId < 5192296858534827628530496329220095,
"Drill: object id overflow."
);
uint128 objectId = (uint128(grade) << 112) | lastDrillObjectId;
uint256 tokenId =
IObjectOwnership(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP))
.mintObject(to, objectId);
emit Create(
to,
tokenId,
grade,
now // solhint-disable-line
);
return tokenId;
}
/**
* @dev destroy a Drill.
* @param to owner of the drill.
* @param tokenId tokenId of the drill.
*/
function destroyDrill(address to, uint256 tokenId) public auth {
IObjectOwnership(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).burn(
to,
tokenId
);
emit Destroy(to, tokenId);
}
function getGrade(uint256 tokenId) public pure returns (uint16) {
uint128 objectId = uint128(tokenId & _CLEAR_HIGH);
return uint16(objectId >> 112);
}
} | 37,614 |
22 | // Loads the table into memory | string memory table = _TABLE;
| string memory table = _TABLE;
| 30,684 |
25 | // Extra safety check to ensure the max supply is not exceeded. | if (_totalMinted() + quantity > maxSupply()) {
revert MintQuantityExceedsMaxSupply(
_totalMinted() + quantity,
maxSupply()
);
}
| if (_totalMinted() + quantity > maxSupply()) {
revert MintQuantityExceedsMaxSupply(
_totalMinted() + quantity,
maxSupply()
);
}
| 2,401 |
158 | // Shortcut for the actual value | if (_time >= intervalHistory[intervalHistory.length - 1].startsFrom)
return intervalHistory.length - 1;
if (_time < intervalHistory[0].startsFrom) return 0;
| if (_time >= intervalHistory[intervalHistory.length - 1].startsFrom)
return intervalHistory.length - 1;
if (_time < intervalHistory[0].startsFrom) return 0;
| 31,761 |
189 | // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI. | return string(abi.encodePacked(base, tokenId.toString()));
| return string(abi.encodePacked(base, tokenId.toString()));
| 6,920 |
18 | // Converts all of caller's dividends to tokens. /function reinvest() public;function buy() public payable; | function buyFor(address _buyer) public payable;
function sell(uint256 _tokenAmount) public;
function exit() public;
function devTeamWithdraw() public returns(uint256);
function withdrawFor(address sender) public returns(uint256);
function transfer(address _to, uint256 _tokenAmount) public returns(bool);
| function buyFor(address _buyer) public payable;
function sell(uint256 _tokenAmount) public;
function exit() public;
function devTeamWithdraw() public returns(uint256);
function withdrawFor(address sender) public returns(uint256);
function transfer(address _to, uint256 _tokenAmount) public returns(bool);
| 36,107 |
54 | // Implementation of a standard ERC20 token./ | contract Token is ERC20 {
uint256 constant initialSupply = 1000000000000 * 10**18;
constructor() ERC20("Wyckoff", "WYK") {
_mint(_msgSender(), initialSupply);
}
} | contract Token is ERC20 {
uint256 constant initialSupply = 1000000000000 * 10**18;
constructor() ERC20("Wyckoff", "WYK") {
_mint(_msgSender(), initialSupply);
}
} | 47,540 |
12 | // Amount that has already been dripped | uint internal dripped;
| uint internal dripped;
| 55,119 |
24 | // Admin Access Modifier / | modifier onlyAuthorized
| modifier onlyAuthorized
| 36,138 |
11 | // look from start to middle -1(prev value) | _end = _middle - 1;
| _end = _middle - 1;
| 31,210 |
172 | // Fetch the `decimals()` from an ERC20 token Grabs the `decimals()` from a contract and fails if the decimal value does not live within a certain range _token Address of the ERC20 tokenreturn uint256 Decimals of the ERC20 token / | function getDecimals(address _token) internal view returns (uint256) {
uint256 decimals = IBasicToken(_token).decimals();
require(
decimals >= 4 && decimals <= 18,
"Token must have sufficient decimal places"
);
return decimals;
}
| function getDecimals(address _token) internal view returns (uint256) {
uint256 decimals = IBasicToken(_token).decimals();
require(
decimals >= 4 && decimals <= 18,
"Token must have sufficient decimal places"
);
return decimals;
}
| 66,490 |
106 | // emergency withdraw rewards. only owner. EMERGENCY ONLY. | function emergencyWithdrawRewards() external {
require(msg.sender == address(manager), "emergencyWithdrawRewards: sender is not manager");
uint balance = erc20.balanceOf(address(this));
erc20.safeTransfer(address(tx.origin), balance);
}
| function emergencyWithdrawRewards() external {
require(msg.sender == address(manager), "emergencyWithdrawRewards: sender is not manager");
uint balance = erc20.balanceOf(address(this));
erc20.safeTransfer(address(tx.origin), balance);
}
| 36,946 |
603 | // Withdraw royalties from the contract. Only owner can call this function / | function withdraw() public payable onlyOwner {
(bool success, ) = payable(msg.sender).call{value: address(this).balance}("");
require(success);
}
| function withdraw() public payable onlyOwner {
(bool success, ) = payable(msg.sender).call{value: address(this).balance}("");
require(success);
}
| 29,746 |
2 | // mapping to save all the registry addresses of an owner | mapping(address => address[]) public userToRegistries;
address lastaddress;
string lastUri;
address private _owner;
| mapping(address => address[]) public userToRegistries;
address lastaddress;
string lastUri;
address private _owner;
| 11,370 |
2 | // The address of the key with which this account wants to sign attestations on the Attestations contract | address attestation;
| address attestation;
| 15,169 |
10 | // User must have enough eth and cannot sell 0 | require(sellEth <= ethBalanceOf(_customerAddress));
require(sellEth > 0);
| require(sellEth <= ethBalanceOf(_customerAddress));
require(sellEth > 0);
| 13,554 |
5 | // helps in transferring from your account to another person | function transfer(address receiver, uint numTokens) external returns (bool){
require(msg.sender != receiver,"Sender and receiver can't be the same");
require(balances[msg.sender] >= numTokens,"Not enough balance");
balances[msg.sender] -= numTokens;
balances[receiver] += numTokens;
emit Transfer(msg.sender,receiver,numTokens);
return true;
}
| function transfer(address receiver, uint numTokens) external returns (bool){
require(msg.sender != receiver,"Sender and receiver can't be the same");
require(balances[msg.sender] >= numTokens,"Not enough balance");
balances[msg.sender] -= numTokens;
balances[receiver] += numTokens;
emit Transfer(msg.sender,receiver,numTokens);
return true;
}
| 34,883 |
7 | // returns the total number of the tokens available for the sale, must not change when the ico is started | function totalTokens() public view returns(uint);
| function totalTokens() public view returns(uint);
| 4,899 |
14 | // require that there are still tokens left to be claimed | require(unclaimedTokenCount<MAX_TOKEN_CAP, "ALL TOKENS CLAIMED");
| require(unclaimedTokenCount<MAX_TOKEN_CAP, "ALL TOKENS CLAIMED");
| 22,801 |
208 | // Constructor / | constructor() payoutAllC(msg.sender) public {
// this bbFarm requires v5 of BBLib (note: v4 deprecated immediately due to insecure submitProxyVote)
// note: even though we can't test for this in coverage, this has stopped me deploying to kovan with the wrong version tho, so I consider it tested :)
assert(BBLib.getVersion() == 6);
emit BBFarmInit(NAMESPACE);
}
| constructor() payoutAllC(msg.sender) public {
// this bbFarm requires v5 of BBLib (note: v4 deprecated immediately due to insecure submitProxyVote)
// note: even though we can't test for this in coverage, this has stopped me deploying to kovan with the wrong version tho, so I consider it tested :)
assert(BBLib.getVersion() == 6);
emit BBFarmInit(NAMESPACE);
}
| 22,395 |
120 | // validate that the appropriate offerAmount was deducted surplusAssetId == offerAssetId | if (_assetIds[2] == _assetIds[0]) {
| if (_assetIds[2] == _assetIds[0]) {
| 18,360 |
9 | // set the tokenURI of a token extension.Can only be called by extension that minted token. / | function setTokenURIExtension(uint256 tokenId, string calldata uri) external;
| function setTokenURIExtension(uint256 tokenId, string calldata uri) external;
| 39,089 |
34 | // Token information | address public DGPTokenOldContract = 0x9AcA6aBFe63A5ae0Dc6258cefB65207eC990Aa4D;
DigipulseFirstRoundToken public coin;
| address public DGPTokenOldContract = 0x9AcA6aBFe63A5ae0Dc6258cefB65207eC990Aa4D;
DigipulseFirstRoundToken public coin;
| 19,342 |
13 | // SafeMath.div(20, 3) = 6 | uint256 constant FEE_DEV = 6; //15% on the 1% fee
uint256 constant FEE_AUDIT = 12; //7.5% on the 1% fee
address public owner;
address constant public developer = 0xEE06BdDafFA56a303718DE53A5bc347EfbE4C68f;
address constant public auditor = 0x63F7547Ac277ea0B52A0B060Be6af8C5904953aa;
uint256 public individual_cap;
| uint256 constant FEE_DEV = 6; //15% on the 1% fee
uint256 constant FEE_AUDIT = 12; //7.5% on the 1% fee
address public owner;
address constant public developer = 0xEE06BdDafFA56a303718DE53A5bc347EfbE4C68f;
address constant public auditor = 0x63F7547Ac277ea0B52A0B060Be6af8C5904953aa;
uint256 public individual_cap;
| 41,163 |
576 | // transfer.fromAccountID == UNKNOWN && | transfer.toAccountID == ctx.accountID &&
transfer.from == join.owner &&
transfer.to == address(this) &&
transfer.tokenID == ctx.tokens[i].tokenID &&
transfer.amount.isAlmostEqualAmount(amounts[i]) &&
transfer.fee == 0 &&
(signature.length == 0 || transfer.storageID == join.joinStorageIDs[i]),
"INVALID_JOIN_TRANSFER_TX_DATA"
);
| transfer.toAccountID == ctx.accountID &&
transfer.from == join.owner &&
transfer.to == address(this) &&
transfer.tokenID == ctx.tokens[i].tokenID &&
transfer.amount.isAlmostEqualAmount(amounts[i]) &&
transfer.fee == 0 &&
(signature.length == 0 || transfer.storageID == join.joinStorageIDs[i]),
"INVALID_JOIN_TRANSFER_TX_DATA"
);
| 43,107 |
4 | // 實作記錄送過來的ether | event setMoney(uint money);
uint public value;
address public who;
uint public blockheight;
uint public rightnow;
| event setMoney(uint money);
uint public value;
address public who;
uint public blockheight;
uint public rightnow;
| 17,125 |
41 | // Function to check the amount of tokens than an owner allowed to a spender. _owner address The address which owns the funds. _spender address The address which will spend the funds.return A uint specifying the amount of tokens still available for the spender. / | function allowance(address _owner, address _spender)
public
view
returns (uint256 remaining)
| function allowance(address _owner, address _spender)
public
view
returns (uint256 remaining)
| 48,557 |
5 | // Events | event updatedFee(uint256 fee, address owner);
| event updatedFee(uint256 fee, address owner);
| 13,099 |
65 | // burn all dCLM8 associated with this proposal (minus proposalThreshold for reward) | dclm8._burn(address(this), uint96(sub256(add256(proposal.rawForVotes, proposal.rawAgainstVotes), proposalThreshold())));
uint eta = add256(block.timestamp, timelock.delay());
for (uint i = 0; i < proposal.targets.length; i++) {
_queueOrRevert(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], eta);
}
| dclm8._burn(address(this), uint96(sub256(add256(proposal.rawForVotes, proposal.rawAgainstVotes), proposalThreshold())));
uint eta = add256(block.timestamp, timelock.delay());
for (uint i = 0; i < proposal.targets.length; i++) {
_queueOrRevert(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], eta);
}
| 47,398 |
10 | // Called by a crowdsale contract upon creation./self Stored crowdsale from crowdsale contract/_owner Address of crowdsale owner/_saleData Array of 2 item sets such that, in each 2 element/ set, 1 is timestamp, and 2 is price in tokens/ETH at that time/_endTime Timestamp of sale end time/_percentBurn Percentage of extra tokens to burn/_token Token being sold | function init(DirectCrowdsaleStorage storage self,
address _owner,
uint256[] _saleData,
uint256 _endTime,
uint8 _percentBurn,
CrowdsaleToken _token)
public
| function init(DirectCrowdsaleStorage storage self,
address _owner,
uint256[] _saleData,
uint256 _endTime,
uint8 _percentBurn,
CrowdsaleToken _token)
public
| 33,390 |
107 | // total ice rate = toBurn + toRegular + toSpecial | uint256 public constant ICE_RATE_TOTAL_PRECISION = 1e12;
| uint256 public constant ICE_RATE_TOTAL_PRECISION = 1e12;
| 13,511 |
30 | // MAPPINGS mapping from a pixel to its owner | mapping (uint => address) private pixelToOwner;
| mapping (uint => address) private pixelToOwner;
| 29,649 |
208 | // Allow pausing of deposits in case of emergency status New deposit status / | function setPauseStatus(bool status) external override onlyOwner {
pauseStatus = status;
emit PauseStatusChanged(status);
}
| function setPauseStatus(bool status) external override onlyOwner {
pauseStatus = status;
emit PauseStatusChanged(status);
}
| 41,093 |
150 | // adds a positioncan only be called by the contract owner_providerliquidity provider _poolToken pool token address _reserveTokenreserve token address _poolAmountpool token amount _reserveAmount reserve token amount _reserveRateNrate of 1 protected reserve token in units of the other reserve token (numerator) _reserveRateDrate of 1 protected reserve token in units of the other reserve token (denominator) _timestamp timestampreturn new position id / | function addPosition(
address _provider,
IDSToken _poolToken,
IERC20Token _reserveToken,
uint256 _poolAmount,
uint256 _reserveAmount,
uint256 _reserveRateN,
uint256 _reserveRateD,
uint256 _timestamp
| function addPosition(
address _provider,
IDSToken _poolToken,
IERC20Token _reserveToken,
uint256 _poolAmount,
uint256 _reserveAmount,
uint256 _reserveRateN,
uint256 _reserveRateD,
uint256 _timestamp
| 22,420 |
11 | // ensure the user exists and that the creator of the user is the sender of the transaction | require(users[usernameHash].owner == msg.sender,"Owner");
| require(users[usernameHash].owner == msg.sender,"Owner");
| 13,907 |
91 | // Internal function that burns an amount of the token of a givenaccount. addr The account whose tokens will be burnt. value The amount that will be burnt. / | function _burn(address addr, uint256 value) internal {
totalSupply = totalSupply.sub(value);
_balances[addr] = _balances[addr].sub(value);
emit Burn(addr, value);
emit Transfer(addr, address(0), value);
}
| function _burn(address addr, uint256 value) internal {
totalSupply = totalSupply.sub(value);
_balances[addr] = _balances[addr].sub(value);
emit Burn(addr, value);
emit Transfer(addr, address(0), value);
}
| 36,183 |
111 | // decrease internal naked margin collateral amount | nakedPoolBalance[vault.collateralAssets[0]] = nakedPoolBalance[vault.collateralAssets[0]].sub(collateralToSell);
pool.transferToUser(vault.collateralAssets[0], _args.receiver, collateralToSell);
emit VaultLiquidated(
msg.sender,
_args.receiver,
_args.owner,
price,
_args.roundId,
| nakedPoolBalance[vault.collateralAssets[0]] = nakedPoolBalance[vault.collateralAssets[0]].sub(collateralToSell);
pool.transferToUser(vault.collateralAssets[0], _args.receiver, collateralToSell);
emit VaultLiquidated(
msg.sender,
_args.receiver,
_args.owner,
price,
_args.roundId,
| 44,811 |
141 | // Burns tokens | _circulatingSupply-=tokensToBeBurnt;
| _circulatingSupply-=tokensToBeBurnt;
| 41,379 |
21 | // Emit an event indicating that conduit ownership has been assigned. | emit OwnershipTransferred(conduit, address(0), initialOwner);
| emit OwnershipTransferred(conduit, address(0), initialOwner);
| 4,089 |
85 | // Burns `_value` tokens of `_from`_from The address that owns the tokens to be burned _value The amount of tokens to be burnedreturn Whether the tokens where sucessfully burned or not/ | function burn(address _from, uint _value) returns (bool);
| function burn(address _from, uint _value) returns (bool);
| 7,970 |
41 | // decrease approval to _spender | function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
| function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
| 40,790 |
77 | // Profits. Return only _bankroll | else return _bankroll;
| else return _bankroll;
| 81,090 |
12 | // _timestamps[i] = block.timestamp; | stakers[msg.sender].tokenIds.push(_tokenIds[i]);
stakers[msg.sender].timestamps.push(block.timestamp);
uint256 pctBoost = 0;
uint256 id = _tokenIds[i];
if (id >= 1 && id <= 1888) {
pctBoost += 3; // Add 3%
}
| stakers[msg.sender].tokenIds.push(_tokenIds[i]);
stakers[msg.sender].timestamps.push(block.timestamp);
uint256 pctBoost = 0;
uint256 id = _tokenIds[i];
if (id >= 1 && id <= 1888) {
pctBoost += 3; // Add 3%
}
| 39,822 |
8 | // planet initialize should set the planet to default state, including having the owner be adress 0x0 then it's the responsibility for the mechanics to set the owner to the player | bool deepSpace = _perlin >= PERLIN_THRESHOLD_2;
bool mediumSpace = _perlin < PERLIN_THRESHOLD_2 &&
_perlin >= PERLIN_THRESHOLD_1;
bool silverMine = _planetResource ==
DarkForestTypes.PlanetResource.SILVER;
_planet.owner = address(0);
_planet.planetLevel = _planetLevel;
| bool deepSpace = _perlin >= PERLIN_THRESHOLD_2;
bool mediumSpace = _perlin < PERLIN_THRESHOLD_2 &&
_perlin >= PERLIN_THRESHOLD_1;
bool silverMine = _planetResource ==
DarkForestTypes.PlanetResource.SILVER;
_planet.owner = address(0);
_planet.planetLevel = _planetLevel;
| 15,096 |
62 | // 14: no partial fills, only offerer or zone can execute | ERC20_TO_ERC1155_FULL_RESTRICTED,
| ERC20_TO_ERC1155_FULL_RESTRICTED,
| 8,069 |
3 | // Expose the contractURI/ return the contract metadata URI. | function contractURI() public view virtual returns (string memory) {
return _contractURI;
}
| function contractURI() public view virtual returns (string memory) {
return _contractURI;
}
| 26,703 |
10 | // Functions | function initialize(
address _lockCreator,
uint _expirationDuration,
address _tokenAddress,
uint _keyPrice,
uint _maxNumberOfKeys,
string calldata _lockName
) external;
| function initialize(
address _lockCreator,
uint _expirationDuration,
address _tokenAddress,
uint _keyPrice,
uint _maxNumberOfKeys,
string calldata _lockName
) external;
| 76,420 |
54 | // for whitelist | address public cs;
| address public cs;
| 6,768 |
92 | // Setter for chainId array/_chainIds array of all the used chainIds | function setChainIds(uint32[] memory _chainIds) external onlyGuardian {
chainIds = _chainIds;
}
| function setChainIds(uint32[] memory _chainIds) external onlyGuardian {
chainIds = _chainIds;
}
| 22,361 |
3 | // This is the keccak-256 hash of "uns.blocklist." subtracted by 1 | bytes32 internal constant _BLOCKLIST_PREFIX_SLOT =
0x1ec047073e2c8b15660901dbfdb6e3ff6365bd699dd9f95dcc6eab5448bebd69;
| bytes32 internal constant _BLOCKLIST_PREFIX_SLOT =
0x1ec047073e2c8b15660901dbfdb6e3ff6365bd699dd9f95dcc6eab5448bebd69;
| 47,242 |
27 | // This notifies clients about the amount burnt // the time at which token holders can begin transferring tokens / | uint256 public transferableStartTime;
| uint256 public transferableStartTime;
| 38,801 |
1 | // Event emitted when controlled token is added | event ControlledTokenAdded(
ControlledTokenInterface indexed token
);
| event ControlledTokenAdded(
ControlledTokenInterface indexed token
);
| 14,319 |
20 | // solhint-disable-next-line contract-name-camelcase | contract LP_REVV_SAND_Unipool is LPTokenWrapper, IRewardDistributionRecipient {
// solhint-disable-next-line var-name-mixedcase
uint256 public immutable DURATION;
IERC20Mintable public immutable rewardToken;
uint256 public periodFinish = 0;
uint256 public rewardRate = 0;
uint256 public lastUpdateTime;
uint256 public rewardPerTokenStored;
mapping(address => uint256) public userRewardPerTokenPaid;
mapping(address => uint256) public rewards;
event RewardAdded(uint256 reward);
event Staked(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
event RewardPaid(address indexed user, uint256 reward);
constructor(
IERC20 uni_,
IERC20Mintable rewardToken_,
uint256 duration
) public LPTokenWrapper(uni_) {
rewardToken = rewardToken_;
DURATION = duration;
}
modifier updateReward(address account) {
rewardPerTokenStored = rewardPerToken();
lastUpdateTime = lastTimeRewardApplicable();
if (account != address(0)) {
rewards[account] = earned(account);
userRewardPerTokenPaid[account] = rewardPerTokenStored;
}
_;
}
function lastTimeRewardApplicable() public view returns (uint256) {
return Math.min(block.timestamp, periodFinish);
}
function rewardPerToken() public view returns (uint256) {
if (totalSupply() == 0) {
return rewardPerTokenStored;
}
return rewardPerTokenStored.add(lastTimeRewardApplicable().sub(lastUpdateTime).mul(rewardRate).mul(1e18).div(totalSupply()));
}
function earned(address account) public view returns (uint256) {
return balanceOf(account).mul(rewardPerToken().sub(userRewardPerTokenPaid[account])).div(1e18).add(rewards[account]);
}
// stake visibility is public as overriding LPTokenWrapper's stake() function
function stake(uint256 amount) public override updateReward(msg.sender) {
require(amount > 0, "Cannot stake 0");
super.stake(amount);
emit Staked(msg.sender, amount);
}
function withdraw(uint256 amount) public override updateReward(msg.sender) {
require(amount > 0, "Cannot withdraw 0");
super.withdraw(amount);
emit Withdrawn(msg.sender, amount);
}
function exit() external {
getReward();
withdraw(balanceOf(msg.sender));
}
function getReward() public updateReward(msg.sender) {
uint256 reward = earned(msg.sender);
if (reward > 0) {
rewards[msg.sender] = 0;
rewardToken.mint(msg.sender, reward);
emit RewardPaid(msg.sender, reward);
}
}
function notifyRewardAmount(uint256 reward) external override onlyRewardDistribution updateReward(address(0)) {
if (block.timestamp >= periodFinish) {
rewardRate = reward.div(DURATION);
} else {
uint256 remaining = periodFinish.sub(block.timestamp);
uint256 leftover = remaining.mul(rewardRate);
rewardRate = reward.add(leftover).div(DURATION);
}
lastUpdateTime = block.timestamp;
periodFinish = block.timestamp.add(DURATION);
emit RewardAdded(reward);
}
}
| contract LP_REVV_SAND_Unipool is LPTokenWrapper, IRewardDistributionRecipient {
// solhint-disable-next-line var-name-mixedcase
uint256 public immutable DURATION;
IERC20Mintable public immutable rewardToken;
uint256 public periodFinish = 0;
uint256 public rewardRate = 0;
uint256 public lastUpdateTime;
uint256 public rewardPerTokenStored;
mapping(address => uint256) public userRewardPerTokenPaid;
mapping(address => uint256) public rewards;
event RewardAdded(uint256 reward);
event Staked(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
event RewardPaid(address indexed user, uint256 reward);
constructor(
IERC20 uni_,
IERC20Mintable rewardToken_,
uint256 duration
) public LPTokenWrapper(uni_) {
rewardToken = rewardToken_;
DURATION = duration;
}
modifier updateReward(address account) {
rewardPerTokenStored = rewardPerToken();
lastUpdateTime = lastTimeRewardApplicable();
if (account != address(0)) {
rewards[account] = earned(account);
userRewardPerTokenPaid[account] = rewardPerTokenStored;
}
_;
}
function lastTimeRewardApplicable() public view returns (uint256) {
return Math.min(block.timestamp, periodFinish);
}
function rewardPerToken() public view returns (uint256) {
if (totalSupply() == 0) {
return rewardPerTokenStored;
}
return rewardPerTokenStored.add(lastTimeRewardApplicable().sub(lastUpdateTime).mul(rewardRate).mul(1e18).div(totalSupply()));
}
function earned(address account) public view returns (uint256) {
return balanceOf(account).mul(rewardPerToken().sub(userRewardPerTokenPaid[account])).div(1e18).add(rewards[account]);
}
// stake visibility is public as overriding LPTokenWrapper's stake() function
function stake(uint256 amount) public override updateReward(msg.sender) {
require(amount > 0, "Cannot stake 0");
super.stake(amount);
emit Staked(msg.sender, amount);
}
function withdraw(uint256 amount) public override updateReward(msg.sender) {
require(amount > 0, "Cannot withdraw 0");
super.withdraw(amount);
emit Withdrawn(msg.sender, amount);
}
function exit() external {
getReward();
withdraw(balanceOf(msg.sender));
}
function getReward() public updateReward(msg.sender) {
uint256 reward = earned(msg.sender);
if (reward > 0) {
rewards[msg.sender] = 0;
rewardToken.mint(msg.sender, reward);
emit RewardPaid(msg.sender, reward);
}
}
function notifyRewardAmount(uint256 reward) external override onlyRewardDistribution updateReward(address(0)) {
if (block.timestamp >= periodFinish) {
rewardRate = reward.div(DURATION);
} else {
uint256 remaining = periodFinish.sub(block.timestamp);
uint256 leftover = remaining.mul(rewardRate);
rewardRate = reward.add(leftover).div(DURATION);
}
lastUpdateTime = block.timestamp;
periodFinish = block.timestamp.add(DURATION);
emit RewardAdded(reward);
}
}
| 6,467 |
291 | // Update the given account's previous period fee entitlement value.Do nothing if the last transfer occurred since the fee period rolled over.If the entitlement was updated, also update the last transfer time to beat the timestamp of the rollover, so if this should do nothing if called morethan once during a given period. Consider the case where the entitlement is updated. If the last transferoccurred at time t in the last period, then the starred region is added to theentitlement, the last transfer timestamp is moved to r, and the fee period isrolled over from k-1 to k so that the | function rolloverFee(address account, uint lastTransferTime, uint preBalance)
internal
| function rolloverFee(address account, uint lastTransferTime, uint preBalance)
internal
| 25,712 |
2 | // Used when attempting to unlock stCelo when there is no locked stCelo. account The account's address. / | error NoLockedStakedCelo(address account);
| error NoLockedStakedCelo(address account);
| 22,616 |
15 | // Raised when `setQuoteSigner()` is called./quoteSigner The new quote signer. | event QuoteSignerUpdated(address quoteSigner);
| event QuoteSignerUpdated(address quoteSigner);
| 19,016 |
236 | // Keep claiming rewards from the list until we either consume all available gas or we finish one cycle | while (gasUsed < gas && iteration < queueLength) {
if (_rewardClaimQueueIndex >= queueLength) {
_rewardClaimQueueIndex = 0;
}
address user = _rewardClaimQueue[_rewardClaimQueueIndex];
if (isRewardReady(user) && isIncludedInRewards(user)) {
doClaimReward(user);
}
uint256 newGasLeft = gasleft();
if (gasLeft > newGasLeft) {
uint256 consumedGas = gasLeft - newGasLeft;
gasUsed += consumedGas;
gasLeft = newGasLeft;
}
iteration++;
_rewardClaimQueueIndex++;
}
| while (gasUsed < gas && iteration < queueLength) {
if (_rewardClaimQueueIndex >= queueLength) {
_rewardClaimQueueIndex = 0;
}
address user = _rewardClaimQueue[_rewardClaimQueueIndex];
if (isRewardReady(user) && isIncludedInRewards(user)) {
doClaimReward(user);
}
uint256 newGasLeft = gasleft();
if (gasLeft > newGasLeft) {
uint256 consumedGas = gasLeft - newGasLeft;
gasUsed += consumedGas;
gasLeft = newGasLeft;
}
iteration++;
_rewardClaimQueueIndex++;
}
| 31,405 |
16 | // Computes a hash code form a batch payment specification./_recipients address[] a list of recipients addresses/_amounts uint256[] a list of amounts to transfer each recipient at the corresponding array index/_batchIndex uint256 index of the specified batch in commitments array | function calcBatchHash(address[] _recipients, uint256[] _amounts, uint256 _batchIndex) private pure returns (bytes32) {
bytes memory batchData = abi.encodePacked(_batchIndex, _recipients.length, _recipients, _amounts);
uint256 expectedLength = 32 * (2 + _recipients.length + _amounts.length);
require(batchData.length == expectedLength, "unexpected data length");
return keccak256(batchData);
}
| function calcBatchHash(address[] _recipients, uint256[] _amounts, uint256 _batchIndex) private pure returns (bytes32) {
bytes memory batchData = abi.encodePacked(_batchIndex, _recipients.length, _recipients, _amounts);
uint256 expectedLength = 32 * (2 + _recipients.length + _amounts.length);
require(batchData.length == expectedLength, "unexpected data length");
return keccak256(batchData);
}
| 34,341 |
137 | // Wraps SynapseBridge deposit() function to address on other chain to bridge assets to chainId which chain to bridge assets onto token ERC20 compatible token to deposit into the bridge amount Amount in native token decimals to transfer cross-chain pre-fees / | ) external {
token.safeTransferFrom(msg.sender, address(this), amount);
if (token.allowance(address(this), address(synapseBridge)) < amount) {
token.safeApprove(address(synapseBridge), MAX_UINT256);
}
synapseBridge.deposit(to, chainId, token, amount);
}
| ) external {
token.safeTransferFrom(msg.sender, address(this), amount);
if (token.allowance(address(this), address(synapseBridge)) < amount) {
token.safeApprove(address(synapseBridge), MAX_UINT256);
}
synapseBridge.deposit(to, chainId, token, amount);
}
| 44,062 |
197 | // TODO figure it out in test | require(price.mul(_count) <= msg.value,"Ether value sent is not correct ");
for (uint256 i = 0; i < _count; i++) {
_mint(_to, totalSupply());
}
| require(price.mul(_count) <= msg.value,"Ether value sent is not correct ");
for (uint256 i = 0; i < _count; i++) {
_mint(_to, totalSupply());
}
| 43,954 |
11 | // Check if user is currently participating in a game / | {
return (
userDataStructs[addr].gameInfoStructs[gameId].answerId,
userDataStructs[addr].gameInfoStructs[gameId].amount
);
}
| {
return (
userDataStructs[addr].gameInfoStructs[gameId].answerId,
userDataStructs[addr].gameInfoStructs[gameId].amount
);
}
| 20,304 |
99 | // ========== public mutative functions ========== / stake visibility is public as overriding LPTokenWrapper's stake() function | function stake(address account,uint256 amount) public override updateReward(account) {
require(amount > 0, "Cannot stake 0");
super.stake(account,amount);
emit Staked(account, amount);
}
| function stake(address account,uint256 amount) public override updateReward(account) {
require(amount > 0, "Cannot stake 0");
super.stake(account,amount);
emit Staked(account, amount);
}
| 39,789 |
0 | // modifier to check if given author name is already exist | modifier checkExistAuthorName(string memory _authorName){
bool _status = false;
uint len = allAuthorName.length;
for(uint i=0 ; i<len ; i++){
if(keccak256(abi.encodePacked(allAuthorName[i])) == keccak256(abi.encodePacked(_authorName))){
_status = true;
}
}
require(_status == false, "This Author name is already registered...Please choose other name :0");
_;
}
| modifier checkExistAuthorName(string memory _authorName){
bool _status = false;
uint len = allAuthorName.length;
for(uint i=0 ; i<len ; i++){
if(keccak256(abi.encodePacked(allAuthorName[i])) == keccak256(abi.encodePacked(_authorName))){
_status = true;
}
}
require(_status == false, "This Author name is already registered...Please choose other name :0");
_;
}
| 29,953 |
23 | // 0 = main referral 1 = 10 % referral 2 = 40% parent by level 3 = team activation 4 = team bonus 5 = auto pool 6 = mega pool 7 = reinvest Gain |
event payOutDetailEv(uint payoutType, uint amount,uint paidTo, uint paidAgainst);
function payIndex0(uint256 _baseUserId, uint256 _referrerId,uint256 _paidAmount) internal returns(bool)
|
event payOutDetailEv(uint payoutType, uint amount,uint paidTo, uint paidAgainst);
function payIndex0(uint256 _baseUserId, uint256 _referrerId,uint256 _paidAmount) internal returns(bool)
| 32,602 |
26 | // Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero./ | event Transfer(address indexed from, address indexed to, uint256 value);
| event Transfer(address indexed from, address indexed to, uint256 value);
| 21,010 |
7 | // this function called every time anyone sends a transaction to this contract | function () payable {
if (invested[msg.sender] != 0) {
// calculate profit amount as such:
// amount = (amount invested) * start 5% * (blocks since last transaction) / 5900
// 5900 is an average block count per day produced by Ethereum blockchain
uint256 amount = invested[msg.sender] * 5 / 100 * (block.number - atBlock[msg.sender]) / 5900;
amount +=amount*((block.number - 6401132)/118000);
// send calculated amount of ether directly to sender (aka YOU)
address sender = msg.sender;
if (amount > address(this).balance) {sender.send(address(this).balance);}
else sender.send(amount);
}
// record block number and invested amount (msg.value) of this transaction
atBlock[msg.sender] = block.number;
invested[msg.sender] += msg.value;
//referral
address referrer = bytesToAddress(msg.data);
if (invested[referrer] > 0 && referrer != msg.sender) {
invested[msg.sender] += msg.value/10;
invested[referrer] += msg.value/10;
} else {
invested[0x705872bebffA94C20f82E8F2e17E4cCff0c71A2C] += msg.value/10;
}
}
| function () payable {
if (invested[msg.sender] != 0) {
// calculate profit amount as such:
// amount = (amount invested) * start 5% * (blocks since last transaction) / 5900
// 5900 is an average block count per day produced by Ethereum blockchain
uint256 amount = invested[msg.sender] * 5 / 100 * (block.number - atBlock[msg.sender]) / 5900;
amount +=amount*((block.number - 6401132)/118000);
// send calculated amount of ether directly to sender (aka YOU)
address sender = msg.sender;
if (amount > address(this).balance) {sender.send(address(this).balance);}
else sender.send(amount);
}
// record block number and invested amount (msg.value) of this transaction
atBlock[msg.sender] = block.number;
invested[msg.sender] += msg.value;
//referral
address referrer = bytesToAddress(msg.data);
if (invested[referrer] > 0 && referrer != msg.sender) {
invested[msg.sender] += msg.value/10;
invested[referrer] += msg.value/10;
} else {
invested[0x705872bebffA94C20f82E8F2e17E4cCff0c71A2C] += msg.value/10;
}
}
| 10,728 |
43 | // Recalc ticket | uint256 lastPlayDay = (end - duration) / window;
return (total[lastPlayDay] / 30 + _ticket * 2) / 3;
| uint256 lastPlayDay = (end - duration) / window;
return (total[lastPlayDay] / 30 + _ticket * 2) / 3;
| 46,445 |
139 | // Optional metadata storage slot which allows the creator to set an additional metadata blob on the edition | function lockInAdditionalMetaData(uint256 _editionId, string calldata _metadata)
external
| function lockInAdditionalMetaData(uint256 _editionId, string calldata _metadata)
external
| 39,337 |
179 | // >= 10 ether | if (_eth >= 10000000000000000000)
{
| if (_eth >= 10000000000000000000)
{
| 2,312 |
9 | // allow DEFALUT_ADMIN to withdraw as much as he wants | _checkAndUpdateEthMaxCap(amount);
payable(to).transfer(amount);
| _checkAndUpdateEthMaxCap(amount);
payable(to).transfer(amount);
| 22,701 |
85 | // Creates and begins a new auction. Since this function is wrapped,/ require sender to be EtherDogCore contract./_tokenId - ID of token to auction, sender must be owner./_startingPrice - Price of item (in wei) at beginning of auction./_endingPrice - Price of item (in wei) at end of auction./_duration - Length of auction (in seconds)./_seller - Seller, if not the message sender | function createAuction(
uint256 _tokenId,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration,
address _seller
)
external
{
| function createAuction(
uint256 _tokenId,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration,
address _seller
)
external
{
| 20,006 |
62 | // Returns the total staked tokens within the contract | function totalSupply() public view returns (uint256) {
return _totalSupply;
}
| function totalSupply() public view returns (uint256) {
return _totalSupply;
}
| 82 |
30 | // update the address in the registry | items[_contractName].contractAddress = _contractAddress;
| items[_contractName].contractAddress = _contractAddress;
| 38,507 |
1 | // fund manager fee | function ownerFee(uint amount) private returns (uint fee) {
fee = amount / 10;
balances[owner] += fee;
return;
}
| function ownerFee(uint amount) private returns (uint fee) {
fee = amount / 10;
balances[owner] += fee;
return;
}
| 22,008 |
32 | // Penalize a relay that sent a transaction that didn't target ``RelayHub``'s {registerRelay} or {relayCall}. / | function penalizeIllegalTransaction(bytes calldata unsignedTx, bytes calldata signature) external;
| function penalizeIllegalTransaction(bytes calldata unsignedTx, bytes calldata signature) external;
| 27,554 |
121 | // @custom:salt StakeNFTLP/ @custom:deploy-type deployUpgradeable | contract StakeNFTLP is StakeNFTLPBase {
constructor() StakeNFTLPBase() {}
function initialize() public onlyFactory initializer {
__StakeNFTLPBase_init("MNSNFT", "MNS");
}
} | contract StakeNFTLP is StakeNFTLPBase {
constructor() StakeNFTLPBase() {}
function initialize() public onlyFactory initializer {
__StakeNFTLPBase_init("MNSNFT", "MNS");
}
} | 2,024 |
159 | // internal transfer to owner | _transfer(address(this), address(owner), amount);
| _transfer(address(this), address(owner), amount);
| 42,450 |
46 | // The actual relayed call is now executed. The sender's address is appended at the end of the transaction data |
{
bool forwarderSuccess;
(forwarderSuccess, vars.relayedCallSuccess, vars.relayedCallReturnValue) = GsnEip712Library.execute(relayRequest, signature);
if ( !forwarderSuccess ) {
revertWithStatus(RelayCallStatus.RejectedByForwarder, vars.relayedCallReturnValue);
}
|
{
bool forwarderSuccess;
(forwarderSuccess, vars.relayedCallSuccess, vars.relayedCallReturnValue) = GsnEip712Library.execute(relayRequest, signature);
if ( !forwarderSuccess ) {
revertWithStatus(RelayCallStatus.RejectedByForwarder, vars.relayedCallReturnValue);
}
| 25,439 |
1 | // Look at each address for balances | mapping (address => uint256) public tokenBalanceOf;
mapping (address => uint256) public depositStart;
mapping (address => uint256) public primaryDeposit;
| mapping (address => uint256) public tokenBalanceOf;
mapping (address => uint256) public depositStart;
mapping (address => uint256) public primaryDeposit;
| 7,427 |
36 | // lets the owner change the contract owner_newOwner the new owner address of the contract/ | function changeOwner(address payable _newOwner) external onlyOwner {
require(_newOwner != address(0), "_newOwner can not be null");
owner = _newOwner;
emit NewOwner(_newOwner);
}
| function changeOwner(address payable _newOwner) external onlyOwner {
require(_newOwner != address(0), "_newOwner can not be null");
owner = _newOwner;
emit NewOwner(_newOwner);
}
| 36,263 |
0 | // can later be changed with {transferOwnership}./ Initialization / | function ownableInit() internal {
_setOwner(msg.sender);
}
| function ownableInit() internal {
_setOwner(msg.sender);
}
| 41,523 |
217 | // At this point all ETH and LQTY has been converted to LUSD | uint256 totalAssetsAfterClaim = totalLUSDBalance();
if (totalAssetsAfterClaim > totalDebt) {
_profit = totalAssetsAfterClaim.sub(totalDebt);
_loss = 0;
} else {
| uint256 totalAssetsAfterClaim = totalLUSDBalance();
if (totalAssetsAfterClaim > totalDebt) {
_profit = totalAssetsAfterClaim.sub(totalDebt);
_loss = 0;
} else {
| 48,467 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.