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 |
|---|---|---|---|---|
93 | // Decreases totalSupply and the corresponding amount of the specified partition of tokenHolder This function can only be called by the authorised operator. _partition The partition to allocate the decrease in balance. _tokenHolder The token holder whose balance should be decreased _value The amount by which to decrease the balance _data Additional data attached to the burning of tokens _operatorData Additional data attached to the transfer of tokens by the operator / | function operatorRedeemByPartition(
| function operatorRedeemByPartition(
| 47,803 |
6 | // endBlock = startBlock + 40320;roughly 40,000 blocks per week | endBlock = startBlock + 3; // for testing purposes only 3 blocks used
ipfsHash = ""; // initiate as empty string
bidIncrement = 1 ether; // denominated in ether for testing
| endBlock = startBlock + 3; // for testing purposes only 3 blocks used
ipfsHash = ""; // initiate as empty string
bidIncrement = 1 ether; // denominated in ether for testing
| 21,303 |
115 | // add digit to the result | i += digit;
| i += digit;
| 35,219 |
223 | // Alternate implementationAssumes there are no duplicates / | function unionB(address[] memory A, address[] memory B) internal pure returns (address[] memory) {
bool[] memory includeMap = new bool[](A.length + B.length);
uint256 count = 0;
for (uint256 i = 0; i < A.length; i++) {
includeMap[i] = true;
count++;
}
for (uint256 j = 0; j < B.length; j++) {
if (!contains(A, B[j])) {
includeMap[A.length + j] = true;
count++;
}
}
address[] memory newAddresses = new address[](count);
uint256 k = 0;
for (uint256 m = 0; m < A.length; m++) {
if (includeMap[m]) {
newAddresses[k] = A[m];
k++;
}
}
for (uint256 n = 0; n < B.length; n++) {
if (includeMap[A.length + n]) {
newAddresses[k] = B[n];
k++;
}
}
return newAddresses;
}
| function unionB(address[] memory A, address[] memory B) internal pure returns (address[] memory) {
bool[] memory includeMap = new bool[](A.length + B.length);
uint256 count = 0;
for (uint256 i = 0; i < A.length; i++) {
includeMap[i] = true;
count++;
}
for (uint256 j = 0; j < B.length; j++) {
if (!contains(A, B[j])) {
includeMap[A.length + j] = true;
count++;
}
}
address[] memory newAddresses = new address[](count);
uint256 k = 0;
for (uint256 m = 0; m < A.length; m++) {
if (includeMap[m]) {
newAddresses[k] = A[m];
k++;
}
}
for (uint256 n = 0; n < B.length; n++) {
if (includeMap[A.length + n]) {
newAddresses[k] = B[n];
k++;
}
}
return newAddresses;
}
| 17,425 |
122 | // Delete ad | delete ads[_id];
| delete ads[_id];
| 1,596 |
29 | // set interface main contract | setMiningWarInterface(0x1b002cd1ba79dfad65e8abfbb3a97826e4960fe5);
| setMiningWarInterface(0x1b002cd1ba79dfad65e8abfbb3a97826e4960fe5);
| 66,764 |
78 | // Interface constant for ERC721, to check values in constructor. | bytes4 private constant ERC721_INTERFACE_ID = 0x80ac58cd;
| bytes4 private constant ERC721_INTERFACE_ID = 0x80ac58cd;
| 61,174 |
18 | // return idToNFTItem.getMyItems(_itemsSold); | uint40 totalItemCount = _itemsSold;
uint40 itemCount = 0;
for (uint40 i = 0; i < totalItemCount; i++) {
if (idToNFTItem[i + 1].owner == msg.sender) { itemCount += 1; }
| uint40 totalItemCount = _itemsSold;
uint40 itemCount = 0;
for (uint40 i = 0; i < totalItemCount; i++) {
if (idToNFTItem[i + 1].owner == msg.sender) { itemCount += 1; }
| 26,202 |
82 | // Return All Details about a Influencer Agreement / | function getAgreementDetails() public view returns(address, address, uint256, uint256, uint256, InfluencerAgreementFactory.InfluencerAgreementStatus,
| function getAgreementDetails() public view returns(address, address, uint256, uint256, uint256, InfluencerAgreementFactory.InfluencerAgreementStatus,
| 7,930 |
27 | // check if msg.sender is valid customer | (address customer, uint256 fee, uint256 profit, uint256 timestamp) =
productStorage.getEscrowData(productId, purchaseId);
require(msg.sender == customer);
| (address customer, uint256 fee, uint256 profit, uint256 timestamp) =
productStorage.getEscrowData(productId, purchaseId);
require(msg.sender == customer);
| 855 |
15 | // Biswap NFT Launchpad Pre-market sell Biswap NFT tokens. / | contract LaunchpadNftRandom is ReentrancyGuard, Ownable, Pausable {
using SafeERC20 for IERC20;
IBiswapNFT biswapNFT;
address public treasuryAddress;
IERC20 public immutable dealToken;
struct Launchpad {
uint price;
uint robiBoost;
uint32 totalCount;
uint32 soldCount;
uint32 level;
uint32 maxToUser;
}
struct Brackets {
uint32 count;
uint128 robiBoost;
}
Launchpad[] public launches;
Brackets[6] public brackets;
mapping(address => mapping(uint => uint)) public boughtCount; //Bought NFT`s by user: address => launches => tickets count
event LaunchpadExecuted(address indexed user, uint launchIndex, uint robiboost);
/**
* @notice Constructor
* @dev In constructor initialise launches
* @param _biswapNFT: Biswap NFT interface
* @param _dealToken: deal token address
* @param _treasuryAddress: treasury address
*/
constructor(IBiswapNFT _biswapNFT, IERC20 _dealToken, address _treasuryAddress) {
biswapNFT = _biswapNFT;
dealToken = _dealToken;
treasuryAddress = _treasuryAddress;
launches.push(
Launchpad({
totalCount : 30000,
soldCount : 0,
price : 20 ether,
level : 1,
robiBoost : 0,
maxToUser : 6
})
);
brackets[0].count = 1500;
brackets[0].robiBoost = 10 ether;
brackets[1].count = 2100;
brackets[1].robiBoost = 5 ether;
brackets[2].count = 2400;
brackets[2].robiBoost = 9 ether;
brackets[3].count = 3000;
brackets[3].robiBoost = 6 ether;
brackets[4].count = 9000;
brackets[4].robiBoost = 8 ether;
brackets[5].count = 12000;
brackets[5].robiBoost = 7 ether;
}
/**
* @notice Checks if the msg.sender is a contract or a proxy
*/
modifier notContract() {
require(!_isContract(msg.sender), "contract not allowed");
require(msg.sender == tx.origin, "proxy contract not allowed");
_;
}
/**
* @notice Generate random between min and max brackets value. Then find RB value
*/
function getRandomResultRb() private returns(uint) {
Brackets[6] memory _brackets = brackets;
Launchpad memory _launch = launches[0];
uint min = 1;
uint max = _launch.totalCount - _launch.soldCount;
uint diff = (max - min) + 1;
uint random = uint(keccak256(abi.encodePacked(blockhash(block.number - 1), gasleft(), _launch.soldCount))) % diff + min;
uint rb = 0;
uint count = 0;
for(uint i = 0; i < _brackets.length; i++){
count += _brackets[i].count;
if(random <= count){
brackets[i].count -= 1;
rb = _brackets[i].robiBoost;
break;
}
}
require(rb > 0, "Wrong rb amount");
return(rb);
}
/**
* @notice Set treasury address to accumulate deal tokens from sells
* @dev Callable by contract owner
* @param _treasuryAddress: Treasury address
*/
function setTreasuryAddress(address _treasuryAddress) public onlyOwner {
treasuryAddress = _treasuryAddress;
}
/**
* @notice Add new launchpad
* @dev Callable by contract owner
* @param _totalCount: number of NFT tokens for sale in current launchpad
* @param _price: price in deal token for 1 NFT from launchpad
* @param _level: NFT token level
* @param _robiBoost: NFT token Robi Boost
* @param _maxToUser: max NFT tokens limit for sale to one user
*/
function addNewLaunch(uint32 _totalCount, uint _price, uint32 _level, uint _robiBoost, uint32 _maxToUser) public onlyOwner {
require(_totalCount > 0, "count must be greater than zero");
require(_maxToUser > 0, "");
require(_level < 7, "Incorrect level");
launches.push(
Launchpad({
totalCount : _totalCount,
soldCount : 0,
price : _price,
level : _level,
robiBoost : _robiBoost,
maxToUser : _maxToUser
})
);
}
/**
* @notice Get how many tokens left to sell from launch
* @dev Callable by users
* @param _index: Index of launch
* @return number of tokens left to sell from launch
*/
function leftToSell(uint _index) public view returns (uint){
require(_index <= launches.length, "Wrong index");
return launches[_index].totalCount - launches[_index].soldCount;
}
/**
* @notice Buy Biswap NFT token from launch
* @dev Callable by user
* @param _launchIndex: Index of launch
*/
function buyNFT(uint _launchIndex) public nonReentrant whenNotPaused notContract {
require(_launchIndex < launches.length, "Wrong launchpad number");
Launchpad storage _launch = launches[_launchIndex];
require(checkLimits(msg.sender, _launchIndex), "limit exceeding");
boughtCount[msg.sender][_launchIndex] += 1;
uint rb = getRandomResultRb();
_launch.soldCount += 1;
dealToken.safeTransferFrom(msg.sender, treasuryAddress, _launch.price);
biswapNFT.launchpadMint(msg.sender, _launch.level, rb);
emit LaunchpadExecuted(msg.sender, _launchIndex, rb);
}
/*
* @notice Pause a contract
* @dev Callable by contract owner
*/
function pause() public onlyOwner {
_pause();
}
/*
* @notice Unpause a contract
* @dev Callable by contract owner
*/
function unpause() public onlyOwner {
_unpause();
}
/* @notice Check limits left by user by launch
* @param user: user address
* @param launchIndex: index of launchpad
*/
function checkLimits(address user, uint launchIndex) internal view returns (bool){
Launchpad memory launch = launches[launchIndex];
return boughtCount[user][launchIndex] < launch.maxToUser &&
launch.soldCount < launch.totalCount;
}
/**
* @notice Checks if address is a contract
* @dev It prevents contract from being targetted
*/
function _isContract(address addr) internal view returns (bool) {
uint256 size;
assembly {
size := extcodesize(addr)
}
return size > 0;
}
}
| contract LaunchpadNftRandom is ReentrancyGuard, Ownable, Pausable {
using SafeERC20 for IERC20;
IBiswapNFT biswapNFT;
address public treasuryAddress;
IERC20 public immutable dealToken;
struct Launchpad {
uint price;
uint robiBoost;
uint32 totalCount;
uint32 soldCount;
uint32 level;
uint32 maxToUser;
}
struct Brackets {
uint32 count;
uint128 robiBoost;
}
Launchpad[] public launches;
Brackets[6] public brackets;
mapping(address => mapping(uint => uint)) public boughtCount; //Bought NFT`s by user: address => launches => tickets count
event LaunchpadExecuted(address indexed user, uint launchIndex, uint robiboost);
/**
* @notice Constructor
* @dev In constructor initialise launches
* @param _biswapNFT: Biswap NFT interface
* @param _dealToken: deal token address
* @param _treasuryAddress: treasury address
*/
constructor(IBiswapNFT _biswapNFT, IERC20 _dealToken, address _treasuryAddress) {
biswapNFT = _biswapNFT;
dealToken = _dealToken;
treasuryAddress = _treasuryAddress;
launches.push(
Launchpad({
totalCount : 30000,
soldCount : 0,
price : 20 ether,
level : 1,
robiBoost : 0,
maxToUser : 6
})
);
brackets[0].count = 1500;
brackets[0].robiBoost = 10 ether;
brackets[1].count = 2100;
brackets[1].robiBoost = 5 ether;
brackets[2].count = 2400;
brackets[2].robiBoost = 9 ether;
brackets[3].count = 3000;
brackets[3].robiBoost = 6 ether;
brackets[4].count = 9000;
brackets[4].robiBoost = 8 ether;
brackets[5].count = 12000;
brackets[5].robiBoost = 7 ether;
}
/**
* @notice Checks if the msg.sender is a contract or a proxy
*/
modifier notContract() {
require(!_isContract(msg.sender), "contract not allowed");
require(msg.sender == tx.origin, "proxy contract not allowed");
_;
}
/**
* @notice Generate random between min and max brackets value. Then find RB value
*/
function getRandomResultRb() private returns(uint) {
Brackets[6] memory _brackets = brackets;
Launchpad memory _launch = launches[0];
uint min = 1;
uint max = _launch.totalCount - _launch.soldCount;
uint diff = (max - min) + 1;
uint random = uint(keccak256(abi.encodePacked(blockhash(block.number - 1), gasleft(), _launch.soldCount))) % diff + min;
uint rb = 0;
uint count = 0;
for(uint i = 0; i < _brackets.length; i++){
count += _brackets[i].count;
if(random <= count){
brackets[i].count -= 1;
rb = _brackets[i].robiBoost;
break;
}
}
require(rb > 0, "Wrong rb amount");
return(rb);
}
/**
* @notice Set treasury address to accumulate deal tokens from sells
* @dev Callable by contract owner
* @param _treasuryAddress: Treasury address
*/
function setTreasuryAddress(address _treasuryAddress) public onlyOwner {
treasuryAddress = _treasuryAddress;
}
/**
* @notice Add new launchpad
* @dev Callable by contract owner
* @param _totalCount: number of NFT tokens for sale in current launchpad
* @param _price: price in deal token for 1 NFT from launchpad
* @param _level: NFT token level
* @param _robiBoost: NFT token Robi Boost
* @param _maxToUser: max NFT tokens limit for sale to one user
*/
function addNewLaunch(uint32 _totalCount, uint _price, uint32 _level, uint _robiBoost, uint32 _maxToUser) public onlyOwner {
require(_totalCount > 0, "count must be greater than zero");
require(_maxToUser > 0, "");
require(_level < 7, "Incorrect level");
launches.push(
Launchpad({
totalCount : _totalCount,
soldCount : 0,
price : _price,
level : _level,
robiBoost : _robiBoost,
maxToUser : _maxToUser
})
);
}
/**
* @notice Get how many tokens left to sell from launch
* @dev Callable by users
* @param _index: Index of launch
* @return number of tokens left to sell from launch
*/
function leftToSell(uint _index) public view returns (uint){
require(_index <= launches.length, "Wrong index");
return launches[_index].totalCount - launches[_index].soldCount;
}
/**
* @notice Buy Biswap NFT token from launch
* @dev Callable by user
* @param _launchIndex: Index of launch
*/
function buyNFT(uint _launchIndex) public nonReentrant whenNotPaused notContract {
require(_launchIndex < launches.length, "Wrong launchpad number");
Launchpad storage _launch = launches[_launchIndex];
require(checkLimits(msg.sender, _launchIndex), "limit exceeding");
boughtCount[msg.sender][_launchIndex] += 1;
uint rb = getRandomResultRb();
_launch.soldCount += 1;
dealToken.safeTransferFrom(msg.sender, treasuryAddress, _launch.price);
biswapNFT.launchpadMint(msg.sender, _launch.level, rb);
emit LaunchpadExecuted(msg.sender, _launchIndex, rb);
}
/*
* @notice Pause a contract
* @dev Callable by contract owner
*/
function pause() public onlyOwner {
_pause();
}
/*
* @notice Unpause a contract
* @dev Callable by contract owner
*/
function unpause() public onlyOwner {
_unpause();
}
/* @notice Check limits left by user by launch
* @param user: user address
* @param launchIndex: index of launchpad
*/
function checkLimits(address user, uint launchIndex) internal view returns (bool){
Launchpad memory launch = launches[launchIndex];
return boughtCount[user][launchIndex] < launch.maxToUser &&
launch.soldCount < launch.totalCount;
}
/**
* @notice Checks if address is a contract
* @dev It prevents contract from being targetted
*/
function _isContract(address addr) internal view returns (bool) {
uint256 size;
assembly {
size := extcodesize(addr)
}
return size > 0;
}
}
| 27,063 |
14 | // iterate on all report variants we already have, limited by the oracle members maximum | while (i < _length && currentReportVariants[i].isDifferent(variant)) {
++i;
}
| while (i < _length && currentReportVariants[i].isDifferent(variant)) {
++i;
}
| 32,228 |
151 | // Get the number of DCU to be collected by the target address on the designated transaction pair lock/xtoken xtoken address (or CNode address)/cycle cycle/addr Target address/ return The number of DCU to be collected by the target address on the designated transaction lock | function earned(address xtoken, uint64 cycle, address addr) external view override returns (uint) {
// Load staking channel
StakeChannel storage channel = _channels[_getKey(xtoken, cycle)];
// Call _calcReward() to calculate new reward
uint newReward = _calcReward(channel);
// Load account
Account memory account = channel.accounts[addr];
uint balance = uint(account.balance);
// Load total amount of staked
uint totalStaked = uint(channel.totalStaked);
// Unit token dividend
uint rewardPerToken = _decodeFloat(channel.rewardPerToken);
if (totalStaked > 0) {
rewardPerToken += newReward * UI128 / totalStaked;
}
//? earned需要扣除已经领取的数量
uint e = (rewardPerToken - _getRewardCursor(account, channel)) * balance / UI128;
uint claimed = account.claimed;
if (e > claimed) {
return e - claimed;
}
return 0;
}
| function earned(address xtoken, uint64 cycle, address addr) external view override returns (uint) {
// Load staking channel
StakeChannel storage channel = _channels[_getKey(xtoken, cycle)];
// Call _calcReward() to calculate new reward
uint newReward = _calcReward(channel);
// Load account
Account memory account = channel.accounts[addr];
uint balance = uint(account.balance);
// Load total amount of staked
uint totalStaked = uint(channel.totalStaked);
// Unit token dividend
uint rewardPerToken = _decodeFloat(channel.rewardPerToken);
if (totalStaked > 0) {
rewardPerToken += newReward * UI128 / totalStaked;
}
//? earned需要扣除已经领取的数量
uint e = (rewardPerToken - _getRewardCursor(account, channel)) * balance / UI128;
uint claimed = account.claimed;
if (e > claimed) {
return e - claimed;
}
return 0;
}
| 55,910 |
158 | // Initialize the money market bController_ The address of the BController interestRateModel_ The address of the interest rate model initialExchangeRateMantissa_ The initial exchange rate, scaled by 1e18 name_ EIP-20 name of this token symbol_ EIP-20 symbol of this token decimals_ EIP-20 decimal precision of this token / | function initialize(BControllerInterface bController_,
InterestRateModel interestRateModel_,
uint initialExchangeRateMantissa_,
string memory name_,
string memory symbol_,
| function initialize(BControllerInterface bController_,
InterestRateModel interestRateModel_,
uint initialExchangeRateMantissa_,
string memory name_,
string memory symbol_,
| 46,849 |
5 | // _rate is the amount of tokens for 1 SVC_wallet the address collecting tokens_token the address of the token contract_svc the address of the svc token contract/ | constructor(uint256 _rate, address _wallet, address _token, address _svc, string memory _symbol) public {
require(_rate > 0, "rate is 0");
rate = _rate;
wallet = _wallet;
token = ERC20(_token);
svc = ERC20(_svc);
symbol = _symbol;
}
| constructor(uint256 _rate, address _wallet, address _token, address _svc, string memory _symbol) public {
require(_rate > 0, "rate is 0");
rate = _rate;
wallet = _wallet;
token = ERC20(_token);
svc = ERC20(_svc);
symbol = _symbol;
}
| 21,564 |
37 | // crowdsale aims to sell at least 100 000 LEONS | uint256 public constant crowdsaleTarget = 100000 * 10**18;
uint256 public constant margin = 1000 * 10**18;
| uint256 public constant crowdsaleTarget = 100000 * 10**18;
uint256 public constant margin = 1000 * 10**18;
| 14,561 |
669 | // Reads the uint192 at `rdPtr` in returndata. | function readUint192(
ReturndataPointer rdPtr
| function readUint192(
ReturndataPointer rdPtr
| 40,389 |
13 | // Otherwise, check his parent's membership in system context if account itself does not have the membership in given context, then having his parent in the system context grants him the privilege needed | else if (_isParentInGroup(_assignerId, LibAdmin._getSystemId(), assignerGroup)) {
ret = true;
}
| else if (_isParentInGroup(_assignerId, LibAdmin._getSystemId(), assignerGroup)) {
ret = true;
}
| 20,243 |
93 | // Multiplies two precise units, and then truncates by the full scale, rounding up the result x Left hand input to multiplication y Right hand input to multiplicationreturn Result after multiplying the two inputs and then dividing by the shared scale unit, rounded up to the closest base unit. / | function mulTruncateCeil(uint256 x, uint256 y)
internal
pure
returns (uint256)
| function mulTruncateCeil(uint256 x, uint256 y)
internal
pure
returns (uint256)
| 4,315 |
60 | // Pancake has to add hidden dummy pools in order to alter the emission, here we make it simple and transparent to all. | function updateEmissionRate(uint256 _zfaiPerBlock) public onlyOwner {
massUpdatePools();
emit EmissionRateUpdated(msg.sender, zfaiPerBlock, _zfaiPerBlock);
zfaiPerBlock = _zfaiPerBlock;
}
| function updateEmissionRate(uint256 _zfaiPerBlock) public onlyOwner {
massUpdatePools();
emit EmissionRateUpdated(msg.sender, zfaiPerBlock, _zfaiPerBlock);
zfaiPerBlock = _zfaiPerBlock;
}
| 37,303 |
10 | // OwnableInterface The Ownable contract has an owner address, and provides basic authorization controlfunctions, this simplifies the implementation of "user permissions". / | contract OwnableInterface {
/**
* @dev The getter for "owner" contract variable
*/
function getOwner() public constant returns (address);
/**
* @dev Throws if called by any account other than the current owner.
*/
modifier onlyOwner() {
require (msg.sender == getOwner());
_;
}
}
| contract OwnableInterface {
/**
* @dev The getter for "owner" contract variable
*/
function getOwner() public constant returns (address);
/**
* @dev Throws if called by any account other than the current owner.
*/
modifier onlyOwner() {
require (msg.sender == getOwner());
_;
}
}
| 14,679 |
2,810 | // 1406 | entry "unadzed" : ENG_ADJECTIVE
| entry "unadzed" : ENG_ADJECTIVE
| 18,018 |
123 | // Redeem related | mapping (address => uint256) public redeemFXSBalances;
mapping (address => mapping(uint256 => uint256)) public redeemCollateralBalances; // Address -> collateral index -> balance
uint256[] public unclaimedPoolCollateral; // collateral index -> balance
uint256 public unclaimedPoolFXS;
mapping (address => uint256) public lastRedeemed; // Collateral independent
uint256 public redemption_delay = 2; // Number of blocks to wait before being able to collectRedemption()
uint256 public redeem_price_threshold = 990000; // $0.99
uint256 public mint_price_threshold = 1010000; // $1.01
| mapping (address => uint256) public redeemFXSBalances;
mapping (address => mapping(uint256 => uint256)) public redeemCollateralBalances; // Address -> collateral index -> balance
uint256[] public unclaimedPoolCollateral; // collateral index -> balance
uint256 public unclaimedPoolFXS;
mapping (address => uint256) public lastRedeemed; // Collateral independent
uint256 public redemption_delay = 2; // Number of blocks to wait before being able to collectRedemption()
uint256 public redeem_price_threshold = 990000; // $0.99
uint256 public mint_price_threshold = 1010000; // $1.01
| 16,272 |
77 | // last interest index | uint interestIndex;
| uint interestIndex;
| 55,001 |
0 | // ================= STATE VARIABLES ================= / ========= Immutable Storage ========= | uint256 internal constant BASIS_POINTS = 10000;
| uint256 internal constant BASIS_POINTS = 10000;
| 294 |
33 | // ganache-cli -d 1st | address public ACCOUNT_A = 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266;
| address public ACCOUNT_A = 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266;
| 28,188 |
83 | // calculate time weighted stake | uint256 stakeUnits = currentAmount.mul(stakeDuration);
| uint256 stakeUnits = currentAmount.mul(stakeDuration);
| 28,478 |
10 | // purchase requirements knights | purchaseRequirements[7].tokens = [tokens[5]]; // 5 STG
purchaseRequirements[7].amounts = [250];
purchaseRequirements[8].tokens = [tokens[5]]; // 5 STG
purchaseRequirements[8].amounts = [5*(10**2)];
purchaseRequirements[9].tokens = [tokens[5]]; // 10 STG
purchaseRequirements[9].amounts = [10*(10**2)];
purchaseRequirements[10].tokens = [tokens[5]]; // 20 STG
purchaseRequirements[10].amounts = [20*(10**2)];
purchaseRequirements[11].tokens = [tokens[5]]; // 50 STG
purchaseRequirements[11].amounts = [50*(10**2)];
| purchaseRequirements[7].tokens = [tokens[5]]; // 5 STG
purchaseRequirements[7].amounts = [250];
purchaseRequirements[8].tokens = [tokens[5]]; // 5 STG
purchaseRequirements[8].amounts = [5*(10**2)];
purchaseRequirements[9].tokens = [tokens[5]]; // 10 STG
purchaseRequirements[9].amounts = [10*(10**2)];
purchaseRequirements[10].tokens = [tokens[5]]; // 20 STG
purchaseRequirements[10].amounts = [20*(10**2)];
purchaseRequirements[11].tokens = [tokens[5]]; // 50 STG
purchaseRequirements[11].amounts = [50*(10**2)];
| 47,101 |
131 | // Set the default reward receiver for the caller. When set to ZERO_ADDRESS, rewards are sent to the caller _receiver Receiver address for any rewards claimed via `claim_rewards` / | function set_rewards_receiver(address _receiver) external;
| function set_rewards_receiver(address _receiver) external;
| 63,118 |
102 | // Queries the approval status of an operator for a given owner _owner The owner of the Tokens _operatorAddress of authorized operatorreturn True if the operator is approved, false if not / | function isApprovedForAll(address _owner, address _operator)
public view returns (bool isOperator)
| function isApprovedForAll(address _owner, address _operator)
public view returns (bool isOperator)
| 17,892 |
12 | // Mineable TokenTurns a wallet into a mine for a specified ERC20 token / | contract OracleToken is Token {
/*Variables*/
bytes32 public currentChallenge;
uint public timeOfLastProof; // time of last challenge solved
uint256 public difficulty = 1; // Difficulty starts low
uint count;
address owner;
string public oracleName;
mapping(uint => uint) values;
Details[5] first_five;
struct Details {
uint value;
address miner;
}
/*Events*/
event Mine(address indexed to,uint _time, uint value);
event NewValue(address _miner, uint _value);
/*Functions*/
/**
* @dev Constructor that sets the passed value as the token to be mineable.
*/
constructor() public{
timeOfLastProof = now;
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function getVariables() public constant returns(bytes32, uint){
return (currentChallenge,difficulty);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public{
require(newOwner != address(0));
owner = newOwner;
}
/**
* @dev Change the difficulty
* @param _difficulty uint256 difficulty to be set
*/
function setDifficulty(uint256 _difficulty) onlyOwner public{
difficulty = _difficulty;
}
/**
* @dev Proof of work to be done for mining
* @param nonce uint
* @return uint The amount rewarded
*/
function proofOfWork(string nonce, uint value) returns (uint256,uint256) {
bytes32 n = sha3(currentChallenge,msg.sender,nonce); // generate random hash based on input
if (uint(n) % difficulty !=0) revert();
timeOfLastProof = now - (now % 60);
count++;
if (count<=5) {
first_five[count-1] = Details({
value: value,
miner: msg.sender
});
emit NewValue(msg.sender,value);
}
if(count == 5) {
pushValue(timeOfLastProof);
emit Mine(msg.sender,timeOfLastProof, value); // execute an event reflecting the change
count = 0;
}
else {
currentChallenge = sha3(nonce, currentChallenge, block.blockhash(block.number - 1)); // Save hash for next proof
}
return (count,timeOfLastProof);
}
function pushValue(uint _time) internal {
quickSort(first_five,0,4);
iTransfer(first_five[2].miner, 10); // reward to winner grows over time
iTransfer(first_five[1].miner, 5); // reward to winner grows over time
iTransfer(first_five[3].miner, 5); // reward to winner grows over time
iTransfer(first_five[0].miner, 1); // reward to winner grows over time
iTransfer(first_five[4].miner, 1); // reward to winner grows over time
values[_time] = first_five[2].value;
}
function retrieveData(uint _timestamp) public constant returns (uint) {
return values[_timestamp];
}
function testAdd(uint _timestamp, uint _value) public{
values[_timestamp] = _value;
}
function quickSort(Details[5] storage arr, uint left, uint right) internal {
uint i = left;
uint j = right;
uint pivot = arr[left + (right - left) / 2].value;
while (i <= j) {
while (arr[i].value < pivot) i++;
while (pivot < arr[j].value) j--;
if (i <= j) {
(arr[i].value, arr[j].value) = (arr[j].value, arr[i].value);
(arr[i].miner, arr[j].miner) = (arr[j].miner, arr[i].miner);
i++;
j--;
}
}
if (left < j)
quickSort(arr, left, j);
if (i < right)
quickSort(arr, i, right);
}
} | contract OracleToken is Token {
/*Variables*/
bytes32 public currentChallenge;
uint public timeOfLastProof; // time of last challenge solved
uint256 public difficulty = 1; // Difficulty starts low
uint count;
address owner;
string public oracleName;
mapping(uint => uint) values;
Details[5] first_five;
struct Details {
uint value;
address miner;
}
/*Events*/
event Mine(address indexed to,uint _time, uint value);
event NewValue(address _miner, uint _value);
/*Functions*/
/**
* @dev Constructor that sets the passed value as the token to be mineable.
*/
constructor() public{
timeOfLastProof = now;
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function getVariables() public constant returns(bytes32, uint){
return (currentChallenge,difficulty);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public{
require(newOwner != address(0));
owner = newOwner;
}
/**
* @dev Change the difficulty
* @param _difficulty uint256 difficulty to be set
*/
function setDifficulty(uint256 _difficulty) onlyOwner public{
difficulty = _difficulty;
}
/**
* @dev Proof of work to be done for mining
* @param nonce uint
* @return uint The amount rewarded
*/
function proofOfWork(string nonce, uint value) returns (uint256,uint256) {
bytes32 n = sha3(currentChallenge,msg.sender,nonce); // generate random hash based on input
if (uint(n) % difficulty !=0) revert();
timeOfLastProof = now - (now % 60);
count++;
if (count<=5) {
first_five[count-1] = Details({
value: value,
miner: msg.sender
});
emit NewValue(msg.sender,value);
}
if(count == 5) {
pushValue(timeOfLastProof);
emit Mine(msg.sender,timeOfLastProof, value); // execute an event reflecting the change
count = 0;
}
else {
currentChallenge = sha3(nonce, currentChallenge, block.blockhash(block.number - 1)); // Save hash for next proof
}
return (count,timeOfLastProof);
}
function pushValue(uint _time) internal {
quickSort(first_five,0,4);
iTransfer(first_five[2].miner, 10); // reward to winner grows over time
iTransfer(first_five[1].miner, 5); // reward to winner grows over time
iTransfer(first_five[3].miner, 5); // reward to winner grows over time
iTransfer(first_five[0].miner, 1); // reward to winner grows over time
iTransfer(first_five[4].miner, 1); // reward to winner grows over time
values[_time] = first_five[2].value;
}
function retrieveData(uint _timestamp) public constant returns (uint) {
return values[_timestamp];
}
function testAdd(uint _timestamp, uint _value) public{
values[_timestamp] = _value;
}
function quickSort(Details[5] storage arr, uint left, uint right) internal {
uint i = left;
uint j = right;
uint pivot = arr[left + (right - left) / 2].value;
while (i <= j) {
while (arr[i].value < pivot) i++;
while (pivot < arr[j].value) j--;
if (i <= j) {
(arr[i].value, arr[j].value) = (arr[j].value, arr[i].value);
(arr[i].miner, arr[j].miner) = (arr[j].miner, arr[i].miner);
i++;
j--;
}
}
if (left < j)
quickSort(arr, left, j);
if (i < right)
quickSort(arr, i, right);
}
} | 10,097 |
4 | // Mouth N°5 => Angry | function item_5() public pure returns (string memory) {
return
base(
'<g display="inline" ><path fill="#FFFFFF" d="M211.5,246.9c-7.9,1.5-19.6,0.3-23.8-0.9c-4.5-1.3-8.6,3.2-9.7,7.5c-0.5,2.6-1.4,7.7,3.9,10.5c6.7,2.5,6.4,0.1,10.4-2c3.9-2.1,11.3-1.1,17.3,2c6.1,3.1,15.1,2.3,20.2-0.4c3.2-1.8,3.8-7.9-4.8-14.7C222.5,247,220.4,245.2,211.5,246.9" /><path d="M211.5,247c-4.1,1-8.3,1.2-12.4,1.2c-2.1,0-4.2-0.2-6.3-0.4c-1-0.1-2.1-0.3-3.1-0.4c-0.5-0.1-1-0.2-1.6-0.3c-0.3-0.1-0.6-0.1-0.8-0.2c-0.2,0-0.4-0.1-0.6-0.1c-1.7-0.2-3.5,0.6-4.9,1.9c-1.4,1.3-2.5,3-3.1,4.8c-0.5,1.9-0.8,4-0.3,5.8c0.2,0.9,0.7,1.8,1.3,2.6c0.6,0.7,1.4,1.4,2.3,1.9l0,0c1.6,0.6,3.2,1.2,4.9,1c1.6-0.1,2.8-1.6,4.3-2.5c1.4-1,3.2-1.6,5-1.8c1.8-0.2,3.5-0.1,5.3,0.1c1.7,0.2,3.5,0.7,5.1,1.2c0.8,0.3,1.7,0.6,2.5,1s1.6,0.7,2.3,1c3,1.1,6.4,1.4,9.7,1.1c1.6-0.2,3.3-0.4,4.9-0.9c0.8-0.2,1.6-0.5,2.3-0.8c0.4-0.1,0.7-0.3,1.1-0.5l0.4-0.3c0.1-0.1,0.2-0.2,0.4-0.3c0.9-0.9,1.1-2.4,0.8-3.9s-1.1-2.9-2-4.3c-0.9-1.3-2.1-2.5-3.3-3.7c-0.6-0.6-1.3-1.1-1.9-1.6c-0.7-0.5-1.3-0.9-2.1-1.2c-1.5-0.6-3.2-0.8-4.9-0.8C214.9,246.6,213.2,246.8,211.5,247c-0.1,0-0.1,0-0.1-0.1s0-0.1,0.1-0.1c1.7-0.4,3.4-0.8,5.1-0.9c1.7-0.2,3.5-0.1,5.3,0.5c0.9,0.3,1.7,0.7,2.4,1.2s1.4,1,2.1,1.6c1.4,1.1,2.7,2.3,3.8,3.7s2.1,3,2.5,4.9c0.5,1.8,0.3,4.1-1.2,5.8c-0.2,0.2-0.4,0.4-0.6,0.6c-0.2,0.2-0.5,0.3-0.7,0.5c-0.4,0.2-0.8,0.4-1.2,0.6c-0.8,0.4-1.7,0.7-2.6,0.9c-1.7,0.5-3.5,0.8-5.3,0.9c-3.5,0.2-7.2-0.1-10.5-1.5c-0.8-0.4-1.7-0.8-2.4-1.1c-0.7-0.4-1.5-0.7-2.3-1c-1.6-0.6-3.2-1.1-4.8-1.4s-3.3-0.5-5-0.4s-3.2,0.5-4.7,1.4c-0.7,0.4-1.4,0.9-2.1,1.4c-0.7,0.5-1.6,1-2.5,1c-0.9,0.1-1.8-0.1-2.7-0.3c-0.9-0.2-1.7-0.5-2.5-0.8l0,0l0,0c-0.9-0.5-1.8-1.1-2.6-1.9c-0.7-0.8-1.3-1.8-1.7-2.8c-0.7-2.1-0.5-4.3-0.1-6.5c0.5-2.2,1.6-4.1,3.2-5.7c0.8-0.8,1.7-1.5,2.8-1.9c1.1-0.5,2.3-0.7,3.5-0.5c0.3,0,0.6,0.1,0.9,0.2c0.3,0.1,0.5,0.1,0.7,0.2c0.5,0.1,1,0.2,1.5,0.3c1,0.2,2,0.4,3,0.5c2,0.3,4.1,0.5,6.1,0.7c4.1,0.3,8.2,0.4,12.3,0c0.1,0,0.1,0,0.1,0.1C211.6,246.9,211.6,247,211.5,247z" /></g><g display="inline" ><path fill="#FFFFFF" d="M209.7,255.6l4.6-2.3c0,0,4.2,3,5.6,3.1s5.5-3.3,5.5-3.3l4.4,1.5" /><path d="M209.7,255.5c0.6-0.7,1.3-1.2,2-1.7s1.5-0.9,2.2-1.3l0.5-0.2l0.4,0.3c0.8,0.7,1.5,1.6,2.4,2.2c0.4,0.3,0.9,0.6,1.4,0.8s1.1,0.3,1.4,0.3c0.2-0.1,0.7-0.4,1.1-0.7c0.4-0.3,0.8-0.6,1.2-0.9c0.8-0.6,1.6-1.3,2.5-1.9l0.5-0.4l0.4,0.2c0.7,0.3,1.4,0.7,2.1,1c0.7,0.4,1.4,0.8,2,1.3c0,0,0.1,0.1,0,0.1h-0.1c-0.8,0-1.6-0.1-2.4-0.2c-0.8-0.1-1.5-0.3-2.3-0.5l1-0.2c-0.8,0.8-1.7,1.4-2.7,2c-0.5,0.3-1,0.6-1.5,0.8c-0.6,0.2-1.1,0.4-1.9,0.4c-0.8-0.2-1.1-0.6-1.6-0.8c-0.5-0.3-0.9-0.6-1.4-0.8c-1-0.5-2.1-0.7-3-1.3l0.9,0.1c-0.7,0.4-1.5,0.7-2.4,1c-0.8,0.3-1.7,0.5-2.6,0.6C209.7,255.7,209.6,255.6,209.7,255.5C209.6,255.6,209.6,255.5,209.7,255.5z" /></g><g display="inline" ><polyline fill="#FFFFFF" points="177.9,255.4 180.5,253.4 184.2,255.6 187.1,255.5 " /><path d="M177.8,255.3c0.1-0.4,0.2-0.6,0.3-0.9c0.2-0.3,0.3-0.5,0.5-0.7s0.4-0.4,0.6-0.5c0.2-0.1,0.6-0.2,0.8-0.2l0.6-0.1l0.1,0.1c0.2,0.3,0.5,0.6,0.8,0.8s0.7,0.2,1.1,0.3c0.4,0,0.7,0.1,1.1,0.3c0.3,0.1,0.7,0.3,1,0.4l-0.6-0.2c0.5,0,1,0.1,1.5,0.2c0.2,0.1,0.5,0.2,0.7,0.3s0.5,0.2,0.7,0.4c0.1,0,0.1,0.1,0,0.2l0,0c-0.2,0.2-0.5,0.3-0.7,0.5c-0.2,0.1-0.5,0.2-0.7,0.3c-0.5,0.2-1,0.3-1.4,0.3h-0.3l-0.3-0.2c-0.3-0.2-0.6-0.4-0.9-0.7c-0.3-0.2-0.5-0.5-0.8-0.8c-0.2-0.3-0.5-0.6-0.8-0.8s-0.6-0.3-1-0.3h0.6c-0.1,0.3-0.3,0.6-0.5,0.8s-0.4,0.3-0.7,0.5c-0.2,0.1-0.5,0.2-0.8,0.3s-0.6,0.1-1,0.1C177.9,255.5,177.8,255.4,177.8,255.3L177.8,255.3z" /></g>',
"Angry"
);
}
| function item_5() public pure returns (string memory) {
return
base(
'<g display="inline" ><path fill="#FFFFFF" d="M211.5,246.9c-7.9,1.5-19.6,0.3-23.8-0.9c-4.5-1.3-8.6,3.2-9.7,7.5c-0.5,2.6-1.4,7.7,3.9,10.5c6.7,2.5,6.4,0.1,10.4-2c3.9-2.1,11.3-1.1,17.3,2c6.1,3.1,15.1,2.3,20.2-0.4c3.2-1.8,3.8-7.9-4.8-14.7C222.5,247,220.4,245.2,211.5,246.9" /><path d="M211.5,247c-4.1,1-8.3,1.2-12.4,1.2c-2.1,0-4.2-0.2-6.3-0.4c-1-0.1-2.1-0.3-3.1-0.4c-0.5-0.1-1-0.2-1.6-0.3c-0.3-0.1-0.6-0.1-0.8-0.2c-0.2,0-0.4-0.1-0.6-0.1c-1.7-0.2-3.5,0.6-4.9,1.9c-1.4,1.3-2.5,3-3.1,4.8c-0.5,1.9-0.8,4-0.3,5.8c0.2,0.9,0.7,1.8,1.3,2.6c0.6,0.7,1.4,1.4,2.3,1.9l0,0c1.6,0.6,3.2,1.2,4.9,1c1.6-0.1,2.8-1.6,4.3-2.5c1.4-1,3.2-1.6,5-1.8c1.8-0.2,3.5-0.1,5.3,0.1c1.7,0.2,3.5,0.7,5.1,1.2c0.8,0.3,1.7,0.6,2.5,1s1.6,0.7,2.3,1c3,1.1,6.4,1.4,9.7,1.1c1.6-0.2,3.3-0.4,4.9-0.9c0.8-0.2,1.6-0.5,2.3-0.8c0.4-0.1,0.7-0.3,1.1-0.5l0.4-0.3c0.1-0.1,0.2-0.2,0.4-0.3c0.9-0.9,1.1-2.4,0.8-3.9s-1.1-2.9-2-4.3c-0.9-1.3-2.1-2.5-3.3-3.7c-0.6-0.6-1.3-1.1-1.9-1.6c-0.7-0.5-1.3-0.9-2.1-1.2c-1.5-0.6-3.2-0.8-4.9-0.8C214.9,246.6,213.2,246.8,211.5,247c-0.1,0-0.1,0-0.1-0.1s0-0.1,0.1-0.1c1.7-0.4,3.4-0.8,5.1-0.9c1.7-0.2,3.5-0.1,5.3,0.5c0.9,0.3,1.7,0.7,2.4,1.2s1.4,1,2.1,1.6c1.4,1.1,2.7,2.3,3.8,3.7s2.1,3,2.5,4.9c0.5,1.8,0.3,4.1-1.2,5.8c-0.2,0.2-0.4,0.4-0.6,0.6c-0.2,0.2-0.5,0.3-0.7,0.5c-0.4,0.2-0.8,0.4-1.2,0.6c-0.8,0.4-1.7,0.7-2.6,0.9c-1.7,0.5-3.5,0.8-5.3,0.9c-3.5,0.2-7.2-0.1-10.5-1.5c-0.8-0.4-1.7-0.8-2.4-1.1c-0.7-0.4-1.5-0.7-2.3-1c-1.6-0.6-3.2-1.1-4.8-1.4s-3.3-0.5-5-0.4s-3.2,0.5-4.7,1.4c-0.7,0.4-1.4,0.9-2.1,1.4c-0.7,0.5-1.6,1-2.5,1c-0.9,0.1-1.8-0.1-2.7-0.3c-0.9-0.2-1.7-0.5-2.5-0.8l0,0l0,0c-0.9-0.5-1.8-1.1-2.6-1.9c-0.7-0.8-1.3-1.8-1.7-2.8c-0.7-2.1-0.5-4.3-0.1-6.5c0.5-2.2,1.6-4.1,3.2-5.7c0.8-0.8,1.7-1.5,2.8-1.9c1.1-0.5,2.3-0.7,3.5-0.5c0.3,0,0.6,0.1,0.9,0.2c0.3,0.1,0.5,0.1,0.7,0.2c0.5,0.1,1,0.2,1.5,0.3c1,0.2,2,0.4,3,0.5c2,0.3,4.1,0.5,6.1,0.7c4.1,0.3,8.2,0.4,12.3,0c0.1,0,0.1,0,0.1,0.1C211.6,246.9,211.6,247,211.5,247z" /></g><g display="inline" ><path fill="#FFFFFF" d="M209.7,255.6l4.6-2.3c0,0,4.2,3,5.6,3.1s5.5-3.3,5.5-3.3l4.4,1.5" /><path d="M209.7,255.5c0.6-0.7,1.3-1.2,2-1.7s1.5-0.9,2.2-1.3l0.5-0.2l0.4,0.3c0.8,0.7,1.5,1.6,2.4,2.2c0.4,0.3,0.9,0.6,1.4,0.8s1.1,0.3,1.4,0.3c0.2-0.1,0.7-0.4,1.1-0.7c0.4-0.3,0.8-0.6,1.2-0.9c0.8-0.6,1.6-1.3,2.5-1.9l0.5-0.4l0.4,0.2c0.7,0.3,1.4,0.7,2.1,1c0.7,0.4,1.4,0.8,2,1.3c0,0,0.1,0.1,0,0.1h-0.1c-0.8,0-1.6-0.1-2.4-0.2c-0.8-0.1-1.5-0.3-2.3-0.5l1-0.2c-0.8,0.8-1.7,1.4-2.7,2c-0.5,0.3-1,0.6-1.5,0.8c-0.6,0.2-1.1,0.4-1.9,0.4c-0.8-0.2-1.1-0.6-1.6-0.8c-0.5-0.3-0.9-0.6-1.4-0.8c-1-0.5-2.1-0.7-3-1.3l0.9,0.1c-0.7,0.4-1.5,0.7-2.4,1c-0.8,0.3-1.7,0.5-2.6,0.6C209.7,255.7,209.6,255.6,209.7,255.5C209.6,255.6,209.6,255.5,209.7,255.5z" /></g><g display="inline" ><polyline fill="#FFFFFF" points="177.9,255.4 180.5,253.4 184.2,255.6 187.1,255.5 " /><path d="M177.8,255.3c0.1-0.4,0.2-0.6,0.3-0.9c0.2-0.3,0.3-0.5,0.5-0.7s0.4-0.4,0.6-0.5c0.2-0.1,0.6-0.2,0.8-0.2l0.6-0.1l0.1,0.1c0.2,0.3,0.5,0.6,0.8,0.8s0.7,0.2,1.1,0.3c0.4,0,0.7,0.1,1.1,0.3c0.3,0.1,0.7,0.3,1,0.4l-0.6-0.2c0.5,0,1,0.1,1.5,0.2c0.2,0.1,0.5,0.2,0.7,0.3s0.5,0.2,0.7,0.4c0.1,0,0.1,0.1,0,0.2l0,0c-0.2,0.2-0.5,0.3-0.7,0.5c-0.2,0.1-0.5,0.2-0.7,0.3c-0.5,0.2-1,0.3-1.4,0.3h-0.3l-0.3-0.2c-0.3-0.2-0.6-0.4-0.9-0.7c-0.3-0.2-0.5-0.5-0.8-0.8c-0.2-0.3-0.5-0.6-0.8-0.8s-0.6-0.3-1-0.3h0.6c-0.1,0.3-0.3,0.6-0.5,0.8s-0.4,0.3-0.7,0.5c-0.2,0.1-0.5,0.2-0.8,0.3s-0.6,0.1-1,0.1C177.9,255.5,177.8,255.4,177.8,255.3L177.8,255.3z" /></g>',
"Angry"
);
}
| 44,680 |
3 | // Separations of concerns, convenience method for Factory/ | function addPermittedCallers(address[] memory _callerAddresses)
public onlyOwner {
for (uint i = 0; i < _callerAddresses.length; i++) {
addPermittedCaller(_callerAddresses[i]);
}
| function addPermittedCallers(address[] memory _callerAddresses)
public onlyOwner {
for (uint i = 0; i < _callerAddresses.length; i++) {
addPermittedCaller(_callerAddresses[i]);
}
| 54,173 |
305 | // Eliminate any chance of jackpot when admin rolls during paused state for testing purposes | if (tokens[tid].level >= paused_level) b = 99999;
if (b < jackpot_prob[tokens[tid].level]) {
| if (tokens[tid].level >= paused_level) b = 99999;
if (b < jackpot_prob[tokens[tid].level]) {
| 43,408 |
113 | // Transfers the amount to recipient.- Add or checks stakeholders array for recipient address- calls for fees distribution Requirements: - recipient cannot be the zero address.- the caller must have a balance of at least amount. / | function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
| function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
| 43,667 |
7 | // NOTE: Trusts the owner not to add a coin twice. Returns the coin index. | function addCoin(
string calldata _name,
AggregatorV3Interface _priceFeed,
uint8 _imprecision
| function addCoin(
string calldata _name,
AggregatorV3Interface _priceFeed,
uint8 _imprecision
| 30,330 |
13 | // addPaperReview -This function verify registered reviewer and verify paper existence. Then it allows to add the comment, status and cid hash file against the paper id._paperidPaper ID, or which reviewed data being added_versionPaper version, for which reviewed data being added_reviewerComments complete comments_reviewerCidremarked document hash cid from IPFS_status Status of the paper given by the reviewer e.g. passed , reject or resubmit. / | function addPaperReview(uint32 _paperid,uint32 _version,string memory _reviewerComments,string memory _reviewerCid,uint _status) public
| function addPaperReview(uint32 _paperid,uint32 _version,string memory _reviewerComments,string memory _reviewerCid,uint _status) public
| 17,227 |
8 | // Check sender is Fuse admin | require(msg.sender == fuseAdmin, "Sender not Fuse admin.");
| require(msg.sender == fuseAdmin, "Sender not Fuse admin.");
| 67,674 |
43 | // Reentrancy | bool private _isSwapLocked = false;
| bool private _isSwapLocked = false;
| 80,256 |
57 | // Allows the owner to permanently disable token transfers. This can be usedonce side chain is ready and the owner wants to stop transfers to take a snapshotof token balances for the genesis of the side chain. | function freeze() public onlyOwner returns (bool) {
require(!frozen);
frozen = true;
Frozen();
return true;
}
| function freeze() public onlyOwner returns (bool) {
require(!frozen);
frozen = true;
Frozen();
return true;
}
| 9,740 |
11 | // Called when debug. | event Debug(uint256 data, address addr);
| event Debug(uint256 data, address addr);
| 44,950 |
63 | // Convenience functions | function buyAndCreateGame (uint256 amount, uint256 pose, address referral) public payable {
buyTokens (referral);
createGame (amount, pose);
}
| function buyAndCreateGame (uint256 amount, uint256 pose, address referral) public payable {
buyTokens (referral);
createGame (amount, pose);
}
| 26,157 |
468 | // EIP-20 token symbol for this token |
string public constant symbol = "LAVA";
|
string public constant symbol = "LAVA";
| 3,106 |
75 | // serializes Instance struct _record Instance / | function serialize(Instance memory _record) external nonReentrant {
require(msg.sender == _record.uuid, 'ElasticDAO: Unauthorized');
setUint(keccak256(abi.encode(_record.uuid, 'maxVotingLambda')), _record.maxVotingLambda);
setString(keccak256(abi.encode(_record.uuid, 'name')), _record.name);
setBool(keccak256(abi.encode(_record.uuid, 'summoned')), _record.summoned);
if (_record.summoners.length > 0) {
_record.numberOfSummoners = _record.summoners.length;
setUint(keccak256(abi.encode(_record.uuid, 'numberOfSummoners')), _record.numberOfSummoners);
for (uint256 i = 0; i < _record.numberOfSummoners; i += 1) {
setBool(keccak256(abi.encode(_record.uuid, 'summoner', _record.summoners[i])), true);
setAddress(keccak256(abi.encode(_record.uuid, 'summoners', i)), _record.summoners[i]);
}
}
setBool(keccak256(abi.encode(_record.uuid, 'exists')), true);
emit Serialized(_record.uuid);
}
| function serialize(Instance memory _record) external nonReentrant {
require(msg.sender == _record.uuid, 'ElasticDAO: Unauthorized');
setUint(keccak256(abi.encode(_record.uuid, 'maxVotingLambda')), _record.maxVotingLambda);
setString(keccak256(abi.encode(_record.uuid, 'name')), _record.name);
setBool(keccak256(abi.encode(_record.uuid, 'summoned')), _record.summoned);
if (_record.summoners.length > 0) {
_record.numberOfSummoners = _record.summoners.length;
setUint(keccak256(abi.encode(_record.uuid, 'numberOfSummoners')), _record.numberOfSummoners);
for (uint256 i = 0; i < _record.numberOfSummoners; i += 1) {
setBool(keccak256(abi.encode(_record.uuid, 'summoner', _record.summoners[i])), true);
setAddress(keccak256(abi.encode(_record.uuid, 'summoners', i)), _record.summoners[i]);
}
}
setBool(keccak256(abi.encode(_record.uuid, 'exists')), true);
emit Serialized(_record.uuid);
}
| 24,999 |
63 | // computes P + Q input: 4 values of 256 bit each) x-coordinate of point P) y-coordinate of point P) x-coordinate of point Q) y-coordinate of point Q |
bool success;
assembly {
|
bool success;
assembly {
| 5,687 |
37 | // The payment required alongside a burn transaction in order to mint in 1/100,000 ETH | uint32 burnPayment;
| uint32 burnPayment;
| 28,983 |
20 | // Fired whenever a team is transfered from one owner to another | event Transfer(address from, address to, uint256 tokenId);
| event Transfer(address from, address to, uint256 tokenId);
| 64,256 |
21 | // ERC20 Contract definitions / | contract ERC20 {
uint256 public totalETHSupply; // added to the ERC20 for convenience, does not change the protocol
function balanceOf(address who) constant returns (uint);
function allowance(address owner, address spender) constant returns (uint);
function transfer(address to, uint value) returns (bool ok);
function transferFrom(address from, address to, uint value) returns (bool ok);
function approve(address spender, uint value) returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
| contract ERC20 {
uint256 public totalETHSupply; // added to the ERC20 for convenience, does not change the protocol
function balanceOf(address who) constant returns (uint);
function allowance(address owner, address spender) constant returns (uint);
function transfer(address to, uint value) returns (bool ok);
function transferFrom(address from, address to, uint value) returns (bool ok);
function approve(address spender, uint value) returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
| 39,715 |
169 | // minter will only be tunnel | modifier onlyMinter {
require(hasRole(MINTER_ROLE, msg.sender), "Caller is not a minter");
_;
}
| modifier onlyMinter {
require(hasRole(MINTER_ROLE, msg.sender), "Caller is not a minter");
_;
}
| 22,698 |
37 | // If the action is STORES, and this action has already been executed, throw | require(n_stored == 0, 'Duplicate action: STORES');
| require(n_stored == 0, 'Duplicate action: STORES');
| 48,236 |
5 | // LP pair address. | address public tokenPair;
| address public tokenPair;
| 8,948 |
247 | // Unstake YELD tokens and receive YELDIES tokens tradable for NFTs | function unstakeYELDAndReceiveYELDIES(uint256 _amount) public {
require(_amount <= amountStaked[msg.sender], "NFTManager: You can't unstake more than your current stake");
receiveYELDIES();
amountStaked[msg.sender] = amountStaked[msg.sender].sub(_amount);
IERC20(yeld).transfer(msg.sender, _amount);
}
| function unstakeYELDAndReceiveYELDIES(uint256 _amount) public {
require(_amount <= amountStaked[msg.sender], "NFTManager: You can't unstake more than your current stake");
receiveYELDIES();
amountStaked[msg.sender] = amountStaked[msg.sender].sub(_amount);
IERC20(yeld).transfer(msg.sender, _amount);
}
| 16,988 |
6 | // Gets the patient record based on the record id. /onlyBy(owner)restrict access |
returns (
uint,
string memory,
string memory,
string memory,
string memory,
string memory,
string memory,
|
returns (
uint,
string memory,
string memory,
string memory,
string memory,
string memory,
string memory,
| 8,836 |
66 | // allocate the string | bytes memory bstr = new bytes(length);
| bytes memory bstr = new bytes(length);
| 1,227 |
3 | // Mints debt token to the `onBehalfOf` address. The resulting rate is the weighted average between the rate of the new debtand the rate of the previous debt user The address receiving the borrowed underlying, being the delegatee in caseof credit delegate, or same as `onBehalfOf` otherwise onBehalfOf The address receiving the debt tokens amount The amount of debt tokens to mint rate The rate of the debt being mintedreturn True if it is the first borrow, false otherwisereturn The total stable debtreturn The average stable borrow rate / | function mint(
| function mint(
| 25,353 |
481 | // index record next user index mapped by pool | mapping(uint256 => uint256) public nextUser;
| mapping(uint256 => uint256) public nextUser;
| 43,343 |
108 | // Lets the owner transfer ownership of the contract to a new owner. _newOwner The new owner. / | function changeOwner(address _newOwner) external onlyOwner {
require(_newOwner != address(0), "Address must not be null");
owner = _newOwner;
emit OwnerChanged(_newOwner);
}
| function changeOwner(address _newOwner) external onlyOwner {
require(_newOwner != address(0), "Address must not be null");
owner = _newOwner;
emit OwnerChanged(_newOwner);
}
| 22,911 |
0 | // Difficulty starts reasonably low | difficulty = 10**32;
| difficulty = 10**32;
| 16,467 |
113 | // split the contract balance into halves | uint256 half = contractTokenBalance.div(2);
uint256 otherHalf = contractTokenBalance.sub(half);
| uint256 half = contractTokenBalance.div(2);
uint256 otherHalf = contractTokenBalance.sub(half);
| 10,432 |
67 | // set new owner, burn rate | slot.owner = msg.sender;
slot.burnRate = newBurnRate;
slot.deposit = deposit;
| slot.owner = msg.sender;
slot.burnRate = newBurnRate;
slot.deposit = deposit;
| 28,813 |
31 | // release time of locked | function unlockTimeOf(address _owner) public constant returns (uint timelimit) {
return timeRelease[_owner];
}
| function unlockTimeOf(address _owner) public constant returns (uint timelimit) {
return timeRelease[_owner];
}
| 32,056 |
60 | // daiAvailableToDistribute therefore does not include unused deposits | daiAvailableToDistribute = _balanceAfter.sub(_balanceBefore);
emit LogStep2Complete(daiAvailableToDistribute);
| daiAvailableToDistribute = _balanceAfter.sub(_balanceBefore);
emit LogStep2Complete(daiAvailableToDistribute);
| 28,555 |
41 | // ICrowdsaleProxy created 23/11/2017author Frank Bonnet / | interface ICrowdsaleProxy {
/**
* Receive ether and issue tokens to the sender
*
* This function requires that msg.sender is not a contract. This is required because it's
* not possible for a contract to specify a gas amount when calling the (internal) send()
* function. Solidity imposes a maximum amount of gas (2300 gas at the time of writing)
*
* Contracts can call the contribute() function instead
*/
function () public payable;
/**
* Receive ether and issue tokens to the sender
*
* @return The accepted ether amount
*/
function contribute() public payable returns (uint);
/**
* Receive ether and issue tokens to `_beneficiary`
*
* @param _beneficiary The account that receives the tokens
* @return The accepted ether amount
*/
function contributeFor(address _beneficiary) public payable returns (uint);
}
| interface ICrowdsaleProxy {
/**
* Receive ether and issue tokens to the sender
*
* This function requires that msg.sender is not a contract. This is required because it's
* not possible for a contract to specify a gas amount when calling the (internal) send()
* function. Solidity imposes a maximum amount of gas (2300 gas at the time of writing)
*
* Contracts can call the contribute() function instead
*/
function () public payable;
/**
* Receive ether and issue tokens to the sender
*
* @return The accepted ether amount
*/
function contribute() public payable returns (uint);
/**
* Receive ether and issue tokens to `_beneficiary`
*
* @param _beneficiary The account that receives the tokens
* @return The accepted ether amount
*/
function contributeFor(address _beneficiary) public payable returns (uint);
}
| 16,360 |
4 | // Mappings to store admin's address and name for each certificate hash | mapping(bytes32 => address) private CertAdmin;
mapping(bytes32 => string) private CertAdminName;
| mapping(bytes32 => address) private CertAdmin;
mapping(bytes32 => string) private CertAdminName;
| 25,487 |
22 | // updates the whitelist oracle address. Requirements:`newAddress` cannot be a zero address.`caller` should be current admin. / | function updateOracle(address newAddress) public virtual onlyAdmin {
require(newAddress != address(0), "Error: owner cannot be zero");
_whitelist = newAddress;
}
| function updateOracle(address newAddress) public virtual onlyAdmin {
require(newAddress != address(0), "Error: owner cannot be zero");
_whitelist = newAddress;
}
| 9,013 |
47 | // Default is the ecrecover flow with the provided data hash Use ecrecover with the messageHash for EOA signatures | currentOwner = ecrecover(dataHash, v, r, s);
| currentOwner = ecrecover(dataHash, v, r, s);
| 7,675 |
9 | // Require that the specified auction exists / | modifier auctionExists(uint256 auctionId) {
require(_exists(auctionId), "Auction doesn't exist");
_;
}
| modifier auctionExists(uint256 auctionId) {
require(_exists(auctionId), "Auction doesn't exist");
_;
}
| 2,145 |
19 | // Pools and Farms percent from token per block | uint256 public stakingPercent;
| uint256 public stakingPercent;
| 11,467 |
8 | // transfer assets | require(ASSET_TOKEN.transferFrom(msg.sender, address(this), balance));
| require(ASSET_TOKEN.transferFrom(msg.sender, address(this), balance));
| 21,635 |
61 | // Amount tokens charged to add to liquidity. | uint256 tLiquifyFee;
uint256 tMarketingFee;
uint256 tDevFee;
| uint256 tLiquifyFee;
uint256 tMarketingFee;
uint256 tDevFee;
| 35,798 |
220 | // Mapping from marble NFT source uri hash TO NFT ID . / | mapping (uint256 => uint256) public sourceUriHashToId;
constructor()
public
| mapping (uint256 => uint256) public sourceUriHashToId;
constructor()
public
| 23,391 |
8 | // Sender redeems cTokens in exchange for the underlying asset Accrues interest whether or not the operation succeeds, unless reverted redeemTokens The number of cTokens to redeem into underlyingreturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) / | function redeem(uint redeemTokens) override external returns (uint) {
bytes memory data = delegateToImplementation(abi.encodeWithSignature("redeem(uint256)", redeemTokens));
return abi.decode(data, (uint));
}
| function redeem(uint redeemTokens) override external returns (uint) {
bytes memory data = delegateToImplementation(abi.encodeWithSignature("redeem(uint256)", redeemTokens));
return abi.decode(data, (uint));
}
| 2,856 |
31 | // we check if platform emergency mode is on | if(_emergencyStop) revert EmergencyMode();
Campaign storage campaign = campaigns[_id];
| if(_emergencyStop) revert EmergencyMode();
Campaign storage campaign = campaigns[_id];
| 28,587 |
31 | // this function deploys a new Farming contract and calls the encoded function passed as data. data encoded initialize function for the farming contract (check Farming contract code).return contractAddress new farming contract address.return initResultData new farming contract call result. / | function deploy(bytes memory data) public returns (address contractAddress, bytes memory initResultData) {
initResultData = _call(contractAddress = _clone(farmMainImplAddress), data);
emit FarmMainDeployed(contractAddress, msg.sender, initResultData);
}
| function deploy(bytes memory data) public returns (address contractAddress, bytes memory initResultData) {
initResultData = _call(contractAddress = _clone(farmMainImplAddress), data);
emit FarmMainDeployed(contractAddress, msg.sender, initResultData);
}
| 16,118 |
194 | // Issue can be created via {createNewIssue}./ | function _issueExists(uint256 _issueNumber) internal view virtual returns (bool) {
return issues[_issueNumber].exist ? true : false;
}
| function _issueExists(uint256 _issueNumber) internal view virtual returns (bool) {
return issues[_issueNumber].exist ? true : false;
}
| 31,752 |
60 | // The nft value is to be updated by authenticated oracles | function update(bytes32 nftID_, uint value) public auth {
// switch of collateral risk group results in new: ceiling, threshold for existing loan
nftValues[nftID_] = value;
}
| function update(bytes32 nftID_, uint value) public auth {
// switch of collateral risk group results in new: ceiling, threshold for existing loan
nftValues[nftID_] = value;
}
| 37,229 |
1 | // Pack size will be from 3 to 7 items | for(uint i = 0; i < _ids.length; i++) {
require(balanceOf(owner(), _ids[i]) >= _amounts[i], "Marketplace: Owner does not own enough of each item");
require(activeItems[_msgSender()][_ids[i]] == true, "Marketplace: Already in pack or sold");
activeItems[_msgSender()][_ids[i]] = false;
}
| for(uint i = 0; i < _ids.length; i++) {
require(balanceOf(owner(), _ids[i]) >= _amounts[i], "Marketplace: Owner does not own enough of each item");
require(activeItems[_msgSender()][_ids[i]] == true, "Marketplace: Already in pack or sold");
activeItems[_msgSender()][_ids[i]] = false;
}
| 22,194 |
155 | // Check end time not before start time and that end is in the future | require(_endTimestamp > _startTimestamp, "End time must be greater than start");
require(_endTimestamp > _getNow(), "End time passed. Nobody can bid.");
| require(_endTimestamp > _startTimestamp, "End time must be greater than start");
require(_endTimestamp > _getNow(), "End time passed. Nobody can bid.");
| 41,725 |
83 | // 0x780e9d63 ===bytes4(keccak256('totalSupply()')) ^bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^bytes4(keccak256('tokenByIndex(uint256)')) / |
bytes4 private constant InterfaceId_ERC721Metadata = 0x5b5e139f;
|
bytes4 private constant InterfaceId_ERC721Metadata = 0x5b5e139f;
| 15,405 |
5 | // Deposit Token to lending pool | IAaveLendingPool(lendingPoolAddress).deposit(tokenAddress, amount, 0);
return true;
| IAaveLendingPool(lendingPoolAddress).deposit(tokenAddress, amount, 0);
return true;
| 28,398 |
23 | // return array of UUID specified by parameters/_requester RDDN Address of the requester/_state 0:Prepared, 1:Executed, 2:Aborted/_direction 0:Deposit, 1:Withdraw/ return array of UUID | function getRequests (
address _requester,
State _state,
Direction _direction
| function getRequests (
address _requester,
State _state,
Direction _direction
| 2,617 |
300 | // pre-set approvals | approveTokenMax(comp, address(UNI_V2_ROUTER));
approveTokenMax(comp, address(SUSHI_V2_ROUTER));
approveTokenMax(comp, address(UNI_V3_ROUTER));
approveTokenMax(address(want), address(cToken));
approveTokenMax(weth, address(FlashLoanLib.SOLO));
| approveTokenMax(comp, address(UNI_V2_ROUTER));
approveTokenMax(comp, address(SUSHI_V2_ROUTER));
approveTokenMax(comp, address(UNI_V3_ROUTER));
approveTokenMax(address(want), address(cToken));
approveTokenMax(weth, address(FlashLoanLib.SOLO));
| 50,866 |
822 | // Create a query dispute passing the parsed attestation.To be used in createQueryDispute() and createQueryDisputeConflict()to avoid calling parseAttestation() multiple times`_attestationData` is only passed to be emitted _fisherman Creator of dispute _deposit Amount of tokens staked as deposit _attestation Attestation struct parsed from bytes _attestationData Attestation bytes submitted by the fishermanreturn DisputeID / | function _createQueryDisputeWithAttestation(
address _fisherman,
uint256 _deposit,
Attestation memory _attestation,
bytes memory _attestationData
| function _createQueryDisputeWithAttestation(
address _fisherman,
uint256 _deposit,
Attestation memory _attestation,
bytes memory _attestationData
| 84,696 |
83 | // swap pool filling success event | event FillSuccess (
uint256 total,
bytes32 id,
address creator,
uint256 creation_time,
address token_address,
string message
);
| event FillSuccess (
uint256 total,
bytes32 id,
address creator,
uint256 creation_time,
address token_address,
string message
);
| 4,919 |
34 | // maximum available SHPC with a bonus | uint public maxDistributeCoin = 600000000 * 1 ether; //600,000,000 shpc (incl. bonus)
| uint public maxDistributeCoin = 600000000 * 1 ether; //600,000,000 shpc (incl. bonus)
| 43,025 |
12 | // 评价 | struct Comment {
address buyer; // 购买者
uint date; // 日期
uint score; // 评分
string content; // 评论
}
| struct Comment {
address buyer; // 购买者
uint date; // 日期
uint score; // 评分
string content; // 评论
}
| 22,784 |
14 | // minimum amount of value to transfer to beneficiary in automatic mode | uint private quantum;
| uint private quantum;
| 11,047 |
15 | // https:data.chain.link/ethereum/mainnet/crypto-usd/aave-usd Chainlink: AAVE/USD | feedAddress = 0x547a514d5e3769680Ce22B2361c10Ea13619e8a9;
maxStaleness = 1 hours + STALENESS_BUFFER;
| feedAddress = 0x547a514d5e3769680Ce22B2361c10Ea13619e8a9;
maxStaleness = 1 hours + STALENESS_BUFFER;
| 12,217 |
169 | // Withdraw without caring about rewards./_pid The pid specifies the pool | function emergencyWithdraw(uint256 _pid) external;
| function emergencyWithdraw(uint256 _pid) external;
| 39,644 |
22 | // hacker get its reward to a vesting contract | tokenLock = tokenLockFactory.createTokenLock(
address(lpToken),
0x000000000000000000000000000000000000dEaD, //this address as owner, so it can do nothing.
pendingApproval.beneficiary,
claimRewards.hackerVestedReward,
| tokenLock = tokenLockFactory.createTokenLock(
address(lpToken),
0x000000000000000000000000000000000000dEaD, //this address as owner, so it can do nothing.
pendingApproval.beneficiary,
claimRewards.hackerVestedReward,
| 29,111 |
50 | // Whitelist The Whitelist contract has a whitelist of addresses, and provides basic authorization control functions.This simplifies the implementation of "user permissions". / | contract Whitelist is Ownable, RBAC {
string public constant ROLE_WHITELISTED = "whitelist";
/**
* @dev Throws if operator is not whitelisted.
* @param _operator address
*/
modifier onlyIfWhitelisted(address _operator) {
checkRole(_operator, ROLE_WHITELISTED);
_;
}
/**
* @dev add an address to the whitelist
* @param _operator address
* @return true if the address was added to the whitelist, false if the address was already in the whitelist
*/
function addAddressToWhitelist(address _operator)
onlyOwner
public
{
addRole(_operator, ROLE_WHITELISTED);
}
/**
* @dev getter to determine if address is in whitelist
*/
function whitelist(address _operator)
public
view
returns (bool)
{
return hasRole(_operator, ROLE_WHITELISTED);
}
/**
* @dev add addresses to the whitelist
* @param _operators addresses
* @return true if at least one address was added to the whitelist,
* false if all addresses were already in the whitelist
*/
function addAddressesToWhitelist(address[] _operators)
onlyOwner
public
{
for (uint256 i = 0; i < _operators.length; i++) {
addAddressToWhitelist(_operators[i]);
}
}
/**
* @dev remove an address from the whitelist
* @param _operator address
* @return true if the address was removed from the whitelist,
* false if the address wasn't in the whitelist in the first place
*/
function removeAddressFromWhitelist(address _operator)
onlyOwner
public
{
removeRole(_operator, ROLE_WHITELISTED);
}
/**
* @dev remove addresses from the whitelist
* @param _operators addresses
* @return true if at least one address was removed from the whitelist,
* false if all addresses weren't in the whitelist in the first place
*/
function removeAddressesFromWhitelist(address[] _operators)
onlyOwner
public
{
for (uint256 i = 0; i < _operators.length; i++) {
removeAddressFromWhitelist(_operators[i]);
}
}
}
| contract Whitelist is Ownable, RBAC {
string public constant ROLE_WHITELISTED = "whitelist";
/**
* @dev Throws if operator is not whitelisted.
* @param _operator address
*/
modifier onlyIfWhitelisted(address _operator) {
checkRole(_operator, ROLE_WHITELISTED);
_;
}
/**
* @dev add an address to the whitelist
* @param _operator address
* @return true if the address was added to the whitelist, false if the address was already in the whitelist
*/
function addAddressToWhitelist(address _operator)
onlyOwner
public
{
addRole(_operator, ROLE_WHITELISTED);
}
/**
* @dev getter to determine if address is in whitelist
*/
function whitelist(address _operator)
public
view
returns (bool)
{
return hasRole(_operator, ROLE_WHITELISTED);
}
/**
* @dev add addresses to the whitelist
* @param _operators addresses
* @return true if at least one address was added to the whitelist,
* false if all addresses were already in the whitelist
*/
function addAddressesToWhitelist(address[] _operators)
onlyOwner
public
{
for (uint256 i = 0; i < _operators.length; i++) {
addAddressToWhitelist(_operators[i]);
}
}
/**
* @dev remove an address from the whitelist
* @param _operator address
* @return true if the address was removed from the whitelist,
* false if the address wasn't in the whitelist in the first place
*/
function removeAddressFromWhitelist(address _operator)
onlyOwner
public
{
removeRole(_operator, ROLE_WHITELISTED);
}
/**
* @dev remove addresses from the whitelist
* @param _operators addresses
* @return true if at least one address was removed from the whitelist,
* false if all addresses weren't in the whitelist in the first place
*/
function removeAddressesFromWhitelist(address[] _operators)
onlyOwner
public
{
for (uint256 i = 0; i < _operators.length; i++) {
removeAddressFromWhitelist(_operators[i]);
}
}
}
| 48,818 |
7 | // Take Avax Rewards | uint256 _avax = address(this).balance; //get balance of native Avax
if (_avax > 0) { //wrap avax into ERC20
WAVAX(wavax).deposit{value: _avax}();
| uint256 _avax = address(this).balance; //get balance of native Avax
if (_avax > 0) { //wrap avax into ERC20
WAVAX(wavax).deposit{value: _avax}();
| 36,905 |
96 | // where block.number is past the endBlock | else if (block.number >= endBlock){
_deltaBlock = endBlock.sub(lastBlock);
}
| else if (block.number >= endBlock){
_deltaBlock = endBlock.sub(lastBlock);
}
| 45,017 |
12 | // Add multiple itemsAll for same priceThis saves sending 10 tickets to create 10 items. | function AddMultipleItems(uint256 price, uint8 howmuch) public {
require(msg.sender == owner);
require(price != 0);
require(howmuch != 255); // this is to prevent an infinite for loop
uint8 i=0;
for (i; i<howmuch; i++){
AddItem(price);
}
}
| function AddMultipleItems(uint256 price, uint8 howmuch) public {
require(msg.sender == owner);
require(price != 0);
require(howmuch != 255); // this is to prevent an infinite for loop
uint8 i=0;
for (i; i<howmuch; i++){
AddItem(price);
}
}
| 40,815 |
136 | // SECRET / | contract ChallengeScienceInterface {
/**
* @dev given genes of current floor and dungeon seed, return a genetic combination - may have a random factor.
* @param _floorGenes Genes of floor.
* @param _seedGenes Seed genes of dungeon.
* @return The resulting genes.
*/
function mixGenes(uint _floorGenes, uint _seedGenes) external returns (uint);
}
| contract ChallengeScienceInterface {
/**
* @dev given genes of current floor and dungeon seed, return a genetic combination - may have a random factor.
* @param _floorGenes Genes of floor.
* @param _seedGenes Seed genes of dungeon.
* @return The resulting genes.
*/
function mixGenes(uint _floorGenes, uint _seedGenes) external returns (uint);
}
| 41,328 |
13 | // ecMul(h, f1) | (uint256 calc_1_x, uint256 calc_1_y) = MathEC.ecMul(input.bn1, publicKey.x, publicKey.y);
| (uint256 calc_1_x, uint256 calc_1_y) = MathEC.ecMul(input.bn1, publicKey.x, publicKey.y);
| 25,543 |
47 | // Sells CLIMB Tokens And Deposits Underlying Asset Tokens into Seller's Address / | function sell(uint256 tokenAmount) external nonReentrant {
_sell(tokenAmount, msg.sender);
}
| function sell(uint256 tokenAmount) external nonReentrant {
_sell(tokenAmount, msg.sender);
}
| 29,609 |
31 | // Eternal internal functionsGetter Methods | function getSwapOutTicket(string memory _ticket) internal view returns (SwapOutTicketStruct memory) {
DiamondStorage storage ds = diamondStorage();
return ds.SwapOutTickets[_ticket];
}
| function getSwapOutTicket(string memory _ticket) internal view returns (SwapOutTicketStruct memory) {
DiamondStorage storage ds = diamondStorage();
return ds.SwapOutTickets[_ticket];
}
| 33,424 |
64 | // Constructor// _messenger Address of the CrossDomainMessenger on the current layer. / | constructor(address _messenger) {
messenger = _messenger;
}
| constructor(address _messenger) {
messenger = _messenger;
}
| 45,442 |
193 | // withdraw all liquidity and claim all pending reward withdraw all liquidity and claim all pending reward | function exit( uint16 _pid ) public override whenNotPaused
| function exit( uint16 _pid ) public override whenNotPaused
| 35,954 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.