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 |
|---|---|---|---|---|
196 | // event emitted when tokens are minted | event MinterMinted(
address target,
uint256 tokenHash,
uint256 amount
);
| event MinterMinted(
address target,
uint256 tokenHash,
uint256 amount
);
| 76,913 |
106 | // test morning | function claimDecompose(string memory name, uint8 garden) public {
uint8 i = tulipType(name);
require(_tulipToken[i][garden].isDecomposing[msg.sender], "308");//This token is not decomposing
require(i > 0, "310");//Cannot decompose a seed! //redundant
| function claimDecompose(string memory name, uint8 garden) public {
uint8 i = tulipType(name);
require(_tulipToken[i][garden].isDecomposing[msg.sender], "308");//This token is not decomposing
require(i > 0, "310");//Cannot decompose a seed! //redundant
| 22,724 |
55 | // Locker Locker holds tokens and releases them at a certain time. / | contract Locker is Ownable {
using SafeMath for uint;
using SafeERC20 for ERC20Basic;
/**
* It is init state only when adding release info is possible.
* beneficiary only can release tokens when Locker is active.
* After all tokens are released, locker is drawn.
*/
enum State { Init, Ready, Active, Drawn }
struct Beneficiary {
uint ratio; // ratio based on Locker's initial balance.
uint withdrawAmount; // accumulated tokens beneficiary released
bool releaseAllTokens;
}
/**
* @notice Release has info to release tokens.
* If lock type is straight, only two release infos is required.
*
* |
* 100 | _______________
* | _/
* 50 | _/
* | . |
* | . |
* | . |
* +===+=======+----*----------> time
* Locker First Last
* Activated Release Release
*
*
* If lock type is variable, the release graph will be
*
* |
* 100 | _________
* | |
* 70 | __________|
* | |
* 30 | _________|
* | |
* +===+=======+---------+----------*------> time
* Locker First Second Last
* Activated Release Release Release
*
*
*
* For the first straight release graph, parameters would be
* coeff: 100
* releaseTimes: [
* first release time,
* second release time
* ]
* releaseRatios: [
* 50,
* 100,
* ]
*
* For the second variable release graph, parameters would be
* coeff: 100
* releaseTimes: [
* first release time,
* second release time,
* last release time
* ]
* releaseRatios: [
* 30,
* 70,
* 100,
* ]
*
*/
struct Release {
bool isStraight; // lock type : straight or variable
uint[] releaseTimes; //
uint[] releaseRatios; //
}
uint public activeTime;
// ERC20 basic token contract being held
ERC20Basic public token;
uint public coeff;
uint public initialBalance;
uint public withdrawAmount; // total amount of tokens released
mapping (address => Beneficiary) public beneficiaries;
mapping (address => Release) public releases; // beneficiary's lock
mapping (address => bool) public locked; // whether beneficiary's lock is instantiated
uint public numBeneficiaries;
uint public numLocks;
State public state;
modifier onlyState(State v) {
require(state == v);
_;
}
modifier onlyBeneficiary(address _addr) {
require(beneficiaries[_addr].ratio > 0);
_;
}
event StateChanged(State _state);
event Locked(address indexed _beneficiary, bool _isStraight);
event Released(address indexed _beneficiary, uint256 _amount);
function Locker(address _token, uint _coeff, address[] _beneficiaries, uint[] _ratios) public {
require(_token != address(0));
require(_beneficiaries.length == _ratios.length);
token = ERC20Basic(_token);
coeff = _coeff;
numBeneficiaries = _beneficiaries.length;
uint accRatio;
for(uint i = 0; i < numBeneficiaries; i++) {
require(_ratios[i] > 0);
beneficiaries[_beneficiaries[i]].ratio = _ratios[i];
accRatio = accRatio.add(_ratios[i]);
}
require(coeff == accRatio);
}
/**
* @notice beneficiary can release their tokens after activated
*/
function activate() external onlyOwner onlyState(State.Ready) {
require(numLocks == numBeneficiaries); // double check : assert all releases are recorded
initialBalance = token.balanceOf(this);
require(initialBalance > 0);
activeTime = now; // solium-disable-line security/no-block-members
// set locker as active state
state = State.Active;
emit StateChanged(state);
}
function getReleaseType(address _beneficiary)
public
view
onlyBeneficiary(_beneficiary)
returns (bool)
{
return releases[_beneficiary].isStraight;
}
function getTotalLockedAmounts(address _beneficiary)
public
view
onlyBeneficiary(_beneficiary)
returns (uint)
{
return getPartialAmount(beneficiaries[_beneficiary].ratio, coeff, initialBalance);
}
function getReleaseTimes(address _beneficiary)
public
view
onlyBeneficiary(_beneficiary)
returns (uint[])
{
return releases[_beneficiary].releaseTimes;
}
function getReleaseRatios(address _beneficiary)
public
view
onlyBeneficiary(_beneficiary)
returns (uint[])
{
return releases[_beneficiary].releaseRatios;
}
/**
* @notice add new release record for beneficiary
*/
function lock(address _beneficiary, bool _isStraight, uint[] _releaseTimes, uint[] _releaseRatios)
external
onlyOwner
onlyState(State.Init)
onlyBeneficiary(_beneficiary)
{
require(!locked[_beneficiary]);
require(_releaseRatios.length != 0);
require(_releaseRatios.length == _releaseTimes.length);
uint i;
uint len = _releaseRatios.length;
// finally should release all tokens
require(_releaseRatios[len - 1] == coeff);
// check two array are ascending sorted
for(i = 0; i < len - 1; i++) {
require(_releaseTimes[i] < _releaseTimes[i + 1]);
require(_releaseRatios[i] < _releaseRatios[i + 1]);
}
// 2 release times for straight locking type
if (_isStraight) {
require(len == 2);
}
numLocks = numLocks.add(1);
// create Release for the beneficiary
releases[_beneficiary].isStraight = _isStraight;
// copy array of uint
releases[_beneficiary].releaseTimes = _releaseTimes;
releases[_beneficiary].releaseRatios = _releaseRatios;
// lock beneficiary
locked[_beneficiary] = true;
emit Locked(_beneficiary, _isStraight);
// if all beneficiaries locked, change Locker state to change
if (numLocks == numBeneficiaries) {
state = State.Ready;
emit StateChanged(state);
}
}
/**
* @notice transfer releasable tokens for beneficiary wrt the release graph
*/
function release() external onlyState(State.Active) onlyBeneficiary(msg.sender) {
require(!beneficiaries[msg.sender].releaseAllTokens);
uint releasableAmount = getReleasableAmount(msg.sender);
beneficiaries[msg.sender].withdrawAmount = beneficiaries[msg.sender].withdrawAmount.add(releasableAmount);
beneficiaries[msg.sender].releaseAllTokens = beneficiaries[msg.sender].withdrawAmount == getPartialAmount(
beneficiaries[msg.sender].ratio,
coeff,
initialBalance);
withdrawAmount = withdrawAmount.add(releasableAmount);
if (withdrawAmount == initialBalance) {
state = State.Drawn;
emit StateChanged(state);
}
token.transfer(msg.sender, releasableAmount);
emit Released(msg.sender, releasableAmount);
}
function getReleasableAmount(address _beneficiary) internal view returns (uint) {
if (releases[_beneficiary].isStraight) {
return getStraightReleasableAmount(_beneficiary);
} else {
return getVariableReleasableAmount(_beneficiary);
}
}
/**
* @notice return releaseable amount for beneficiary in case of straight type of release
*/
function getStraightReleasableAmount(address _beneficiary) internal view returns (uint releasableAmount) {
Beneficiary memory _b = beneficiaries[_beneficiary];
Release memory _r = releases[_beneficiary];
// total amount of tokens beneficiary can release
uint totalReleasableAmount = getTotalLockedAmounts(_beneficiary);
uint firstTime = _r.releaseTimes[0];
uint lastTime = _r.releaseTimes[1];
// solium-disable security/no-block-members
require(now >= firstTime); // pass if can release
// solium-enable security/no-block-members
if(now >= lastTime) { // inclusive to reduce calculation
releasableAmount = totalReleasableAmount;
} else {
// releasable amount at first time
uint firstAmount = getPartialAmount(
_r.releaseRatios[0],
coeff,
totalReleasableAmount);
// partial amount without first amount
releasableAmount = getPartialAmount(
now.sub(firstTime),
lastTime.sub(firstTime),
totalReleasableAmount.sub(firstAmount));
releasableAmount = releasableAmount.add(firstAmount);
}
// subtract already withdrawn amounts
releasableAmount = releasableAmount.sub(_b.withdrawAmount);
}
/**
* @notice return releaseable amount for beneficiary in case of variable type of release
*/
function getVariableReleasableAmount(address _beneficiary) internal view returns (uint releasableAmount) {
Beneficiary memory _b = beneficiaries[_beneficiary];
Release memory _r = releases[_beneficiary];
// total amount of tokens beneficiary will receive
uint totalReleasableAmount = getTotalLockedAmounts(_beneficiary);
uint releaseRatio;
// reverse order for short curcit
for(uint i = _r.releaseTimes.length - 1; i >= 0; i--) {
if (now >= _r.releaseTimes[i]) {
releaseRatio = _r.releaseRatios[i];
break;
}
}
require(releaseRatio > 0);
releasableAmount = getPartialAmount(
releaseRatio,
coeff,
totalReleasableAmount);
releasableAmount = releasableAmount.sub(_b.withdrawAmount);
}
/// https://github.com/0xProject/0x.js/blob/05aae368132a81ddb9fd6a04ac5b0ff1cbb24691/packages/contracts/src/current/protocol/Exchange/Exchange.sol#L497
/// @notice Calculates partial value given a numerator and denominator.
/// @param numerator Numerator.
/// @param denominator Denominator.
/// @param target Value to calculate partial of.
/// @return Partial value of target.
function getPartialAmount(uint numerator, uint denominator, uint target) public pure returns (uint) {
return numerator.mul(target).div(denominator);
}
} | contract Locker is Ownable {
using SafeMath for uint;
using SafeERC20 for ERC20Basic;
/**
* It is init state only when adding release info is possible.
* beneficiary only can release tokens when Locker is active.
* After all tokens are released, locker is drawn.
*/
enum State { Init, Ready, Active, Drawn }
struct Beneficiary {
uint ratio; // ratio based on Locker's initial balance.
uint withdrawAmount; // accumulated tokens beneficiary released
bool releaseAllTokens;
}
/**
* @notice Release has info to release tokens.
* If lock type is straight, only two release infos is required.
*
* |
* 100 | _______________
* | _/
* 50 | _/
* | . |
* | . |
* | . |
* +===+=======+----*----------> time
* Locker First Last
* Activated Release Release
*
*
* If lock type is variable, the release graph will be
*
* |
* 100 | _________
* | |
* 70 | __________|
* | |
* 30 | _________|
* | |
* +===+=======+---------+----------*------> time
* Locker First Second Last
* Activated Release Release Release
*
*
*
* For the first straight release graph, parameters would be
* coeff: 100
* releaseTimes: [
* first release time,
* second release time
* ]
* releaseRatios: [
* 50,
* 100,
* ]
*
* For the second variable release graph, parameters would be
* coeff: 100
* releaseTimes: [
* first release time,
* second release time,
* last release time
* ]
* releaseRatios: [
* 30,
* 70,
* 100,
* ]
*
*/
struct Release {
bool isStraight; // lock type : straight or variable
uint[] releaseTimes; //
uint[] releaseRatios; //
}
uint public activeTime;
// ERC20 basic token contract being held
ERC20Basic public token;
uint public coeff;
uint public initialBalance;
uint public withdrawAmount; // total amount of tokens released
mapping (address => Beneficiary) public beneficiaries;
mapping (address => Release) public releases; // beneficiary's lock
mapping (address => bool) public locked; // whether beneficiary's lock is instantiated
uint public numBeneficiaries;
uint public numLocks;
State public state;
modifier onlyState(State v) {
require(state == v);
_;
}
modifier onlyBeneficiary(address _addr) {
require(beneficiaries[_addr].ratio > 0);
_;
}
event StateChanged(State _state);
event Locked(address indexed _beneficiary, bool _isStraight);
event Released(address indexed _beneficiary, uint256 _amount);
function Locker(address _token, uint _coeff, address[] _beneficiaries, uint[] _ratios) public {
require(_token != address(0));
require(_beneficiaries.length == _ratios.length);
token = ERC20Basic(_token);
coeff = _coeff;
numBeneficiaries = _beneficiaries.length;
uint accRatio;
for(uint i = 0; i < numBeneficiaries; i++) {
require(_ratios[i] > 0);
beneficiaries[_beneficiaries[i]].ratio = _ratios[i];
accRatio = accRatio.add(_ratios[i]);
}
require(coeff == accRatio);
}
/**
* @notice beneficiary can release their tokens after activated
*/
function activate() external onlyOwner onlyState(State.Ready) {
require(numLocks == numBeneficiaries); // double check : assert all releases are recorded
initialBalance = token.balanceOf(this);
require(initialBalance > 0);
activeTime = now; // solium-disable-line security/no-block-members
// set locker as active state
state = State.Active;
emit StateChanged(state);
}
function getReleaseType(address _beneficiary)
public
view
onlyBeneficiary(_beneficiary)
returns (bool)
{
return releases[_beneficiary].isStraight;
}
function getTotalLockedAmounts(address _beneficiary)
public
view
onlyBeneficiary(_beneficiary)
returns (uint)
{
return getPartialAmount(beneficiaries[_beneficiary].ratio, coeff, initialBalance);
}
function getReleaseTimes(address _beneficiary)
public
view
onlyBeneficiary(_beneficiary)
returns (uint[])
{
return releases[_beneficiary].releaseTimes;
}
function getReleaseRatios(address _beneficiary)
public
view
onlyBeneficiary(_beneficiary)
returns (uint[])
{
return releases[_beneficiary].releaseRatios;
}
/**
* @notice add new release record for beneficiary
*/
function lock(address _beneficiary, bool _isStraight, uint[] _releaseTimes, uint[] _releaseRatios)
external
onlyOwner
onlyState(State.Init)
onlyBeneficiary(_beneficiary)
{
require(!locked[_beneficiary]);
require(_releaseRatios.length != 0);
require(_releaseRatios.length == _releaseTimes.length);
uint i;
uint len = _releaseRatios.length;
// finally should release all tokens
require(_releaseRatios[len - 1] == coeff);
// check two array are ascending sorted
for(i = 0; i < len - 1; i++) {
require(_releaseTimes[i] < _releaseTimes[i + 1]);
require(_releaseRatios[i] < _releaseRatios[i + 1]);
}
// 2 release times for straight locking type
if (_isStraight) {
require(len == 2);
}
numLocks = numLocks.add(1);
// create Release for the beneficiary
releases[_beneficiary].isStraight = _isStraight;
// copy array of uint
releases[_beneficiary].releaseTimes = _releaseTimes;
releases[_beneficiary].releaseRatios = _releaseRatios;
// lock beneficiary
locked[_beneficiary] = true;
emit Locked(_beneficiary, _isStraight);
// if all beneficiaries locked, change Locker state to change
if (numLocks == numBeneficiaries) {
state = State.Ready;
emit StateChanged(state);
}
}
/**
* @notice transfer releasable tokens for beneficiary wrt the release graph
*/
function release() external onlyState(State.Active) onlyBeneficiary(msg.sender) {
require(!beneficiaries[msg.sender].releaseAllTokens);
uint releasableAmount = getReleasableAmount(msg.sender);
beneficiaries[msg.sender].withdrawAmount = beneficiaries[msg.sender].withdrawAmount.add(releasableAmount);
beneficiaries[msg.sender].releaseAllTokens = beneficiaries[msg.sender].withdrawAmount == getPartialAmount(
beneficiaries[msg.sender].ratio,
coeff,
initialBalance);
withdrawAmount = withdrawAmount.add(releasableAmount);
if (withdrawAmount == initialBalance) {
state = State.Drawn;
emit StateChanged(state);
}
token.transfer(msg.sender, releasableAmount);
emit Released(msg.sender, releasableAmount);
}
function getReleasableAmount(address _beneficiary) internal view returns (uint) {
if (releases[_beneficiary].isStraight) {
return getStraightReleasableAmount(_beneficiary);
} else {
return getVariableReleasableAmount(_beneficiary);
}
}
/**
* @notice return releaseable amount for beneficiary in case of straight type of release
*/
function getStraightReleasableAmount(address _beneficiary) internal view returns (uint releasableAmount) {
Beneficiary memory _b = beneficiaries[_beneficiary];
Release memory _r = releases[_beneficiary];
// total amount of tokens beneficiary can release
uint totalReleasableAmount = getTotalLockedAmounts(_beneficiary);
uint firstTime = _r.releaseTimes[0];
uint lastTime = _r.releaseTimes[1];
// solium-disable security/no-block-members
require(now >= firstTime); // pass if can release
// solium-enable security/no-block-members
if(now >= lastTime) { // inclusive to reduce calculation
releasableAmount = totalReleasableAmount;
} else {
// releasable amount at first time
uint firstAmount = getPartialAmount(
_r.releaseRatios[0],
coeff,
totalReleasableAmount);
// partial amount without first amount
releasableAmount = getPartialAmount(
now.sub(firstTime),
lastTime.sub(firstTime),
totalReleasableAmount.sub(firstAmount));
releasableAmount = releasableAmount.add(firstAmount);
}
// subtract already withdrawn amounts
releasableAmount = releasableAmount.sub(_b.withdrawAmount);
}
/**
* @notice return releaseable amount for beneficiary in case of variable type of release
*/
function getVariableReleasableAmount(address _beneficiary) internal view returns (uint releasableAmount) {
Beneficiary memory _b = beneficiaries[_beneficiary];
Release memory _r = releases[_beneficiary];
// total amount of tokens beneficiary will receive
uint totalReleasableAmount = getTotalLockedAmounts(_beneficiary);
uint releaseRatio;
// reverse order for short curcit
for(uint i = _r.releaseTimes.length - 1; i >= 0; i--) {
if (now >= _r.releaseTimes[i]) {
releaseRatio = _r.releaseRatios[i];
break;
}
}
require(releaseRatio > 0);
releasableAmount = getPartialAmount(
releaseRatio,
coeff,
totalReleasableAmount);
releasableAmount = releasableAmount.sub(_b.withdrawAmount);
}
/// https://github.com/0xProject/0x.js/blob/05aae368132a81ddb9fd6a04ac5b0ff1cbb24691/packages/contracts/src/current/protocol/Exchange/Exchange.sol#L497
/// @notice Calculates partial value given a numerator and denominator.
/// @param numerator Numerator.
/// @param denominator Denominator.
/// @param target Value to calculate partial of.
/// @return Partial value of target.
function getPartialAmount(uint numerator, uint denominator, uint target) public pure returns (uint) {
return numerator.mul(target).div(denominator);
}
} | 29,372 |
18 | // Events //Event to emit if a ring is successfully mined./ _amountsList is an array of:/ [_amountS, _amountB, _lrcReward, _lrcFee, splitS, splitB]. | event RingMined(
uint _ringIndex,
bytes32 indexed _ringHash,
address _miner,
address _feeRecipient,
bytes32[] _orderHashList,
uint[6][] _amountsList
);
event OrderCancelled(
bytes32 indexed _orderHash,
| event RingMined(
uint _ringIndex,
bytes32 indexed _ringHash,
address _miner,
address _feeRecipient,
bytes32[] _orderHashList,
uint[6][] _amountsList
);
event OrderCancelled(
bytes32 indexed _orderHash,
| 37,935 |
33 | // Rebate All Unclaimed Bids & Sends Remaining ETH To Multisig / | function ___InitiateRebateAndProceeds() external onlyAdmin
| function ___InitiateRebateAndProceeds() external onlyAdmin
| 43,493 |
100 | // Set the address that can mint, burn and rebasename_ Name of the token symbol_ Symbol of the token decimals_ Decimal places of the token - purely for display purposes maxExpectedSupply_ Maximum possilbe supply of the token. initialSupply_ Inital supply of the token, sent to the creator of the token / | function initialize(
string memory name_,
string memory symbol_,
uint8 decimals_,
uint256 maxExpectedSupply_,
uint256 initialSupply_
| function initialize(
string memory name_,
string memory symbol_,
uint8 decimals_,
uint256 maxExpectedSupply_,
uint256 initialSupply_
| 48,807 |
14 | // A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform/ to the ERC20 specification/ return The address of the Uniswap V3 Pool | function pool() external view returns (IUniswapV3Pool);
| function pool() external view returns (IUniswapV3Pool);
| 14,813 |
3 | // Only allow minting one token id at time/Mint contract function that calls the underlying sales function for commands/minter Address for the minter/tokenId tokenId to mint, set to 0 for new tokenId/quantity to mint/minterArguments calldata for the minter contracts | function mint(IMinter1155 minter, uint256 tokenId, uint256 quantity, bytes calldata minterArguments) external payable;
function adminMint(address recipient, uint256 tokenId, uint256 quantity, bytes memory data) external;
function adminMintBatch(address recipient, uint256[] memory tokenIds, uint256[] memory quantities, bytes memory data) external;
function burnBatch(address user, uint256[] calldata tokenIds, uint256[] calldata amounts) external;
| function mint(IMinter1155 minter, uint256 tokenId, uint256 quantity, bytes calldata minterArguments) external payable;
function adminMint(address recipient, uint256 tokenId, uint256 quantity, bytes memory data) external;
function adminMintBatch(address recipient, uint256[] memory tokenIds, uint256[] memory quantities, bytes memory data) external;
function burnBatch(address user, uint256[] calldata tokenIds, uint256[] calldata amounts) external;
| 20,422 |
83 | // Compiler will pack this into a single 256bit word. | struct TokenOwnership {
// The address of the owner.
address addr;
// Keeps track of the start time of ownership with minimal overhead for tokenomics.
uint64 startTimestamp;
// Whether the token has been burned.
bool burned;
}
| struct TokenOwnership {
// The address of the owner.
address addr;
// Keeps track of the start time of ownership with minimal overhead for tokenomics.
uint64 startTimestamp;
// Whether the token has been burned.
bool burned;
}
| 12,063 |
34 | // Constructor, takes maximum amount of wei accepted in the crowdsale. _cap Max amount of wei to be contributed / | function CappedCrowdsale(uint256 _cap) public {
require(_cap > 0);
cap = _cap;
}
| function CappedCrowdsale(uint256 _cap) public {
require(_cap > 0);
cap = _cap;
}
| 30,192 |
94 | // The strategy's last updated index | uint224 index;
| uint224 index;
| 17,274 |
322 | // sumBorrowPlusEffects += oraclePriceborrowBalance | vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(vars.oraclePrice, vars.borrowBalance, vars.sumBorrowPlusEffects);
| vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(vars.oraclePrice, vars.borrowBalance, vars.sumBorrowPlusEffects);
| 7,517 |
11 | // executeDiamondCut takes one single FacetCut action and executes it if FacetCutAction can't be identified, it reverts | function executeDiamondCut(uint256 selectorCount, IDiamondCut.FacetCut memory cut) internal returns (uint256) {
require(cut.functionSelectors.length > 0, "LibDiamond: No selectors in facet to cut");
if (cut.action == IDiamondCut.FacetCutAction.Add) {
require(cut.facetAddress != address(0), "LibDiamond: add facet address can't be address(0)");
enforceHasContractCode(cut.facetAddress, "LibDiamond: add facet must have code");
return _handleAddCut(selectorCount, cut);
}
if (cut.action == IDiamondCut.FacetCutAction.Replace) {
require(cut.facetAddress != address(0), "LibDiamond: remove facet address can't be address(0)");
enforceHasContractCode(cut.facetAddress, "LibDiamond: remove facet must have code");
return _handleReplaceCut(selectorCount, cut);
}
if (cut.action == IDiamondCut.FacetCutAction.Remove) {
require(cut.facetAddress == address(0), "LibDiamond: remove facet address must be address(0)");
return _handleRemoveCut(selectorCount, cut);
}
revert("LibDiamondCut: Incorrect FacetCutAction");
}
| function executeDiamondCut(uint256 selectorCount, IDiamondCut.FacetCut memory cut) internal returns (uint256) {
require(cut.functionSelectors.length > 0, "LibDiamond: No selectors in facet to cut");
if (cut.action == IDiamondCut.FacetCutAction.Add) {
require(cut.facetAddress != address(0), "LibDiamond: add facet address can't be address(0)");
enforceHasContractCode(cut.facetAddress, "LibDiamond: add facet must have code");
return _handleAddCut(selectorCount, cut);
}
if (cut.action == IDiamondCut.FacetCutAction.Replace) {
require(cut.facetAddress != address(0), "LibDiamond: remove facet address can't be address(0)");
enforceHasContractCode(cut.facetAddress, "LibDiamond: remove facet must have code");
return _handleReplaceCut(selectorCount, cut);
}
if (cut.action == IDiamondCut.FacetCutAction.Remove) {
require(cut.facetAddress == address(0), "LibDiamond: remove facet address must be address(0)");
return _handleRemoveCut(selectorCount, cut);
}
revert("LibDiamondCut: Incorrect FacetCutAction");
}
| 19,449 |
280 | // we will lose money until we claim comp then we will make moneythis has an unintended side effect of slowly lowering our total debt allowed | _loss = debt - balance;
_debtPayment = Math.min(wantBalance, _debtOutstanding);
| _loss = debt - balance;
_debtPayment = Math.min(wantBalance, _debtOutstanding);
| 9,929 |
111 | // grandfather | uint256 aff_affID = _plyr[affID].laff;
uint256 aff_affReward = amount.mul(_refer2RewardRate).div(_baseRate);
if(aff_affID <= 0){
aff_affID = _pIDxName[_defaulRefer];
}
| uint256 aff_affID = _plyr[affID].laff;
uint256 aff_affReward = amount.mul(_refer2RewardRate).div(_baseRate);
if(aff_affID <= 0){
aff_affID = _pIDxName[_defaulRefer];
}
| 22,310 |
64 | // Lets an authorised module set the lock for a wallet. _wallet The target wallet. _releaseAfter The epoch time at which the lock should automatically release. / | function setLock(BaseWallet _wallet, uint256 _releaseAfter) external onlyModule(_wallet) {
configs[address(_wallet)].lock = _releaseAfter; //inject NONPUBLIC VAR ACCESSD BY PUBLIC FUNC
if (_releaseAfter != 0 && msg.sender != configs[address(_wallet)].locker) { //inject NONPUBLIC VAR ACCESSD BY PUBLIC FUNC
configs[address(_wallet)].locker = msg.sender; //inject NONPUBLIC VAR ACCESSD BY PUBLIC FUNC
}
}
| function setLock(BaseWallet _wallet, uint256 _releaseAfter) external onlyModule(_wallet) {
configs[address(_wallet)].lock = _releaseAfter; //inject NONPUBLIC VAR ACCESSD BY PUBLIC FUNC
if (_releaseAfter != 0 && msg.sender != configs[address(_wallet)].locker) { //inject NONPUBLIC VAR ACCESSD BY PUBLIC FUNC
configs[address(_wallet)].locker = msg.sender; //inject NONPUBLIC VAR ACCESSD BY PUBLIC FUNC
}
}
| 29,152 |
32 | // Update total payout of offer request | claimData.setRequestIdToPayout(cover.requestId, payout);
| claimData.setRequestIdToPayout(cover.requestId, payout);
| 10,543 |
6 | // Emitted when the Allocator is activated. / | event AllocatorActivated();
| event AllocatorActivated();
| 39,078 |
229 | // Now with the tokens this contract can send them to msg.sender | bool xfer = IERC20(token).transfer(msg.sender, deltaBalance);
require(xfer, "ERR_ERC20_FALSE");
self.pullPoolShareFromLib(msg.sender, poolShares);
self.burnPoolShareFromLib(poolShares);
| bool xfer = IERC20(token).transfer(msg.sender, deltaBalance);
require(xfer, "ERR_ERC20_FALSE");
self.pullPoolShareFromLib(msg.sender, poolShares);
self.burnPoolShareFromLib(poolShares);
| 16,157 |
174 | // EmpireDEX | event Sweep(uint256 sweepAmount);
event Unsweep(uint256 unsweepAmount);
| event Sweep(uint256 sweepAmount);
event Unsweep(uint256 unsweepAmount);
| 44,189 |
28 | // Destroys amount tokens from account, reducing thetotal supply. | * Emits a {Transfer} event with to set to the zero address.
*
* Requirements:
*
* - account cannot be the zero address.
* - account must have at least amount tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
| * Emits a {Transfer} event with to set to the zero address.
*
* Requirements:
*
* - account cannot be the zero address.
* - account must have at least amount tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
| 17,628 |
106 | // clear any previously approved ownership exchange | delete PlayerIndexToApproved[_tokenId];
| delete PlayerIndexToApproved[_tokenId];
| 35,170 |
3 | // 定義一個事件「租客繳交押金」 | event DepositPayed(
uint256 timestamp,
address tenantAddress,
uint256 amountThisTime,
uint256 amountAccumulated
);
| event DepositPayed(
uint256 timestamp,
address tenantAddress,
uint256 amountThisTime,
uint256 amountAccumulated
);
| 9,749 |
2 | // Utility library of inline functions on addresses / | library LibAddress {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until after the constructor finishes.
* @param account address of the account to check
* @return whether the target address is a contract
*/
function isContract(address account) internal view returns (bool) {
uint256 size;
// XXX Currently there is no better way to check if there is a contract in an address
// than to check the size of the code at that address.
// See https://ethereum.stackexchange.com/a/14016/36603
// for more details about how this works.
// TODO Check this again before the Serenity release, because all addresses will be
// contracts then.
// solium-disable-next-line security/no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
| library LibAddress {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until after the constructor finishes.
* @param account address of the account to check
* @return whether the target address is a contract
*/
function isContract(address account) internal view returns (bool) {
uint256 size;
// XXX Currently there is no better way to check if there is a contract in an address
// than to check the size of the code at that address.
// See https://ethereum.stackexchange.com/a/14016/36603
// for more details about how this works.
// TODO Check this again before the Serenity release, because all addresses will be
// contracts then.
// solium-disable-next-line security/no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
| 34,555 |
58 | // Buys an IdeaTokenideaToken The IdeaToken to buy amount The amount of IdeaTokens to buy cost The cost in Dai for the purchase of `amount` IdeaTokens recipient The recipient of the bought IdeaTokens/ | function buyInternal(address ideaToken, uint amount, uint cost, address recipient) internal {
IIdeaTokenExchange exchange = _ideaTokenExchange;
require(_dai.approve(address(exchange), cost), "approve");
exchange.buyTokens(ideaToken, amount, amount, cost, recipient);
}
| function buyInternal(address ideaToken, uint amount, uint cost, address recipient) internal {
IIdeaTokenExchange exchange = _ideaTokenExchange;
require(_dai.approve(address(exchange), cost), "approve");
exchange.buyTokens(ideaToken, amount, amount, cost, recipient);
}
| 58,316 |
94 | // Swap BLOT token. account.amount The amount that will be swapped./ | function swapBLOT(address _of, address _to, uint256 amount) public;
function totalBalanceOf(address _of)
public
view
returns (uint256 amount);
function transferFrom(address _token, address _of, address _to, uint256 amount) public;
| function swapBLOT(address _of, address _to, uint256 amount) public;
function totalBalanceOf(address _of)
public
view
returns (uint256 amount);
function transferFrom(address _token, address _of, address _to, uint256 amount) public;
| 13,978 |
267 | // userDelegatedTo returns the address to which a user delegated their voting power; address(0) if not delegated | function userDelegatedTo(address user) public view returns (address) {
LibBarnStorage.Stake memory c = stakeAtTs(user, block.timestamp);
return c.delegatedTo;
}
| function userDelegatedTo(address user) public view returns (address) {
LibBarnStorage.Stake memory c = stakeAtTs(user, block.timestamp);
return c.delegatedTo;
}
| 34,065 |
67 | // Else, this is a normal slow relay being finalizes where the contract sends ERC20 to the recipient OR this is the finalization of an instant relay where we need to reimburse the instant relayer in WETH. | } else
| } else
| 7,999 |
10 | // Mapping address of accounts in whitelist | mapping(address => bool) private _participants;
| mapping(address => bool) private _participants;
| 16,458 |
2 | // Fired in registerNFT()nft NFT contract address registered / | event RegisterNFT(address indexed nft);
| event RegisterNFT(address indexed nft);
| 20,529 |
15 | // signature must be filled in order to use the Wrapper | if (order.signature.v == 0) {
errors[errorCount] = "SIGNATURE_MUST_BE_SENT";
errorCount++;
}
| if (order.signature.v == 0) {
errors[errorCount] = "SIGNATURE_MUST_BE_SENT";
errorCount++;
}
| 34,418 |
6 | // Constrctor function Initializes contract with initial supply tokens to the creator of the contract / | constructor() public {
name = "FloppaCoin";
symbol = "FLOP";
decimals = 18;
_totalSupply = 314159265358979323846264338346;
balances[msg.sender] = _totalSupply;
emit Transfer(address(0), msg.sender, _totalSupply);
}
| constructor() public {
name = "FloppaCoin";
symbol = "FLOP";
decimals = 18;
_totalSupply = 314159265358979323846264338346;
balances[msg.sender] = _totalSupply;
emit Transfer(address(0), msg.sender, _totalSupply);
}
| 40,741 |
269 | // check if `_addr` has permission to user alpaca `_id` to breed with as sire. / | function hasPermissionToBreedAsSire(address _addr, uint256 _id)
external
override
view
returns (bool)
| function hasPermissionToBreedAsSire(address _addr, uint256 _id)
external
override
view
returns (bool)
| 10,947 |
24 | // Errors | error InvalidPrice();
error LatestPriceMismatch();
error PricesAlreadyMatch();
error PriceIdDoesNotExist();
| error InvalidPrice();
error LatestPriceMismatch();
error PricesAlreadyMatch();
error PriceIdDoesNotExist();
| 32,784 |
9 | // Updates the address of the rewards controller Only callable by the owner of the EmissionManager controller the address of the RewardsController contract / | function setRewardsController(address controller) external;
| function setRewardsController(address controller) external;
| 28,882 |
41 | // openBox.request open box according to '_requestId', only lottery role. / | function openBox(address _address) public {
require(hasRole(_msgSender()), "JoysLottery: have no privilege.");
uint256 len = requestCount(_address);
require(len > 0, "JoysLottery: have no box.");
uint256 idx = len - 1;
RequestInfo storage req = reqBox[_address][idx];
uint32 _requestId = req.reqID;
require(requestState(_address, _requestId) == BoxState.CanOpen, "JoysLottery: invalid request state.");
uint32 a;
uint32 b;
uint256 c;
Operation _op = req.operation;
if (_op == Operation.notFreeDrawHero) {
(a, b, c) = drawHero(_address, _requestId);
} else if (_op == Operation.notFreeDrawWeapon) {
(a, b, c) = drawWeapon(_address, _requestId);
} else {
require(false, "JoysLottery: invalid operation.");
}
// update request box
reqBox[_address][idx].a = a;
reqBox[_address][idx].b = b;
reqBox[_address][idx].c = c;
reqBox[_address][idx].timestamp = block.timestamp;
reqBox[_address][idx].state = BoxState.Opened;
}
| function openBox(address _address) public {
require(hasRole(_msgSender()), "JoysLottery: have no privilege.");
uint256 len = requestCount(_address);
require(len > 0, "JoysLottery: have no box.");
uint256 idx = len - 1;
RequestInfo storage req = reqBox[_address][idx];
uint32 _requestId = req.reqID;
require(requestState(_address, _requestId) == BoxState.CanOpen, "JoysLottery: invalid request state.");
uint32 a;
uint32 b;
uint256 c;
Operation _op = req.operation;
if (_op == Operation.notFreeDrawHero) {
(a, b, c) = drawHero(_address, _requestId);
} else if (_op == Operation.notFreeDrawWeapon) {
(a, b, c) = drawWeapon(_address, _requestId);
} else {
require(false, "JoysLottery: invalid operation.");
}
// update request box
reqBox[_address][idx].a = a;
reqBox[_address][idx].b = b;
reqBox[_address][idx].c = c;
reqBox[_address][idx].timestamp = block.timestamp;
reqBox[_address][idx].state = BoxState.Opened;
}
| 6,519 |
37 | // Addresses of the main providers. | address[] public mainProviders;
| address[] public mainProviders;
| 50,033 |
31 | // PRIVATE GETTERS |
function _getWorth(
uint256 balance,
address account,
uint256 amount,
bool antiBots
)
private
view
returns (
|
function _getWorth(
uint256 balance,
address account,
uint256 amount,
bool antiBots
)
private
view
returns (
| 28,239 |
225 | // Converts stake weight (not to be mixed with the pool weight) to ILV reward value, applying the 10^12 division on weight_weight stake weight rewardPerWeight ILV reward per weightreturn reward value normalized to 10^12 / | function weightToReward(uint256 _weight, uint256 rewardPerWeight) public pure returns (uint256) {
// apply the formula and return
return (_weight * rewardPerWeight) / REWARD_PER_WEIGHT_MULTIPLIER;
}
| function weightToReward(uint256 _weight, uint256 rewardPerWeight) public pure returns (uint256) {
// apply the formula and return
return (_weight * rewardPerWeight) / REWARD_PER_WEIGHT_MULTIPLIER;
}
| 6,964 |
1 | // Encoding of field elements is: X[0]z + X[1] | struct G2Point {
uint[2] X;
uint[2] Y;
}
| struct G2Point {
uint[2] X;
uint[2] Y;
}
| 6,734 |
5 | // Uniswap redemption path | address[] memory path = new address[](2);
path[0] = _swapToken;
path[1] = wethAddress;
| address[] memory path = new address[](2);
path[0] = _swapToken;
path[1] = wethAddress;
| 30,163 |
43 | // Only owner function to apply minter address/The minter address will be applied after the delay period | function applyMinter() external onlyOwner {
require(pendingMinter != address(0) && block.timestamp >= delayMinter, "NIBBLE: Cannot apply minter");
isMinter[pendingMinter] = true;
minters.push(pendingMinter);
pendingMinter = address(0);
delayMinter = 0;
emit MinterApplied(minters[minters.length - 1]);
}
| function applyMinter() external onlyOwner {
require(pendingMinter != address(0) && block.timestamp >= delayMinter, "NIBBLE: Cannot apply minter");
isMinter[pendingMinter] = true;
minters.push(pendingMinter);
pendingMinter = address(0);
delayMinter = 0;
emit MinterApplied(minters[minters.length - 1]);
}
| 24,166 |
11 | // TODO: this should only be used by the LiquidityMiningV2 contract??/This function finishes the migration process disabling further withdrawals and claims/migration grace period should have started before this function is called. | function finishMigrationGracePeriod() external onlyAuthorized onlyBeforeMigrationGracePeriodFinished {
require(migrationGracePeriodState == MigrationGracePeriodStates.Started, "Migration hasn't started yet");
migrationGracePeriodState = MigrationGracePeriodStates.Finished;
}
| function finishMigrationGracePeriod() external onlyAuthorized onlyBeforeMigrationGracePeriodFinished {
require(migrationGracePeriodState == MigrationGracePeriodStates.Started, "Migration hasn't started yet");
migrationGracePeriodState = MigrationGracePeriodStates.Finished;
}
| 12,312 |
3 | // return eip-1167 code to write it to spawned contract runtime. | assembly {
return(add(0x20, runtimeCode), 45) // eip-1167 runtime code, length
}
| assembly {
return(add(0x20, runtimeCode), 45) // eip-1167 runtime code, length
}
| 1,985 |
25 | // dup free memory pointer | hex"82"
| hex"82"
| 45,245 |
23 | // Calculate sqrt (x) rounding down.Revert if x < 0.x signed 64.64-bit fixed point numberreturn signed 64.64-bit fixed point number / | function sqrt (int128 x) internal pure returns (int128) {
require (x >= 0);
return int128 (sqrtu (uint256 (x) << 64));
}
| function sqrt (int128 x) internal pure returns (int128) {
require (x >= 0);
return int128 (sqrtu (uint256 (x) << 64));
}
| 15,454 |
3 | // Sets a new Authorizer for the Vault. The caller must be allowed by the current Authorizer to do this. Emits an `AuthorizerChanged` event. / | function setAuthorizer(IAuthorizer newAuthorizer) external;
| function setAuthorizer(IAuthorizer newAuthorizer) external;
| 21,196 |
94 | // Writes {Tokens} | function finalise()
when_allocations_complete
public
{
tokens.finalise();
}
| function finalise()
when_allocations_complete
public
{
tokens.finalise();
}
| 33,085 |
91 | // Limit variables for bot protection | bool public limitsInEffect = true; //boolean used to turn limits on and off
uint256 private gasPriceLimit = 7 * 1 gwei;
mapping(address => uint256) private _holderLastTransferBlock; // for 1 tx per block
mapping(address => uint256) private _holderLastTransferTimestamp; // for sell cooldown timer
uint256 public launchblock;
uint256 public cooldowntimer = 60; //default cooldown 60s
bool public enabledPublicTrading;
mapping(address => bool) public whitelistForPublicTrade;
| bool public limitsInEffect = true; //boolean used to turn limits on and off
uint256 private gasPriceLimit = 7 * 1 gwei;
mapping(address => uint256) private _holderLastTransferBlock; // for 1 tx per block
mapping(address => uint256) private _holderLastTransferTimestamp; // for sell cooldown timer
uint256 public launchblock;
uint256 public cooldowntimer = 60; //default cooldown 60s
bool public enabledPublicTrading;
mapping(address => bool) public whitelistForPublicTrade;
| 15,615 |
127 | // Emergency withdraw for tokens left in contract / | function withdrawToken(address tokenAddress, uint256 amount) external onlyOwner {
if ( amount == 0 )
amount = IERC20(tokenAddress).balanceOf(address(this));
IERC20(tokenAddress).transfer(owner(), amount);
}
| function withdrawToken(address tokenAddress, uint256 amount) external onlyOwner {
if ( amount == 0 )
amount = IERC20(tokenAddress).balanceOf(address(this));
IERC20(tokenAddress).transfer(owner(), amount);
}
| 22,291 |
405 | // internal function to save on code size for the onlyActiveReserve modifier/ | function requireReserveActiveInternal(address _reserve) internal view {
require(core.getReserveIsActive(_reserve), "Action requires an active reserve");
}
| function requireReserveActiveInternal(address _reserve) internal view {
require(core.getReserveIsActive(_reserve), "Action requires an active reserve");
}
| 18,687 |
60 | // use token address TOMO_TOKEN_ADDRESS for tomo/makes a trade between src and dest token and send dest token to destAddress/src Src token/srcAmount amount of src tokens/dest Destination token/destAddress Address to send tokens to/maxDestAmount A limit on the amount of dest tokens/minConversionRate The minimal conversion rate. If actual rate is lower, trade is canceled./walletId is the wallet ID to send part of the fees/ return amount of actual dest tokens | function swap(
TRC20 src,
uint srcAmount,
TRC20 dest,
address destAddress,
uint maxDestAmount,
uint minConversionRate,
address walletId
)
public
| function swap(
TRC20 src,
uint srcAmount,
TRC20 dest,
address destAddress,
uint maxDestAmount,
uint minConversionRate,
address walletId
)
public
| 29,836 |
16 | // Verify that the new Balance is in expected state | require(
_balances[rewardClaim.accountKey] == rewardClaim.newBalance,
"Rewards: New Balance is not in Expected State"
);
| require(
_balances[rewardClaim.accountKey] == rewardClaim.newBalance,
"Rewards: New Balance is not in Expected State"
);
| 61,650 |
43 | // Lets a module admin restrict token transfers. | function setRestrictedTransfer(bool _restrictedTransfer) external onlyModuleAdmin {
transfersRestricted = _restrictedTransfer;
emit TransfersRestricted(_restrictedTransfer);
}
| function setRestrictedTransfer(bool _restrictedTransfer) external onlyModuleAdmin {
transfersRestricted = _restrictedTransfer;
emit TransfersRestricted(_restrictedTransfer);
}
| 9,548 |
488 | // The COMP borrow index for each market for each borrower as of the last time they accrued COMP/This storage is depreacted. | mapping(address => mapping(address => uint256)) public compBorrowerIndex;
| mapping(address => mapping(address => uint256)) public compBorrowerIndex;
| 31,973 |
2 | // Checking if both players have joined | bool isPlayerOneIn;
bool isPlayerTwoIn;
| bool isPlayerOneIn;
bool isPlayerTwoIn;
| 29,574 |
283 | // Setting presaleEnded state to true allows for minting beyond the presale token count/ | function setPresaleState() external onlyOwner {
presaleEnded = !presaleEnded;
}
| function setPresaleState() external onlyOwner {
presaleEnded = !presaleEnded;
}
| 57,271 |
22 | // Allows the current owner to change the asset manager to a newManager. newManager The address to change asset management to. / | function changeAssetManager(address payable newManager) external onlyOwner {
require(newManager != address(0), "newManager should not be address(0).");
emit AssetManagerChanged(_assetManager, newManager);
_assetManager = newManager;
}
| function changeAssetManager(address payable newManager) external onlyOwner {
require(newManager != address(0), "newManager should not be address(0).");
emit AssetManagerChanged(_assetManager, newManager);
_assetManager = newManager;
}
| 26,102 |
259 | // Gain czxp for sacrificing card | uint256 sacrificeCzxp = allCardTypes[Cards[_tokenId].cardTypeId].sacrificeCzxp;
awardCzxp(msg.sender,sacrificeCzxp);
| uint256 sacrificeCzxp = allCardTypes[Cards[_tokenId].cardTypeId].sacrificeCzxp;
awardCzxp(msg.sender,sacrificeCzxp);
| 1,763 |
21 | // sets the owner as the deployer (who deployed reputationToken and reputationController together) | owner = msg.sender;
| owner = msg.sender;
| 22,956 |
299 | // Validates seize and reverts on rejection. May emit logs. cTokenCollateral Asset which was used as collateral and will be seized cTokenBorrowed Asset which was borrowed by the borrower liquidator The address repaying the borrow and seizing the collateral borrower The address of the borrower seizeTokens The number of collateral tokens to seize / | function seizeVerify(
address cTokenCollateral,
address cTokenBorrowed,
address liquidator,
address borrower,
| function seizeVerify(
address cTokenCollateral,
address cTokenBorrowed,
address liquidator,
address borrower,
| 43,387 |
80 | // Gets the token ID at a given index of the tokens list of the requested owner. owner address owning the tokens list to be accessed index uint256 representing the index to be accessed of the requested tokens listreturn uint256 token ID at the given index of the tokens list owned by the requested address / | function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) {
require(index < balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
| function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) {
require(index < balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
| 15,213 |
44 | // Var to track the rewarder pool. | PoolInfo public poolInfo;
| PoolInfo public poolInfo;
| 61,668 |
104 | // Overrides the superclass implementation to handle custom logicsuch as taking fees, burning tokens, and supplying liquidity to PancakeSwap | function _transfer(
address from,
address to,
uint256 amount
| function _transfer(
address from,
address to,
uint256 amount
| 11,089 |
19 | // Create the contract._contractAddressLocator The contract address locator._description The voting description._startBlock The voting start block._endBlock The voting end block./ | constructor(IContractAddressLocator _contractAddressLocator, string _description, uint256 _startBlock, uint256 _endBlock) ContractAddressLocatorHolder(_contractAddressLocator) public
| constructor(IContractAddressLocator _contractAddressLocator, string _description, uint256 _startBlock, uint256 _endBlock) ContractAddressLocatorHolder(_contractAddressLocator) public
| 75,759 |
6 | // cash request info | address payable[] authorizedCashRecipients;
uint256 newCashRecipientId;
uint256 newCashRequestId;
| address payable[] authorizedCashRecipients;
uint256 newCashRecipientId;
uint256 newCashRequestId;
| 34,740 |
79 | // Cancels previously made sell offer. Caller has to be an owner of the canvas. Function will fail if there is no sell offer for the canvas./ | function cancelSellOffer(uint32 _canvasId) external {
cancelSellOfferInternal(_canvasId, true);
}
| function cancelSellOffer(uint32 _canvasId) external {
cancelSellOfferInternal(_canvasId, true);
}
| 4,652 |
34 | // TODO: CHECK IF A TABLE ALREADY EXISTS BEFORE CREATING ONE | contract SQLStorage {
bytes1 comma = 44;
bytes1 recordSeparator = 124;
// architecture
// columnsBundle a column is maximum 32 characters
// metadata
uint numberOfTables;
// table index -> table name
mapping(uint => string) tableNames;
// table name -> count
mapping(string => uint) columnCount;
// table name -> count
mapping(string => uint) rowCount;
// table name -> column index -> column name
mapping(string => mapping(uint => string)) columnNames;
// table name -> bool
mapping(string => bool) tableExists;
// table name -> column name -> bool
mapping(string => mapping(string => bool)) columnExists;
// tablename -> column name -> index
mapping(string => mapping(string => uint)) columnIndex;
// tablename -> column name -> index -> value
mapping(string => mapping(string => mapping(uint => string))) tables;
function SQLStorage()
public
{
}
function createTable(string tableName, string columns)
public
{
tableNames[numberOfTables] = tableName;
numberOfTables += 1;
bytes memory characters = bytes(columns);
uint charactersLen = characters.length;
uint j = 0;
for (uint i = 0; i < charactersLen; i += 1) {
if (characters[i] == comma) {
string memory columnName = substring(columns, j, i);
columnNames[tableName][columnCount[tableName]] = columnName;
columnIndex[tableName][columnName] = columnCount[tableName];
columnCount[tableName] += 1;
columnExists[tableName][columnName] = true;
j = i + 1;
}
}
rowCount[tableName] = 0;
tableExists[tableName] = true;
}
// values will be of the form: v1,v2,...,vn,\30
function insert(string tableName, uint numberOfColumns, string columns, string values)
public
{
bytes memory chars = bytes(columns);
uint charsLen = chars.length;
// get the columns that are getting updated
uint j = 0;
uint k = 0;
uint[] memory indexes = new uint[](numberOfColumns);
for (uint i = 0; i < charsLen; i += 1) {
if (chars[i] == comma) {
string memory columnName = substring(columns, j, i);
indexes[k] = columnIndex[tableName][columnName];
k += 1;
j = i + 1;
}
}
// update table value and row count
j = 0;
k = 0;
chars = bytes(values);
charsLen = chars.length;
for (i = 0; i < charsLen; i++) {
if (chars[i] == comma) {
string memory value = substring(values, j, i);
uint insertColumnIndex = indexes[k];
columnName = columnNames[tableName][insertColumnIndex];
uint rowIndex = rowCount[tableName];
tables[tableName][columnName][rowIndex] = value;
j = i + 1;
k += 1;
}
if (chars[i] == recordSeparator){
rowCount[tableName] += 1;
k = 0;
j += 1;
}
}
rowCount[tableName] += 1;
}
// returns one row at a time
function getSelect(string tableName, uint numberOfColumns, uint startRow, uint endRow, string columns)
public returns (string)
{
bytes memory chars = bytes(columns);
uint charsLen = chars.length;
// get the columns that are getting updated
uint j = 0;
uint k = 0;
uint[] memory indexes = new uint[](numberOfColumns);
for (uint i = 0; i < charsLen; i += 1) {
if (chars[i] == comma) {
string memory columnName = substring(columns, j, i);
indexes[k] = columnIndex[tableName][columnName];
k += 1;
j = i + 1;
}
}
// first count how large our row will be
k = 0;
for (i = 0; i < numberOfColumns; i++) {
j = indexes[i];
columnName = columnNames[tableName][j];
string memory value = tables[tableName][columnName][startRow];
k += bytes(value).length;
}
bytes memory row = new bytes(k + numberOfColumns);
k = 0;
for (i = 0; i < numberOfColumns; i++) {
j = indexes[i];
columnName = columnNames[tableName][j];
value = tables[tableName][columnName][startRow];
chars = bytes(value);
for (j = 0; j < chars.length; j++) {
row[k] = chars[j];
k += 1;
}
row[k] = ',';
k += 1;
}
return string(row);
}
function update(string tableName, uint numberOfColumns, uint rowIndex, string columns, string values)
public
{
bytes memory chars = bytes(columns);
uint charsLen = chars.length;
// get the columns that are getting updated
uint j = 0;
uint k = 0;
uint[] memory indexes = new uint[](numberOfColumns);
for (uint i = 0; i < charsLen; i += 1) {
if (chars[i] == comma) {
string memory columnName = substring(columns, j, i);
indexes[k] = columnIndex[tableName][columnName];
k += 1;
j = i + 1;
}
}
j = 0;
k = 0;
chars = bytes(values);
charsLen = chars.length;
for (i = 0; i < charsLen; i++) {
if (chars[i] == comma) {
string memory value = substring(values, j, i);
uint insertColumnIndex = indexes[k];
columnName = columnNames[tableName][insertColumnIndex];
tables[tableName][columnName][rowIndex] = value;
j = i + 1;
k += 1;
}
}
}
function getTableNumberCounter()
public returns (uint)
{
return numberOfTables;
}
function getTableName(uint tableIndex)
public returns (string)
{
return tableNames[tableIndex];
}
function getValue(string tableName, string column, uint rowNumber)
public returns (string)
{
return tables[tableName][column][rowNumber];
}
function getColumnName(string tableName, uint columnIndex)
public returns (string)
{
return columnNames[tableName][columnIndex];
}
function getTableExists()
public returns (bool)
{
return true;
}
function getRowCount(string tableName)
public returns (uint)
{
return rowCount[tableName];
}
// function copied from https://ethereum.stackexchange.com/questions/31457/substring-in-solidity
function substring(string str, uint startIndex, uint endIndex)
internal constant returns (string)
{
bytes memory strBytes = bytes(str);
bytes memory result = new bytes(endIndex - startIndex);
for (uint i = startIndex; i < endIndex; i++)
result[i - startIndex] = strBytes[i];
return string(result);
}
// function copied from http://cryptodir.blogspot.com/2016/03/solidity-concat-string.html
function strConcat(string _a, string _b, string _c, string _d, string _e) internal returns (string){
bytes memory _ba = bytes(_a);
bytes memory _bb = bytes(_b);
bytes memory _bc = bytes(_c);
bytes memory _bd = bytes(_d);
bytes memory _be = bytes(_e);
string memory abcde = new string(_ba.length + _bb.length + _bc.length + _bd.length + _be.length);
bytes memory babcde = bytes(abcde);
uint k = 0;
for (uint i = 0; i < _ba.length; i++) babcde[k++] = _ba[i];
for (i = 0; i < _bb.length; i++) babcde[k++] = _bb[i];
for (i = 0; i < _bc.length; i++) babcde[k++] = _bc[i];
for (i = 0; i < _bd.length; i++) babcde[k++] = _bd[i];
for (i = 0; i < _be.length; i++) babcde[k++] = _be[i];
return string(babcde);
}
function strConcat(string _a, string _b, string _c, string _d) internal returns (string) {
return strConcat(_a, _b, _c, _d, "");
}
function strConcat(string _a, string _b, string _c) internal returns (string) {
return strConcat(_a, _b, _c, "", "");
}
function strConcat(string _a, string _b) internal returns (string) {
return strConcat(_a, _b, "", "", "");
}
} | contract SQLStorage {
bytes1 comma = 44;
bytes1 recordSeparator = 124;
// architecture
// columnsBundle a column is maximum 32 characters
// metadata
uint numberOfTables;
// table index -> table name
mapping(uint => string) tableNames;
// table name -> count
mapping(string => uint) columnCount;
// table name -> count
mapping(string => uint) rowCount;
// table name -> column index -> column name
mapping(string => mapping(uint => string)) columnNames;
// table name -> bool
mapping(string => bool) tableExists;
// table name -> column name -> bool
mapping(string => mapping(string => bool)) columnExists;
// tablename -> column name -> index
mapping(string => mapping(string => uint)) columnIndex;
// tablename -> column name -> index -> value
mapping(string => mapping(string => mapping(uint => string))) tables;
function SQLStorage()
public
{
}
function createTable(string tableName, string columns)
public
{
tableNames[numberOfTables] = tableName;
numberOfTables += 1;
bytes memory characters = bytes(columns);
uint charactersLen = characters.length;
uint j = 0;
for (uint i = 0; i < charactersLen; i += 1) {
if (characters[i] == comma) {
string memory columnName = substring(columns, j, i);
columnNames[tableName][columnCount[tableName]] = columnName;
columnIndex[tableName][columnName] = columnCount[tableName];
columnCount[tableName] += 1;
columnExists[tableName][columnName] = true;
j = i + 1;
}
}
rowCount[tableName] = 0;
tableExists[tableName] = true;
}
// values will be of the form: v1,v2,...,vn,\30
function insert(string tableName, uint numberOfColumns, string columns, string values)
public
{
bytes memory chars = bytes(columns);
uint charsLen = chars.length;
// get the columns that are getting updated
uint j = 0;
uint k = 0;
uint[] memory indexes = new uint[](numberOfColumns);
for (uint i = 0; i < charsLen; i += 1) {
if (chars[i] == comma) {
string memory columnName = substring(columns, j, i);
indexes[k] = columnIndex[tableName][columnName];
k += 1;
j = i + 1;
}
}
// update table value and row count
j = 0;
k = 0;
chars = bytes(values);
charsLen = chars.length;
for (i = 0; i < charsLen; i++) {
if (chars[i] == comma) {
string memory value = substring(values, j, i);
uint insertColumnIndex = indexes[k];
columnName = columnNames[tableName][insertColumnIndex];
uint rowIndex = rowCount[tableName];
tables[tableName][columnName][rowIndex] = value;
j = i + 1;
k += 1;
}
if (chars[i] == recordSeparator){
rowCount[tableName] += 1;
k = 0;
j += 1;
}
}
rowCount[tableName] += 1;
}
// returns one row at a time
function getSelect(string tableName, uint numberOfColumns, uint startRow, uint endRow, string columns)
public returns (string)
{
bytes memory chars = bytes(columns);
uint charsLen = chars.length;
// get the columns that are getting updated
uint j = 0;
uint k = 0;
uint[] memory indexes = new uint[](numberOfColumns);
for (uint i = 0; i < charsLen; i += 1) {
if (chars[i] == comma) {
string memory columnName = substring(columns, j, i);
indexes[k] = columnIndex[tableName][columnName];
k += 1;
j = i + 1;
}
}
// first count how large our row will be
k = 0;
for (i = 0; i < numberOfColumns; i++) {
j = indexes[i];
columnName = columnNames[tableName][j];
string memory value = tables[tableName][columnName][startRow];
k += bytes(value).length;
}
bytes memory row = new bytes(k + numberOfColumns);
k = 0;
for (i = 0; i < numberOfColumns; i++) {
j = indexes[i];
columnName = columnNames[tableName][j];
value = tables[tableName][columnName][startRow];
chars = bytes(value);
for (j = 0; j < chars.length; j++) {
row[k] = chars[j];
k += 1;
}
row[k] = ',';
k += 1;
}
return string(row);
}
function update(string tableName, uint numberOfColumns, uint rowIndex, string columns, string values)
public
{
bytes memory chars = bytes(columns);
uint charsLen = chars.length;
// get the columns that are getting updated
uint j = 0;
uint k = 0;
uint[] memory indexes = new uint[](numberOfColumns);
for (uint i = 0; i < charsLen; i += 1) {
if (chars[i] == comma) {
string memory columnName = substring(columns, j, i);
indexes[k] = columnIndex[tableName][columnName];
k += 1;
j = i + 1;
}
}
j = 0;
k = 0;
chars = bytes(values);
charsLen = chars.length;
for (i = 0; i < charsLen; i++) {
if (chars[i] == comma) {
string memory value = substring(values, j, i);
uint insertColumnIndex = indexes[k];
columnName = columnNames[tableName][insertColumnIndex];
tables[tableName][columnName][rowIndex] = value;
j = i + 1;
k += 1;
}
}
}
function getTableNumberCounter()
public returns (uint)
{
return numberOfTables;
}
function getTableName(uint tableIndex)
public returns (string)
{
return tableNames[tableIndex];
}
function getValue(string tableName, string column, uint rowNumber)
public returns (string)
{
return tables[tableName][column][rowNumber];
}
function getColumnName(string tableName, uint columnIndex)
public returns (string)
{
return columnNames[tableName][columnIndex];
}
function getTableExists()
public returns (bool)
{
return true;
}
function getRowCount(string tableName)
public returns (uint)
{
return rowCount[tableName];
}
// function copied from https://ethereum.stackexchange.com/questions/31457/substring-in-solidity
function substring(string str, uint startIndex, uint endIndex)
internal constant returns (string)
{
bytes memory strBytes = bytes(str);
bytes memory result = new bytes(endIndex - startIndex);
for (uint i = startIndex; i < endIndex; i++)
result[i - startIndex] = strBytes[i];
return string(result);
}
// function copied from http://cryptodir.blogspot.com/2016/03/solidity-concat-string.html
function strConcat(string _a, string _b, string _c, string _d, string _e) internal returns (string){
bytes memory _ba = bytes(_a);
bytes memory _bb = bytes(_b);
bytes memory _bc = bytes(_c);
bytes memory _bd = bytes(_d);
bytes memory _be = bytes(_e);
string memory abcde = new string(_ba.length + _bb.length + _bc.length + _bd.length + _be.length);
bytes memory babcde = bytes(abcde);
uint k = 0;
for (uint i = 0; i < _ba.length; i++) babcde[k++] = _ba[i];
for (i = 0; i < _bb.length; i++) babcde[k++] = _bb[i];
for (i = 0; i < _bc.length; i++) babcde[k++] = _bc[i];
for (i = 0; i < _bd.length; i++) babcde[k++] = _bd[i];
for (i = 0; i < _be.length; i++) babcde[k++] = _be[i];
return string(babcde);
}
function strConcat(string _a, string _b, string _c, string _d) internal returns (string) {
return strConcat(_a, _b, _c, _d, "");
}
function strConcat(string _a, string _b, string _c) internal returns (string) {
return strConcat(_a, _b, _c, "", "");
}
function strConcat(string _a, string _b) internal returns (string) {
return strConcat(_a, _b, "", "", "");
}
} | 25,139 |
79 | // Raises an `Signed` to the power of an unscaled uint256, reverting on overflow. E.g., `b=2` squares `a`. This will "floor" the result. a a FixedPoint.Signed. b a uint256 (negative exponents are not allowed).return output is `a` to the power of `b`. / | function pow(Signed memory a, uint256 b) internal pure returns (Signed memory output) {
output = fromUnscaledInt(1);
for (uint256 i = 0; i < b; i = i.add(1)) {
output = mul(output, a);
}
}
| function pow(Signed memory a, uint256 b) internal pure returns (Signed memory output) {
output = fromUnscaledInt(1);
for (uint256 i = 0; i < b; i = i.add(1)) {
output = mul(output, a);
}
}
| 19,598 |
1 | // old steward has the buy function with only one parameter | function buy(uint256 _newPrice) external payable;
function price() external view returns (uint256); // mimics fetching the variable
| function buy(uint256 _newPrice) external payable;
function price() external view returns (uint256); // mimics fetching the variable
| 71,922 |
12 | // Recipient should match the sender | uint256 msgIdx = uint256(readBytes32(reqData, 4));
address recipient = address(readBytes32(reqData, 4 + msgIdx + 20));
require(recipient == relayRequest.request.from, "sender does not match recipient");
return (abi.encodePacked(relayRequest.request.from, maxPossibleGas, maxTokensFee), true);
| uint256 msgIdx = uint256(readBytes32(reqData, 4));
address recipient = address(readBytes32(reqData, 4 + msgIdx + 20));
require(recipient == relayRequest.request.from, "sender does not match recipient");
return (abi.encodePacked(relayRequest.request.from, maxPossibleGas, maxTokensFee), true);
| 18,349 |
19 | // (274 bytes) | function pickEye(uint8 seed) private pure returns (uint8) {
if (seed < 80) return 0;
if (seed < 144) return 1;
if (seed < 184) return 2;
if (seed < 224) return 3;
if (seed < 246) return 4;
if (seed < 254) return 5;
return 6;
}
| function pickEye(uint8 seed) private pure returns (uint8) {
if (seed < 80) return 0;
if (seed < 144) return 1;
if (seed < 184) return 2;
if (seed < 224) return 3;
if (seed < 246) return 4;
if (seed < 254) return 5;
return 6;
}
| 8,264 |
61 | // Set an account can perform some operations _newManager Manager addressreturn True if success / | function setManager(address _newManager) public onlyAdmin returns (bool) {
manager = _newManager;
emit NewManager(_newManager);
return true;
}
| function setManager(address _newManager) public onlyAdmin returns (bool) {
manager = _newManager;
emit NewManager(_newManager);
return true;
}
| 41,938 |
37 | // Constant used to specify the highest gas price available in the gelato system/Input 0 as gasPriceCeil and it will be assigned to NO_CEIL/ return MAX_UINT | function NO_CEIL() external pure returns(uint256);
| function NO_CEIL() external pure returns(uint256);
| 11,639 |
1 | // helper contract for EntryPoint, to call userOp.initCode from a "neutral" address,which is explicitly not the entryPoint itself. / | contract SenderCreator {
/**
* call the "initCode" factory to create and return the sender account address
* @param initCode the initCode value from a UserOp. contains 20 bytes of factory address, followed by calldata
* @return sender the returned address of the created account, or zero address on failure.
*/
function createSender(bytes calldata initCode) external returns (address sender) {
address factory = address(bytes20(initCode[0 : 20]));
bytes memory initCallData = initCode[20 :];
bool success;
/* solhint-disable no-inline-assembly */
assembly {
success := call(gas(), factory, 0, add(initCallData, 0x20), mload(initCallData), 0, 32)
sender := mload(0)
}
if (!success) {
sender = address(0);
}
}
} | contract SenderCreator {
/**
* call the "initCode" factory to create and return the sender account address
* @param initCode the initCode value from a UserOp. contains 20 bytes of factory address, followed by calldata
* @return sender the returned address of the created account, or zero address on failure.
*/
function createSender(bytes calldata initCode) external returns (address sender) {
address factory = address(bytes20(initCode[0 : 20]));
bytes memory initCallData = initCode[20 :];
bool success;
/* solhint-disable no-inline-assembly */
assembly {
success := call(gas(), factory, 0, add(initCallData, 0x20), mload(initCallData), 0, 32)
sender := mload(0)
}
if (!success) {
sender = address(0);
}
}
} | 23,545 |
40 | // Returns the current implementation.return impl Address of the current implementation / | function _implementation() internal override view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
| function _implementation() internal override view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
| 22,740 |
10 | // defining Structure of the Policy | struct Policy
| struct Policy
| 49,244 |
24 | // check if token is in shell. If it is in the shell, return the index. If not, revert | bool isIn;
for (uint8 i = 0; i < 5; i++) {
if (_shells[tokenId].tokenList[i] == addy) {
isIn = true;
} else {
| bool isIn;
for (uint8 i = 0; i < 5; i++) {
if (_shells[tokenId].tokenList[i] == addy) {
isIn = true;
} else {
| 6,091 |
106 | // safeApprove should only be called when setting an initial allowance, or when resetting it to zero. To increase and decrease it, use 'safeIncreaseAllowance' and 'safeDecreaseAllowance' solhint-disable-next-line max-line-length |
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
|
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
| 433 |
492 | // isApprovedForAll(): returns true if _operator is anoperator for _owner | function isApprovedForAll(address _owner, address _operator)
public
view
returns (bool result)
| function isApprovedForAll(address _owner, address _operator)
public
view
returns (bool result)
| 39,283 |
239 | // Interest Module Interface//Paladin | interface InterestInterface {
function getSupplyRate(address palPool, uint cash, uint borrows, uint reserves, uint reserveFactor) external view returns(uint);
function getBorrowRate(address palPool, uint cash, uint borrows, uint reserves) external view returns(uint);
}
| interface InterestInterface {
function getSupplyRate(address palPool, uint cash, uint borrows, uint reserves, uint reserveFactor) external view returns(uint);
function getBorrowRate(address palPool, uint cash, uint borrows, uint reserves) external view returns(uint);
}
| 14,916 |
54 | // get current active loans in the system/start of the index/count number of loans to return/unsafeOnly boolean if true return unsafe loan only (open for liquidation) | function getActiveLoans(
uint256 start,
uint256 count,
bool unsafeOnly
) external view returns (LoanReturnData[] memory loansData);
| function getActiveLoans(
uint256 start,
uint256 count,
bool unsafeOnly
) external view returns (LoanReturnData[] memory loansData);
| 5,453 |
7 | // point | pairWinners[i][2] = prefs[i][2];
| pairWinners[i][2] = prefs[i][2];
| 45,952 |
36 | // Claims rewards from the Balancer's fee distributor contract and transfers the tokens into the rewards contract | function earmarkFees() external;
function isShutdown() external view returns (bool);
function poolInfo(uint256)
external
view
returns (
address,
address,
| function earmarkFees() external;
function isShutdown() external view returns (bool);
function poolInfo(uint256)
external
view
returns (
address,
address,
| 27,331 |
19 | // gas fiddling | switch success case 0 {
revert(0, 0)
}
| switch success case 0 {
revert(0, 0)
}
| 13,238 |
37 | // Public swap ETH->DRVS | function swap_for_drvs(uint256 amountIn) public returns(uint256 amountOut) {
amountOut = swapExactInputSingle(amountIn);
}
| function swap_for_drvs(uint256 amountIn) public returns(uint256 amountOut) {
amountOut = swapExactInputSingle(amountIn);
}
| 36,512 |
39 | // storage and mapping of all balances & allowances | mapping (address => Account) accounts;
| mapping (address => Account) accounts;
| 31,284 |
2 | // read elements | balances[msg.sender];
| balances[msg.sender];
| 49,402 |
2 | // Update the number of feathers claimed for the sender address | whitelist[msg.sender] = whitelist[msg.sender] - numberOfTokens;
for (uint256 i = 0; i < numberOfTokens; i++) {
_safeMint(msg.sender, _nextTokenId.current());
_nextTokenId.increment();
}
| whitelist[msg.sender] = whitelist[msg.sender] - numberOfTokens;
for (uint256 i = 0; i < numberOfTokens; i++) {
_safeMint(msg.sender, _nextTokenId.current());
_nextTokenId.increment();
}
| 32,059 |
5 | // Used to ensure that the function it is applied to cannot be reentered. Prevents a contract from calling itself, directly or indirectly.Calling a `nonReentrant` function from another `nonReentrant`function is not supported. It is possible to prevent this from happeningby making the `nonReentrant` function external, and making it call a`private` function that does the actual work. / | modifier nonReentrant() {
_nonReentrantIn();
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
| modifier nonReentrant() {
_nonReentrantIn();
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
| 12,889 |
262 | // function to calculate the interest using a compounded interest rate formula _rate the interest rate, in ray _lastUpdateTimestamp the timestamp of the last update of the interestreturn the interest rate compounded during the timeDelta, in ray / | ) internal view returns (uint256) {
//solium-disable-next-line
uint256 timeDifference = block.timestamp.sub(
uint256(_lastUpdateTimestamp)
);
uint256 ratePerSecond = _rate.div(SECONDS_PER_YEAR);
return ratePerSecond.add(WadRayMath.ray()).rayPow(timeDifference);
}
| ) internal view returns (uint256) {
//solium-disable-next-line
uint256 timeDifference = block.timestamp.sub(
uint256(_lastUpdateTimestamp)
);
uint256 ratePerSecond = _rate.div(SECONDS_PER_YEAR);
return ratePerSecond.add(WadRayMath.ray()).rayPow(timeDifference);
}
| 17,421 |
1 | // PUBLIC VARIABLES |
gamblerarray[] public gamblerlist;
uint public Gamblers_Until_Jackpot=0;
uint public Total_Gamblers=0;
uint public FeeRate=7;
uint public Bankroll = 0;
uint public Jackpot = 0;
uint public Total_Deposits=0;
uint public Total_Payouts=0;
uint public MinDeposit=100 finney;
|
gamblerarray[] public gamblerlist;
uint public Gamblers_Until_Jackpot=0;
uint public Total_Gamblers=0;
uint public FeeRate=7;
uint public Bankroll = 0;
uint public Jackpot = 0;
uint public Total_Deposits=0;
uint public Total_Payouts=0;
uint public MinDeposit=100 finney;
| 9,030 |
8 | // KiCollectable Kick Ass Collectable (KCB), Base on Openzeppelin ERC721 contract. / | contract KiCollectable is ERC721, ERC721Enumerable, ERC721URIStorage, Ownable {
using Counters for Counters.Counter;
// Trade index number counter
Counters.Counter private _tokenIdCounter;
constructor() ERC721("KiCollectable", "KCB") {}
function _baseURI() internal pure override returns (string memory) {
return "https://ipfs.io/ipfs/";
}
/**
* @dev Returns the total count of all trades.
*/
function mintToken(address to, string memory uri) public returns (uint256) {
uint256 tokenId = _tokenIdCounter.current();
_tokenIdCounter.increment();
_setTokenURI(tokenId, uri);
_safeMint(to, tokenId);
return tokenId;
}
// The following functions are overrides required by Solidity.
function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal
override(ERC721, ERC721Enumerable)
{
super._beforeTokenTransfer(from, to, tokenId);
}
function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage) {
super._burn(tokenId);
}
function tokenURI(uint256 tokenId)
public
view
override(ERC721, ERC721URIStorage)
returns (string memory)
{
return super.tokenURI(tokenId);
}
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721, ERC721Enumerable)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
} | contract KiCollectable is ERC721, ERC721Enumerable, ERC721URIStorage, Ownable {
using Counters for Counters.Counter;
// Trade index number counter
Counters.Counter private _tokenIdCounter;
constructor() ERC721("KiCollectable", "KCB") {}
function _baseURI() internal pure override returns (string memory) {
return "https://ipfs.io/ipfs/";
}
/**
* @dev Returns the total count of all trades.
*/
function mintToken(address to, string memory uri) public returns (uint256) {
uint256 tokenId = _tokenIdCounter.current();
_tokenIdCounter.increment();
_setTokenURI(tokenId, uri);
_safeMint(to, tokenId);
return tokenId;
}
// The following functions are overrides required by Solidity.
function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal
override(ERC721, ERC721Enumerable)
{
super._beforeTokenTransfer(from, to, tokenId);
}
function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage) {
super._burn(tokenId);
}
function tokenURI(uint256 tokenId)
public
view
override(ERC721, ERC721URIStorage)
returns (string memory)
{
return super.tokenURI(tokenId);
}
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721, ERC721Enumerable)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
} | 40,206 |
12 | // bytes32 public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH = keccak256("TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)"); | bytes32 public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH = 0x7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a2267;
string public constant name = "Flash Token";
string public constant symbol = "FLASH";
uint8 public constant decimals = 18;
uint256 public override totalSupply;
uint256 public flashSupply;
mapping(address => bool) public minters;
| bytes32 public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH = 0x7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a2267;
string public constant name = "Flash Token";
string public constant symbol = "FLASH";
uint8 public constant decimals = 18;
uint256 public override totalSupply;
uint256 public flashSupply;
mapping(address => bool) public minters;
| 19,618 |
283 | // Owner can set price oracle address/_priceOracle Router address to add | function setPriceOracle(address _priceOracle) external onlyOwner whenNotPaused {
priceOracle = IPriceOracle(_priceOracle);
// Emit event
emit NewPriceOracle(_priceOracle);
}
| function setPriceOracle(address _priceOracle) external onlyOwner whenNotPaused {
priceOracle = IPriceOracle(_priceOracle);
// Emit event
emit NewPriceOracle(_priceOracle);
}
| 37,159 |
34 | // require(ownerPlanetCount[msg.sender] == 0); Reinstall this line during the game | uint256 randDna = _generateRandomDna(_name);
| uint256 randDna = _generateRandomDna(_name);
| 15,228 |
25 | // Creates a new token type and assigns _initialSupply to an address _maxSupply max supply allowed _initialSupply Optional amount to supply the first owner _uri Optional URI for this token type _data Optional data to pass if receiver is contractreturn _id The newly created token ID / | function create(
uint256 _initialSupply,
uint256 _maxSupply,
string calldata _uri,
bytes calldata _data,
string calldata _ipfs
| function create(
uint256 _initialSupply,
uint256 _maxSupply,
string calldata _uri,
bytes calldata _data,
string calldata _ipfs
| 55,720 |
130 | // Security mechanism which anyone can enable if the total supply of PRPS or DUBI should ever go >= 1 billion | bool private _killSwitchOn;
| bool private _killSwitchOn;
| 57,029 |
281 | // Remove the `_rnid` from the owner | _removeRoomNight(dataSource.roomNightIndexToOwner(_rnid), _rnid);
| _removeRoomNight(dataSource.roomNightIndexToOwner(_rnid), _rnid);
| 14,559 |
76 | // Allows the owner to set the starting time. _start the new _start / | function setStart(uint _start) public onlyOwner {
start = _start;
}
| function setStart(uint _start) public onlyOwner {
start = _start;
}
| 30,274 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.