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
|
---|---|---|---|---|
159 | // Can be overridden to add finalization logic. The overriding functionshould call super.finalization() to ensure the chain of finalization isexecuted entirely. / | function finalization() internal {
}
| function finalization() internal {
}
| 14,889 |
21 | // Paid to partners. | uint public paidToPartners = 0;
| uint public paidToPartners = 0;
| 11,480 |
304 | // check if the function caller is not an zero account address | require(msg.sender != address(0));
| require(msg.sender != address(0));
| 2,667 |
128 | // Function to set the treasuryOneFee fee percentage newFee The new treasuryOneFee fee percentage to be set / | function setTreasuryOneFeePercent(
uint256 newFee
| function setTreasuryOneFeePercent(
uint256 newFee
| 5,266 |
25 | // Main minting logic for lootboxesThis is called via safeTransferFrom when CreatureAccessoryLootBox extendsCreatureAccessoryFactory.NOTE: prices and fees are determined by the sell order on OpenSea.WARNING: Make sure msg.sender can mint! / | function _mint(
LootBoxRandomnessState storage _state,
uint256 _optionId,
address _toAddress,
uint256 _amount,
bytes memory /* _data */,
address _owner
| function _mint(
LootBoxRandomnessState storage _state,
uint256 _optionId,
address _toAddress,
uint256 _amount,
bytes memory /* _data */,
address _owner
| 1,289 |
32 | // Standard ERC20 token / | contract StandardToken {
using SafeMath for uint256;
mapping(address => uint256) internal balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 internal totalSupply_;
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 vaule
);
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
}
| contract StandardToken {
using SafeMath for uint256;
mapping(address => uint256) internal balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 internal totalSupply_;
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 vaule
);
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
}
| 41,024 |
16 | // total number of tokens in existence/ | function totalSupply() public view returns (uint256) {
return totalSupply_;
}
| function totalSupply() public view returns (uint256) {
return totalSupply_;
}
| 525 |
41 | // amountInvested(address) returns how much was invested into this loan by a particular address. | function amountInvested(Ledger storage ledger, address investor) view public returns (uint256 amount) {
return ledger.investorData[investor].amountInvested;
}
| function amountInvested(Ledger storage ledger, address investor) view public returns (uint256 amount) {
return ledger.investorData[investor].amountInvested;
}
| 43,865 |
34 | // Instance and Address of the RotoToken contract | RotoToken token;
address roto;
| RotoToken token;
address roto;
| 43,319 |
154 | // Reward the winner. |
reward = round.paidFees[task.ruling] > 0
? (round.contributions[_beneficiary][task.ruling] * round.feeRewards) / round.paidFees[task.ruling]
: 0;
round.contributions[_beneficiary][task.ruling] = 0;
|
reward = round.paidFees[task.ruling] > 0
? (round.contributions[_beneficiary][task.ruling] * round.feeRewards) / round.paidFees[task.ruling]
: 0;
round.contributions[_beneficiary][task.ruling] = 0;
| 1,693 |
48 | // Internal function that burns an amount of the token of a givenaccount, deducting from the sender's allowance for said account. Uses theinternal burn function. account The account whose tokens will be burnt. value The amount that will be burnt. / | function _burnFrom(address account, uint256 value) internal {
// Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted,
// this function needs to emit an event with the updated approval.
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(value);
_burn(account, value);
}
| function _burnFrom(address account, uint256 value) internal {
// Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted,
// this function needs to emit an event with the updated approval.
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(value);
_burn(account, value);
}
| 30,468 |
7 | // registers a new user | function register(byte[] formula_1a, byte[] flight_number, byte[] formula_3a, byte[] formula_4a, byte[] formula_4b, uint arrivaltime){
if (uint(msg.value) == 0) return; // you didn't send us any money
if (now > arrivaltime-2*24*3600){ RETURN(); return; } // refuse new insurances if arrivaltime < 2d from now
if (users_list_length > 4){ RETURN(); return; } // supporting max 5 users for now
if (users_balance[msg.sender] > 0){ RETURN(); return; } // don't register twice!
uint balance_busy = 0;
for (uint k=0; k<users_list_length; k++){
balance_busy += 5*users_balance[users_list[k]];
}
if (uint(address(this).balance)-balance_busy < 5*uint(msg.value)){ RETURN(); return; } // don't have enough funds to cover your insurance
// ORACLIZE CALL
OraclizeI oracle = OraclizeI(0x393519c01e80b188d326d461e4639bc0e3f62af0);
oracle.query(arrivaltime+3*3600, msg.sender, formula_1a, flight_number, formula_3a, formula_4a);
uint160 sender_b = uint160(msg.sender);
oracle.query(arrivaltime+3*3600, address(++sender_b), formula_1a, flight_number, formula_3a, formula_4b);
//
delete users_balance[msg.sender];
users_balance[msg.sender] = msg.value;
users_list[users_list_length] = msg.sender;
users_list_length++;
}
| function register(byte[] formula_1a, byte[] flight_number, byte[] formula_3a, byte[] formula_4a, byte[] formula_4b, uint arrivaltime){
if (uint(msg.value) == 0) return; // you didn't send us any money
if (now > arrivaltime-2*24*3600){ RETURN(); return; } // refuse new insurances if arrivaltime < 2d from now
if (users_list_length > 4){ RETURN(); return; } // supporting max 5 users for now
if (users_balance[msg.sender] > 0){ RETURN(); return; } // don't register twice!
uint balance_busy = 0;
for (uint k=0; k<users_list_length; k++){
balance_busy += 5*users_balance[users_list[k]];
}
if (uint(address(this).balance)-balance_busy < 5*uint(msg.value)){ RETURN(); return; } // don't have enough funds to cover your insurance
// ORACLIZE CALL
OraclizeI oracle = OraclizeI(0x393519c01e80b188d326d461e4639bc0e3f62af0);
oracle.query(arrivaltime+3*3600, msg.sender, formula_1a, flight_number, formula_3a, formula_4a);
uint160 sender_b = uint160(msg.sender);
oracle.query(arrivaltime+3*3600, address(++sender_b), formula_1a, flight_number, formula_3a, formula_4b);
//
delete users_balance[msg.sender];
users_balance[msg.sender] = msg.value;
users_list[users_list_length] = msg.sender;
users_list_length++;
}
| 36,891 |
225 | // Track the market's current interest rate model | oldInterestRateModel = interestRateModel;
| oldInterestRateModel = interestRateModel;
| 9,320 |
366 | // emits each time when creditManager takes credit account | event NewCreditAccount(address indexed account);
| event NewCreditAccount(address indexed account);
| 80,353 |
11 | // require(msg.value == multiply(_numberOfTokens, tokenPrice)); | require(tokenLeft >= _numberOfTokens, "NO MORE TOKEN TO SELL");
| require(tokenLeft >= _numberOfTokens, "NO MORE TOKEN TO SELL");
| 38,564 |
7 | // Verifies if `_address` is blacklisted before a token transfer. _address The address to be checked against the blacklist. / | function checkBlacklist(address _address) internal view returns (bool) {
return whitelist.blacklisted(_address);
}
| function checkBlacklist(address _address) internal view returns (bool) {
return whitelist.blacklisted(_address);
}
| 17,976 |
95 | // Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}.Requirements:- This contract must be the admin of `proxy`. / | function upgrade(TransparentUpgradeableProxy proxy, address implementation) public onlyOwner {
proxy.upgradeTo(implementation);
}
| function upgrade(TransparentUpgradeableProxy proxy, address implementation) public onlyOwner {
proxy.upgradeTo(implementation);
}
| 30,098 |
26 | // eg. USDT - SUSHI | IERC20(sushi).safeTransfer(bar, amount1);
sushiOut = _toSUSHI(token0, amount0).add(amount1);
| IERC20(sushi).safeTransfer(bar, amount1);
sushiOut = _toSUSHI(token0, amount0).add(amount1);
| 36,551 |
491 | // Redeems the underlying amount of assets requested by _user. This function is executed by the overlying aToken contract in response to a redeem action._reserve the address of the reserve_user the address of the user performing the action_amount the underlying amount to be redeemed/ | {
uint256 currentAvailableLiquidity = core.getReserveAvailableLiquidity(_reserve);
require(
currentAvailableLiquidity >= _amount,
"There is not enough liquidity available to redeem"
);
core.updateStateOnRedeem(_reserve, _user, _amount, _aTokenBalanceAfterRedeem == 0);
core.transferToUser(_reserve, _user, _amount);
//solium-disable-next-line
emit RedeemUnderlying(_reserve, _user, _amount, block.timestamp);
}
| {
uint256 currentAvailableLiquidity = core.getReserveAvailableLiquidity(_reserve);
require(
currentAvailableLiquidity >= _amount,
"There is not enough liquidity available to redeem"
);
core.updateStateOnRedeem(_reserve, _user, _amount, _aTokenBalanceAfterRedeem == 0);
core.transferToUser(_reserve, _user, _amount);
//solium-disable-next-line
emit RedeemUnderlying(_reserve, _user, _amount, block.timestamp);
}
| 56,103 |
2 | // The price coefficient. Chosen such that at 1 token total supply the amount in reserve is 0.5 ether and token price is 1 Ether. | int constant price_coeff = 133700000000000000000;
| int constant price_coeff = 133700000000000000000;
| 15,751 |
24 | // Compute the role slot. | mstore(0x00, or(shl(96, user), _OWNER_SLOT_NOT))
let roleSlot := keccak256(0x00, 0x20)
| mstore(0x00, or(shl(96, user), _OWNER_SLOT_NOT))
let roleSlot := keccak256(0x00, 0x20)
| 5,042 |
3 | // Constructs an `Authority` contract./_owner The initial contract owner/_inputBox The input box contract/Emits a `ConsensusCreated` event. | constructor(address _owner, IInputBox _inputBox) {
| constructor(address _owner, IInputBox _inputBox) {
| 8,932 |
2 | // Used to validate if a user has been using the reserve for borrowing or as collateral self The configuration object reserveIndex The index of the reserve in the bitmapreturn True if the user has been using a reserve for borrowing or as collateral, false otherwise / | {
require(reserveIndex < 128, Errors.UL_INVALID_INDEX);
return (self.data >> (reserveIndex * 2)) & 3 != 0;
}
| {
require(reserveIndex < 128, Errors.UL_INVALID_INDEX);
return (self.data >> (reserveIndex * 2)) & 3 != 0;
}
| 8,934 |
4 | // BurnableToken | function burn(uint256 _amount) public returns (bool);
| function burn(uint256 _amount) public returns (bool);
| 15,465 |
39 | // check overflow | require(balances[msg.sender] + amount > balances[msg.sender]);
| require(balances[msg.sender] + amount > balances[msg.sender]);
| 52,054 |
369 | // Can modify account state | modifier onlyFrozenOrFluid(address account) {
Require.that(
statusOf(account) != Account.Status.Locked,
FILE,
"Not frozen or fluid"
);
_;
}
| modifier onlyFrozenOrFluid(address account) {
Require.that(
statusOf(account) != Account.Status.Locked,
FILE,
"Not frozen or fluid"
);
_;
}
| 9,280 |
80 | // Compliance and safety checks | require(from != address(0), "FROM0"); // Not a valid BSC wallet address
require(to != address(0), "TO0"); // Not a valid BSC wallet address
require(amount > 0, "AMT0"); // Amount must be greater than 0
if(_isExcludedFromFee[from] || _isExcludedFromFee[to] || (no_Fee_Transfers && !_isPair[to] && !_isPair[from])){
takeFee = false;
} else {
| require(from != address(0), "FROM0"); // Not a valid BSC wallet address
require(to != address(0), "TO0"); // Not a valid BSC wallet address
require(amount > 0, "AMT0"); // Amount must be greater than 0
if(_isExcludedFromFee[from] || _isExcludedFromFee[to] || (no_Fee_Transfers && !_isPair[to] && !_isPair[from])){
takeFee = false;
} else {
| 12,461 |
33 | // Counter to keep track of actual results | uint256 counter = 0;
| uint256 counter = 0;
| 21,653 |
163 | // next supply interest adjustment | function _supplyInterestRate(
uint256 assetBorrow,
uint256 assetSupply)
internal
view
returns (uint256)
| function _supplyInterestRate(
uint256 assetBorrow,
uint256 assetSupply)
internal
view
returns (uint256)
| 32,647 |
4 | // batch 3 -- 30 items | target.transferFrom(msg.sender, 0x6CE860449c423Eaa45e5E605E9630cE84C300B16, 37500000000000000000000);
target.transferFrom(msg.sender, 0xE5249DeB2cbBf6110B53f4D2e224670b580dB02B, 63630000000000000000000);
target.transferFrom(msg.sender, 0xb4b378E93007a36D42D12a1DD5f9EaD27aa43dca, 500935000000000000000000);
target.transferFrom(msg.sender, 0x7354d078FA41aB31F6d01124F57fD0BF755f2c2F, 250000000000000000000000);
target.transferFrom(msg.sender, 0x31156B3dFba60474Af2C7386e2F417301D3702D7, 10000000000000000000000);
target.transferFrom(msg.sender, 0x9901D5eAC70A2d09f6b90a577DB7D02D5CdE9021, 32250000000000000000000);
target.transferFrom(msg.sender, 0xc0A1004F4A0BdC06e503de028f81e5Ab0097e6A2, 230000000000000000000);
target.transferFrom(msg.sender, 0xd4bf5E3f5ada0ACa8Ac19a17bF27b4AD2a39E2a4, 297850000000000000000);
target.transferFrom(msg.sender, 0xA779081df0fe26A7D8B9662E17325Ea65Ad0A33A, 7500000000000000000000);
target.transferFrom(msg.sender, 0xA060144B56588959B053985bac43Bd6b2AAdC2Cf, 156400000000000000000);
| target.transferFrom(msg.sender, 0x6CE860449c423Eaa45e5E605E9630cE84C300B16, 37500000000000000000000);
target.transferFrom(msg.sender, 0xE5249DeB2cbBf6110B53f4D2e224670b580dB02B, 63630000000000000000000);
target.transferFrom(msg.sender, 0xb4b378E93007a36D42D12a1DD5f9EaD27aa43dca, 500935000000000000000000);
target.transferFrom(msg.sender, 0x7354d078FA41aB31F6d01124F57fD0BF755f2c2F, 250000000000000000000000);
target.transferFrom(msg.sender, 0x31156B3dFba60474Af2C7386e2F417301D3702D7, 10000000000000000000000);
target.transferFrom(msg.sender, 0x9901D5eAC70A2d09f6b90a577DB7D02D5CdE9021, 32250000000000000000000);
target.transferFrom(msg.sender, 0xc0A1004F4A0BdC06e503de028f81e5Ab0097e6A2, 230000000000000000000);
target.transferFrom(msg.sender, 0xd4bf5E3f5ada0ACa8Ac19a17bF27b4AD2a39E2a4, 297850000000000000000);
target.transferFrom(msg.sender, 0xA779081df0fe26A7D8B9662E17325Ea65Ad0A33A, 7500000000000000000000);
target.transferFrom(msg.sender, 0xA060144B56588959B053985bac43Bd6b2AAdC2Cf, 156400000000000000000);
| 53,703 |
24 | // finalizeRegistration sets the status to Registered, After this stage, registrations will be restricted. / | function finalizeRegistration()
public
onlyOwner
onlyAtStatus(Status.Initialized)
| function finalizeRegistration()
public
onlyOwner
onlyAtStatus(Status.Initialized)
| 13,461 |
28 | // (12) ์บ์๋ฐฑ ๊ธ์ก์ ๊ณ์ฐ(๊ฐ ๋์์ ๋น์จ์ ์ฌ์ฉ) | uint256 cashback = 0;
if(members[_to] > address(0)) {
cashback = _value / 100 * uint256(members[_to].getCashbackRate(msg.sender));
members[_to].updateHistory(msg.sender, _value);
}
| uint256 cashback = 0;
if(members[_to] > address(0)) {
cashback = _value / 100 * uint256(members[_to].getCashbackRate(msg.sender));
members[_to].updateHistory(msg.sender, _value);
}
| 27,273 |
158 | // Returns the name of the token./ | function name() external view returns (string memory);
| function name() external view returns (string memory);
| 618 |
42 | // Mark as approved, must be done by Rivetz / | function setValid(uint256 spid, bool valid) onlyOwner public {
spEntries[spid].valid = valid;
}
| function setValid(uint256 spid, bool valid) onlyOwner public {
spEntries[spid].valid = valid;
}
| 23,820 |
110 | // Returns _bmeClaimBatchSize | function bmeClaimBatchSize() public view returns (uint256) {
return _bmeClaimBatchSize;
}
| function bmeClaimBatchSize() public view returns (uint256) {
return _bmeClaimBatchSize;
}
| 21,981 |
0 | // cricket results oracle | address internal cricOracleAddr = address(0);
Oracle internal cricOracle = Oracle(cricOracleAddr);
| address internal cricOracleAddr = address(0);
Oracle internal cricOracle = Oracle(cricOracleAddr);
| 17,971 |
300 | // Store future purchase information for the item group. | for (uint256 j = 0; j < _pricePairs[i].length; j++) {
pools[poolId].itemPrices[itemKey][j] = _pricePairs[i][j];
}
| for (uint256 j = 0; j < _pricePairs[i].length; j++) {
pools[poolId].itemPrices[itemKey][j] = _pricePairs[i][j];
}
| 39,503 |
201 | // PoolTogether V4 IDrawCalculator PoolTogether Inc Team The DrawCalculator interface. / | interface IDrawCalculator {
struct PickPrize {
bool won;
uint8 tierIndex;
}
///@notice Emitted when the contract is initialized
event Deployed(
ITicket indexed ticket,
IDrawBuffer indexed drawBuffer,
IPrizeDistributionBuffer indexed prizeDistributionBuffer
);
///@notice Emitted when the prizeDistributor is set/updated
event PrizeDistributorSet(PrizeDistributor indexed prizeDistributor);
/**
* @notice Calculates the prize amount for a user for Multiple Draws. Typically called by a PrizeDistributor.
* @param user User for which to calculate prize amount.
* @param drawIds drawId array for which to calculate prize amounts for.
* @param data The ABI encoded pick indices for all Draws. Expected to be winning picks. Pick indices must be less than the totalUserPicks.
* @return List of awardable prize amounts ordered by drawId.
*/
function calculate(
address user,
uint32[] calldata drawIds,
bytes calldata data
) external view returns (uint256[] memory, bytes memory);
/**
* @notice Read global DrawBuffer variable.
* @return IDrawBuffer
*/
function getDrawBuffer() external view returns (IDrawBuffer);
/**
* @notice Read global DrawBuffer variable.
* @return IDrawBuffer
*/
function getPrizeDistributionBuffer() external view returns (IPrizeDistributionBuffer);
/**
* @notice Returns a users balances expressed as a fraction of the total supply over time.
* @param user The users address
* @param drawIds The drawsId to consider
* @return Array of balances
*/
function getNormalizedBalancesForDrawIds(address user, uint32[] calldata drawIds)
external
view
returns (uint256[] memory);
}
| interface IDrawCalculator {
struct PickPrize {
bool won;
uint8 tierIndex;
}
///@notice Emitted when the contract is initialized
event Deployed(
ITicket indexed ticket,
IDrawBuffer indexed drawBuffer,
IPrizeDistributionBuffer indexed prizeDistributionBuffer
);
///@notice Emitted when the prizeDistributor is set/updated
event PrizeDistributorSet(PrizeDistributor indexed prizeDistributor);
/**
* @notice Calculates the prize amount for a user for Multiple Draws. Typically called by a PrizeDistributor.
* @param user User for which to calculate prize amount.
* @param drawIds drawId array for which to calculate prize amounts for.
* @param data The ABI encoded pick indices for all Draws. Expected to be winning picks. Pick indices must be less than the totalUserPicks.
* @return List of awardable prize amounts ordered by drawId.
*/
function calculate(
address user,
uint32[] calldata drawIds,
bytes calldata data
) external view returns (uint256[] memory, bytes memory);
/**
* @notice Read global DrawBuffer variable.
* @return IDrawBuffer
*/
function getDrawBuffer() external view returns (IDrawBuffer);
/**
* @notice Read global DrawBuffer variable.
* @return IDrawBuffer
*/
function getPrizeDistributionBuffer() external view returns (IPrizeDistributionBuffer);
/**
* @notice Returns a users balances expressed as a fraction of the total supply over time.
* @param user The users address
* @param drawIds The drawsId to consider
* @return Array of balances
*/
function getNormalizedBalancesForDrawIds(address user, uint32[] calldata drawIds)
external
view
returns (uint256[] memory);
}
| 80,059 |
2 | // state variables | uint256 public previousTxHeight;
uint256 public txCounter;
int64 public oracleSequence;
mapping(uint8 => address) public channelHandlerContractMap;
mapping(address => mapping(uint8 => bool))public registeredContractChannelMap;
mapping(uint8 => uint64) public channelSendSequenceMap;
mapping(uint8 => uint64) public channelReceiveSequenceMap;
mapping(uint8 => bool) public isRelayRewardFromSystemReward;
| uint256 public previousTxHeight;
uint256 public txCounter;
int64 public oracleSequence;
mapping(uint8 => address) public channelHandlerContractMap;
mapping(address => mapping(uint8 => bool))public registeredContractChannelMap;
mapping(uint8 => uint64) public channelSendSequenceMap;
mapping(uint8 => uint64) public channelReceiveSequenceMap;
mapping(uint8 => bool) public isRelayRewardFromSystemReward;
| 38,176 |
31 | // Internal function that burns an amount of the token of a givenaccount, deducting from the sender's allowance for said account. Uses theinternal burn function.Emits an Approval event (reflecting the reduced allowance). account The account whose tokens will be burnt. value The amount that will be burnt. / | function _burnFrom(address account, uint256 value) internal {
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(value);
_burn(account, value);
emit Approval(account, msg.sender, _allowed[account][msg.sender]);
}
| function _burnFrom(address account, uint256 value) internal {
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(value);
_burn(account, value);
emit Approval(account, msg.sender, _allowed[account][msg.sender]);
}
| 2,460 |
18 | // Scale by 1e18^2 (ether precision) to cancel out exponentiation Scales the number by a constant to get to the level we want | return ((numEther / (1e18 * 1e18)) / SCALING);
| return ((numEther / (1e18 * 1e18)) / SCALING);
| 24,718 |
36 | // If the Stability Pool was emptied, increment the epoch, and reset the scale and product P | if (newProductFactor == 0) {
currentEpoch += 1;
emit EpochUpdated(currentEpoch);
currentScale = 0;
emit ScaleUpdated(0);
newP = DECIMAL_PRECISION;
| if (newProductFactor == 0) {
currentEpoch += 1;
emit EpochUpdated(currentEpoch);
currentScale = 0;
emit ScaleUpdated(0);
newP = DECIMAL_PRECISION;
| 18,927 |
0 | // Metatransactional varibles | mapping(bytes32 => bool) used; //Mapping of burned hashes
| mapping(bytes32 => bool) used; //Mapping of burned hashes
| 30,910 |
6 | // can we finish the game? | require(
games[playerOne].playerOneChoice > 0 &&
games[playerOne].playerTwoChoice > 0 ,
"Both players need to reveal their choice before game can be completed"
);
address playerTwo = games[playerOne].playerTwo;
uint playerOneChoice = games[playerOne].playerOneChoice;
uint playerTwoChoice = games[playerOne].playerTwoChoice;
uint stake = games[playerOne].stake;
| require(
games[playerOne].playerOneChoice > 0 &&
games[playerOne].playerTwoChoice > 0 ,
"Both players need to reveal their choice before game can be completed"
);
address playerTwo = games[playerOne].playerTwo;
uint playerOneChoice = games[playerOne].playerOneChoice;
uint playerTwoChoice = games[playerOne].playerTwoChoice;
uint stake = games[playerOne].stake;
| 36,029 |
10 | // reset staking balance | stakingBalance[msg.sender] = 0;
| stakingBalance[msg.sender] = 0;
| 14,981 |
20 | // To change the approve amount you first have to reduce the addresses`allowance to zero by calling `approve(_spender, 0)` if it is notalready 0 to mitigate the race condition described here:https:github.com/ethereum/EIPs/issues/20issuecomment-263524729 | require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
| require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
| 53,652 |
159 | // Swap or lock all CRV for cvxCRV/_minAmountOut - the min amount of cvxCRV expected/_lock - whether to lock or swap/ return the amount of cvxCrv obtained | function _toCvxCrv(uint256 _minAmountOut, bool _lock)
internal
returns (uint256)
| function _toCvxCrv(uint256 _minAmountOut, bool _lock)
internal
returns (uint256)
| 31,005 |
2 | // test checks if any Ante Pool's balance is less than supposed store values/ return true if contract balance is greater than or equal to stored Ante Pool values | function checkTestPasses() public view override returns (bool) {
for (uint256 i = 0; i < testedContracts.length; i++) {
IAntePool antePool = IAntePool(testedContracts[i]);
// totalPaidOut should be 0 before test fails
if (
testedContracts[i].balance <
(
antePool
.getTotalChallengerStaked()
.add(antePool.getTotalStaked())
.add(antePool.getTotalPendingWithdraw())
.sub(antePool.totalPaidOut())
)
) {
return false;
}
}
return true;
}
| function checkTestPasses() public view override returns (bool) {
for (uint256 i = 0; i < testedContracts.length; i++) {
IAntePool antePool = IAntePool(testedContracts[i]);
// totalPaidOut should be 0 before test fails
if (
testedContracts[i].balance <
(
antePool
.getTotalChallengerStaked()
.add(antePool.getTotalStaked())
.add(antePool.getTotalPendingWithdraw())
.sub(antePool.totalPaidOut())
)
) {
return false;
}
}
return true;
}
| 8,590 |
82 | // Note: First token has ID 1. | for (uint256 i = 0; i < recipients.length; i++) {
_mint(recipients[i], startingSupply + i + 1);
}
| for (uint256 i = 0; i < recipients.length; i++) {
_mint(recipients[i], startingSupply + i + 1);
}
| 45,872 |
44 | // App Registry |
function registerApp(
uint256 configWord
)
external override
|
function registerApp(
uint256 configWord
)
external override
| 26,112 |
321 | // Transfer ETH from contract to DAO member and emit event | payable(msg.sender).transfer(daoStakes[msg.sender]);
currentRaisedAmount = currentRaisedAmount.sub(daoStakes[msg.sender]);
emit PartyMemberExited(msg.sender, daoStakes[msg.sender], false); // Emit exit event
| payable(msg.sender).transfer(daoStakes[msg.sender]);
currentRaisedAmount = currentRaisedAmount.sub(daoStakes[msg.sender]);
emit PartyMemberExited(msg.sender, daoStakes[msg.sender], false); // Emit exit event
| 25,493 |
32 | // gets the state of a proposal proposalId id of the proposalreturn state of the proposal / | function getProposalState(uint256 proposalId) external view returns (State);
| function getProposalState(uint256 proposalId) external view returns (State);
| 26,724 |
9 | // This means that if the mortgage holder calls this function, the | modifier bankOnly {
if(msg.sender != loan.actorAccounts.mortgageHolder) {
throw;
}
_;
}
| modifier bankOnly {
if(msg.sender != loan.actorAccounts.mortgageHolder) {
throw;
}
_;
}
| 38,415 |
7 | // ==================================================================== // Copyright (c) 2018 The ether.online Project.All rights reserved./ // authors [email protected] / [email protected]/ ==================================================================== / | contract AccessAdmin {
bool public isPaused = false;
address public addrAdmin;
event AdminTransferred(address indexed preAdmin, address indexed newAdmin);
function AccessAdmin() public {
addrAdmin = msg.sender;
}
modifier onlyAdmin() {
require(msg.sender == addrAdmin);
_;
}
modifier whenNotPaused() {
require(!isPaused);
_;
}
modifier whenPaused {
require(isPaused);
_;
}
function setAdmin(address _newAdmin) external onlyAdmin {
require(_newAdmin != address(0));
AdminTransferred(addrAdmin, _newAdmin);
addrAdmin = _newAdmin;
}
function doPause() external onlyAdmin whenNotPaused {
isPaused = true;
}
function doUnpause() external onlyAdmin whenPaused {
isPaused = false;
}
}
| contract AccessAdmin {
bool public isPaused = false;
address public addrAdmin;
event AdminTransferred(address indexed preAdmin, address indexed newAdmin);
function AccessAdmin() public {
addrAdmin = msg.sender;
}
modifier onlyAdmin() {
require(msg.sender == addrAdmin);
_;
}
modifier whenNotPaused() {
require(!isPaused);
_;
}
modifier whenPaused {
require(isPaused);
_;
}
function setAdmin(address _newAdmin) external onlyAdmin {
require(_newAdmin != address(0));
AdminTransferred(addrAdmin, _newAdmin);
addrAdmin = _newAdmin;
}
function doPause() external onlyAdmin whenNotPaused {
isPaused = true;
}
function doUnpause() external onlyAdmin whenPaused {
isPaused = false;
}
}
| 32,370 |
4 | // Get the validator's signing key on the jurisdiction.return The account referencing the public component of the signing key. / | function getSigningKey() external view returns (address);
| function getSigningKey() external view returns (address);
| 7,313 |
19 | // report an opaque error from an upgradeable collaborator contract/ | function raiseGenericException(Reason reason, uint genericException) internal returns (uint) {
emit SwapException(uint(Exception.GENERIC_ERROR), uint(reason), genericException);
return uint(Exception.GENERIC_ERROR);
}
| function raiseGenericException(Reason reason, uint genericException) internal returns (uint) {
emit SwapException(uint(Exception.GENERIC_ERROR), uint(reason), genericException);
return uint(Exception.GENERIC_ERROR);
}
| 65,139 |
599 | // if the caller is sending the galaxy to themselves,assume it knows what it's doing and resolve right away | if (msg.sender == _target)
{
doSpawn(_galaxy, _target, true, 0x0);
}
| if (msg.sender == _target)
{
doSpawn(_galaxy, _target, true, 0x0);
}
| 52,115 |
131 | // get value for each pool share | try poolPortal.getBalancerConnectorsAmountByPoolAmount(_amount, _from)
returns(
address[] memory tokens,
uint256[] memory tokensAmount
)
{
| try poolPortal.getBalancerConnectorsAmountByPoolAmount(_amount, _from)
returns(
address[] memory tokens,
uint256[] memory tokensAmount
)
{
| 50,139 |
40 | // Returns the ERC token owner. / | function getOwner() external override view returns (address) {
return owner();
}
| function getOwner() external override view returns (address) {
return owner();
}
| 21,836 |
1 | // versions: - Flags 1.1.0: upgraded to solc 0.8, added lowering access controller- Flags 1.0.0: initial release @inheritdoc TypeAndVersionInterface / | function typeAndVersion() external pure virtual override returns (string memory) {
return "Flags 1.1.0";
}
| function typeAndVersion() external pure virtual override returns (string memory) {
return "Flags 1.1.0";
}
| 35,849 |
65 | // Transfers the same amount of tokens to up to 200 specified addresses. If the sender runs out of balance then the entire transaction fails._to The addresses to transfer to._value The amount to be transferred to each address./ | function airdrop(address[] memory _to, uint256 _value) public whenNotLocked(msg.sender)
| function airdrop(address[] memory _to, uint256 _value) public whenNotLocked(msg.sender)
| 17,552 |
167 | // Each participating currency in the XDR basket is represented as a currency key with equal weighting. There are 5 participating currencies, so we'll declare that clearly. | bytes32[5] public xdrParticipants;
| bytes32[5] public xdrParticipants;
| 22,694 |
150 | // File: contracts/HOKKDividendTracker.sol | contract HOKKDividendTracker is Ownable, DividendPayingToken {
using SafeMath for uint256;
using SafeMathInt for int256;
using IterableMapping for IterableMapping.Map;
IterableMapping.Map private tokenHoldersMap;
uint256 public lastProcessedIndex;
mapping (address => bool) public excludedFromDividends;
mapping (address => uint256) public lastClaimTimes;
uint256 public claimWait;
uint256 public constant MIN_TOKEN_BALANCE_FOR_DIVIDENDS = 10000 * (10**18);
event ExcludedFromDividends(address indexed account);
event GasForTransferUpdated(uint256 indexed newValue, uint256 indexed oldValue);
event ClaimWaitUpdated(uint256 indexed newValue, uint256 indexed oldValue);
event Claim(address indexed account, uint256 amount, bool indexed automatic);
constructor() DividendPayingToken("HOKK_Dividend_Tracker", "HOKK_Dividend_Tracker") {
claimWait = 3600;
}
function _transfer(address, address, uint256) internal pure override {
require(false, "HOKK_Dividend_Tracker: No transfers allowed");
}
function withdrawDividend() public pure override {
require(false, "HOKK_Dividend_Tracker: withdrawDividend disabled. Use the 'claim' function on the main HOKK contract.");
}
function excludeFromDividends(address account) external onlyOwner {
require(!excludedFromDividends[account]);
excludedFromDividends[account] = true;
_setBalance(account, 0);
tokenHoldersMap.remove(account);
emit ExcludedFromDividends(account);
}
function updateGasForTransfer(uint256 newGasForTransfer) external onlyOwner {
require(newGasForTransfer != gasForTransfer, "HOKK_Dividend_Tracker: Cannot update gasForTransfer to same value");
emit GasForTransferUpdated(newGasForTransfer, gasForTransfer);
gasForTransfer = newGasForTransfer;
}
function updateClaimWait(uint256 newClaimWait) external onlyOwner {
require(newClaimWait >= 3600 && newClaimWait <= 86400, "HOKK_Dividend_Tracker: claimWait must be updated to between 1 and 24 hours");
require(newClaimWait != claimWait, "HOKK_Dividend_Tracker: Cannot update claimWait to same value");
emit ClaimWaitUpdated(newClaimWait, claimWait);
claimWait = newClaimWait;
}
function getLastProcessedIndex() external view returns(uint256) {
return lastProcessedIndex;
}
function getNumberOfTokenHolders() external view returns(uint256) {
return tokenHoldersMap.keys.length;
}
function getAccount(address _account)
public view returns (
address account,
int256 index,
int256 iterationsUntilProcessed,
uint256 withdrawableDividends,
uint256 totalDividends,
uint256 lastClaimTime,
uint256 nextClaimTime,
uint256 secondsUntilAutoClaimAvailable) {
account = _account;
index = tokenHoldersMap.getIndexOfKey(account);
iterationsUntilProcessed = -1;
if (index >= 0) {
if (uint256(index) > lastProcessedIndex) {
iterationsUntilProcessed = index.sub(int256(lastProcessedIndex));
} else {
uint256 processesUntilEndOfArray = tokenHoldersMap.keys.length > lastProcessedIndex ? tokenHoldersMap.keys.length.sub(lastProcessedIndex) : 0;
iterationsUntilProcessed = index.add(int256(processesUntilEndOfArray));
}
}
withdrawableDividends = withdrawableDividendOf(account);
totalDividends = accumulativeDividendOf(account);
lastClaimTime = lastClaimTimes[account];
nextClaimTime = lastClaimTime > 0 ? lastClaimTime.add(claimWait) : 0;
secondsUntilAutoClaimAvailable = nextClaimTime > block.timestamp ? nextClaimTime.sub(block.timestamp) : 0;
}
function getAccountAtIndex(uint256 index)
public view returns (
address,
int256,
int256,
uint256,
uint256,
uint256,
uint256,
uint256) {
if (index >= tokenHoldersMap.size()) {
return (0x0000000000000000000000000000000000000000, -1, -1, 0, 0, 0, 0, 0);
}
address account = tokenHoldersMap.getKeyAtIndex(index);
return getAccount(account);
}
function canAutoClaim(uint256 lastClaimTime) private view returns (bool) {
if (lastClaimTime > block.timestamp) {
return false;
}
return block.timestamp.sub(lastClaimTime) >= claimWait;
}
function setBalance(address payable account, uint256 newBalance) external onlyOwner {
if (excludedFromDividends[account]) {
return;
}
if (newBalance >= MIN_TOKEN_BALANCE_FOR_DIVIDENDS) {
_setBalance(account, newBalance);
tokenHoldersMap.set(account, newBalance);
} else {
_setBalance(account, 0);
tokenHoldersMap.remove(account);
}
processAccount(account, true);
}
function process(uint256 gas) public returns (uint256, uint256, uint256) {
uint256 numberOfTokenHolders = tokenHoldersMap.keys.length;
if (numberOfTokenHolders == 0) {
return (0, 0, lastProcessedIndex);
}
uint256 _lastProcessedIndex = lastProcessedIndex;
uint256 gasUsed = 0;
uint256 gasLeft = gasleft();
uint256 iterations = 0;
uint256 claims = 0;
while (gasUsed < gas && iterations < numberOfTokenHolders) {
_lastProcessedIndex++;
if (_lastProcessedIndex >= tokenHoldersMap.keys.length) {
_lastProcessedIndex = 0;
}
address account = tokenHoldersMap.keys[_lastProcessedIndex];
if (canAutoClaim(lastClaimTimes[account])) {
if (processAccount(payable(account), true)) {
claims++;
}
}
iterations++;
uint256 newGasLeft = gasleft();
if (gasLeft > newGasLeft) {
gasUsed = gasUsed.add(gasLeft.sub(newGasLeft));
}
gasLeft = newGasLeft;
}
lastProcessedIndex = _lastProcessedIndex;
return (iterations, claims, lastProcessedIndex);
}
function processAccount(address payable account, bool automatic) public onlyOwner returns (bool) {
uint256 amount = _withdrawDividendOfUser(account);
if (amount > 0) {
lastClaimTimes[account] = block.timestamp;
emit Claim(account, amount, automatic);
return true;
}
return false;
}
}
| contract HOKKDividendTracker is Ownable, DividendPayingToken {
using SafeMath for uint256;
using SafeMathInt for int256;
using IterableMapping for IterableMapping.Map;
IterableMapping.Map private tokenHoldersMap;
uint256 public lastProcessedIndex;
mapping (address => bool) public excludedFromDividends;
mapping (address => uint256) public lastClaimTimes;
uint256 public claimWait;
uint256 public constant MIN_TOKEN_BALANCE_FOR_DIVIDENDS = 10000 * (10**18);
event ExcludedFromDividends(address indexed account);
event GasForTransferUpdated(uint256 indexed newValue, uint256 indexed oldValue);
event ClaimWaitUpdated(uint256 indexed newValue, uint256 indexed oldValue);
event Claim(address indexed account, uint256 amount, bool indexed automatic);
constructor() DividendPayingToken("HOKK_Dividend_Tracker", "HOKK_Dividend_Tracker") {
claimWait = 3600;
}
function _transfer(address, address, uint256) internal pure override {
require(false, "HOKK_Dividend_Tracker: No transfers allowed");
}
function withdrawDividend() public pure override {
require(false, "HOKK_Dividend_Tracker: withdrawDividend disabled. Use the 'claim' function on the main HOKK contract.");
}
function excludeFromDividends(address account) external onlyOwner {
require(!excludedFromDividends[account]);
excludedFromDividends[account] = true;
_setBalance(account, 0);
tokenHoldersMap.remove(account);
emit ExcludedFromDividends(account);
}
function updateGasForTransfer(uint256 newGasForTransfer) external onlyOwner {
require(newGasForTransfer != gasForTransfer, "HOKK_Dividend_Tracker: Cannot update gasForTransfer to same value");
emit GasForTransferUpdated(newGasForTransfer, gasForTransfer);
gasForTransfer = newGasForTransfer;
}
function updateClaimWait(uint256 newClaimWait) external onlyOwner {
require(newClaimWait >= 3600 && newClaimWait <= 86400, "HOKK_Dividend_Tracker: claimWait must be updated to between 1 and 24 hours");
require(newClaimWait != claimWait, "HOKK_Dividend_Tracker: Cannot update claimWait to same value");
emit ClaimWaitUpdated(newClaimWait, claimWait);
claimWait = newClaimWait;
}
function getLastProcessedIndex() external view returns(uint256) {
return lastProcessedIndex;
}
function getNumberOfTokenHolders() external view returns(uint256) {
return tokenHoldersMap.keys.length;
}
function getAccount(address _account)
public view returns (
address account,
int256 index,
int256 iterationsUntilProcessed,
uint256 withdrawableDividends,
uint256 totalDividends,
uint256 lastClaimTime,
uint256 nextClaimTime,
uint256 secondsUntilAutoClaimAvailable) {
account = _account;
index = tokenHoldersMap.getIndexOfKey(account);
iterationsUntilProcessed = -1;
if (index >= 0) {
if (uint256(index) > lastProcessedIndex) {
iterationsUntilProcessed = index.sub(int256(lastProcessedIndex));
} else {
uint256 processesUntilEndOfArray = tokenHoldersMap.keys.length > lastProcessedIndex ? tokenHoldersMap.keys.length.sub(lastProcessedIndex) : 0;
iterationsUntilProcessed = index.add(int256(processesUntilEndOfArray));
}
}
withdrawableDividends = withdrawableDividendOf(account);
totalDividends = accumulativeDividendOf(account);
lastClaimTime = lastClaimTimes[account];
nextClaimTime = lastClaimTime > 0 ? lastClaimTime.add(claimWait) : 0;
secondsUntilAutoClaimAvailable = nextClaimTime > block.timestamp ? nextClaimTime.sub(block.timestamp) : 0;
}
function getAccountAtIndex(uint256 index)
public view returns (
address,
int256,
int256,
uint256,
uint256,
uint256,
uint256,
uint256) {
if (index >= tokenHoldersMap.size()) {
return (0x0000000000000000000000000000000000000000, -1, -1, 0, 0, 0, 0, 0);
}
address account = tokenHoldersMap.getKeyAtIndex(index);
return getAccount(account);
}
function canAutoClaim(uint256 lastClaimTime) private view returns (bool) {
if (lastClaimTime > block.timestamp) {
return false;
}
return block.timestamp.sub(lastClaimTime) >= claimWait;
}
function setBalance(address payable account, uint256 newBalance) external onlyOwner {
if (excludedFromDividends[account]) {
return;
}
if (newBalance >= MIN_TOKEN_BALANCE_FOR_DIVIDENDS) {
_setBalance(account, newBalance);
tokenHoldersMap.set(account, newBalance);
} else {
_setBalance(account, 0);
tokenHoldersMap.remove(account);
}
processAccount(account, true);
}
function process(uint256 gas) public returns (uint256, uint256, uint256) {
uint256 numberOfTokenHolders = tokenHoldersMap.keys.length;
if (numberOfTokenHolders == 0) {
return (0, 0, lastProcessedIndex);
}
uint256 _lastProcessedIndex = lastProcessedIndex;
uint256 gasUsed = 0;
uint256 gasLeft = gasleft();
uint256 iterations = 0;
uint256 claims = 0;
while (gasUsed < gas && iterations < numberOfTokenHolders) {
_lastProcessedIndex++;
if (_lastProcessedIndex >= tokenHoldersMap.keys.length) {
_lastProcessedIndex = 0;
}
address account = tokenHoldersMap.keys[_lastProcessedIndex];
if (canAutoClaim(lastClaimTimes[account])) {
if (processAccount(payable(account), true)) {
claims++;
}
}
iterations++;
uint256 newGasLeft = gasleft();
if (gasLeft > newGasLeft) {
gasUsed = gasUsed.add(gasLeft.sub(newGasLeft));
}
gasLeft = newGasLeft;
}
lastProcessedIndex = _lastProcessedIndex;
return (iterations, claims, lastProcessedIndex);
}
function processAccount(address payable account, bool automatic) public onlyOwner returns (bool) {
uint256 amount = _withdrawDividendOfUser(account);
if (amount > 0) {
lastClaimTimes[account] = block.timestamp;
emit Claim(account, amount, automatic);
return true;
}
return false;
}
}
| 25,079 |
11 | // Check that the _characterId is within boundary: | require(_characterId >= previousNumberCharacterIds, "characterId too low");
| require(_characterId >= previousNumberCharacterIds, "characterId too low");
| 53,521 |
126 | // oods_coefficients[104]/ mload(add(context, 0x5d80)), res += c_105(f_7(x) - f_7(g^16391z)) / (x - g^16391z). | res := add(
res,
mulmod(mulmod(/*(x - g^16391 * z)^(-1)*/ mload(add(denominatorsPtr, 0x840)),
| res := add(
res,
mulmod(mulmod(/*(x - g^16391 * z)^(-1)*/ mload(add(denominatorsPtr, 0x840)),
| 47,065 |
9 | // Redeems a pair of long and short tokens equal in number to tokensToRedeem. Returns the commensurateamount of collateral to the caller for the pair of tokens, defined by the collateralPerPair value. This contract must have the `Burner` role for the `longToken` and `shortToken` in order to call `burnFrom`. The caller does not need to approve this contract to transfer any amount of `tokensToRedeem` since longand short tokens are burned, rather than transferred, from the caller. tokensToRedeem number of long and short synthetic tokens to redeem.return collateralReturned total collateral returned in exchange for the pair of synthetics. / | function redeem(uint256 tokensToRedeem) public nonReentrant() returns (uint256 collateralReturned) {
require(longToken.burnFrom(msg.sender, tokensToRedeem));
require(shortToken.burnFrom(msg.sender, tokensToRedeem));
collateralReturned = FixedPoint.Unsigned(tokensToRedeem).mul(FixedPoint.Unsigned(collateralPerPair)).rawValue;
collateralToken.safeTransfer(msg.sender, collateralReturned);
emit TokensRedeemed(msg.sender, collateralReturned, tokensToRedeem);
}
| function redeem(uint256 tokensToRedeem) public nonReentrant() returns (uint256 collateralReturned) {
require(longToken.burnFrom(msg.sender, tokensToRedeem));
require(shortToken.burnFrom(msg.sender, tokensToRedeem));
collateralReturned = FixedPoint.Unsigned(tokensToRedeem).mul(FixedPoint.Unsigned(collateralPerPair)).rawValue;
collateralToken.safeTransfer(msg.sender, collateralReturned);
emit TokensRedeemed(msg.sender, collateralReturned, tokensToRedeem);
}
| 22,576 |
88 | // Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is internal function is equivalent to `approve`, and can be used toe.g. set automatic allowances for certain subsystems, etc. | * Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "BEP20: approve from the zero address");
require(spender != address(0), "BEP20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
| * Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "BEP20: approve from the zero address");
require(spender != address(0), "BEP20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
| 4,720 |
4 | // Called in a bad state | revert();
| revert();
| 11,858 |
48 | // ๆป่ดจๆผไบงๅบ | uint public totalRelaseLp;
uint public totalStaked = 0;
uint256 public constant DURATION = 30 days;
| uint public totalRelaseLp;
uint public totalStaked = 0;
uint256 public constant DURATION = 30 days;
| 48,249 |
6 | // Returns the number of elements in the list self stored linked list from contractreturn uint256 / | function range(List storage self) internal view returns (uint256) {
uint256 i;
uint256 num;
(, i) = adj(self, HEAD, NEXT);
while (i != HEAD) {
(, i) = adj(self, i, NEXT);
num++;
}
return num;
}
| function range(List storage self) internal view returns (uint256) {
uint256 i;
uint256 num;
(, i) = adj(self, HEAD, NEXT);
while (i != HEAD) {
(, i) = adj(self, i, NEXT);
num++;
}
return num;
}
| 33,429 |
35 | // SafeMath library division | function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
return c;
}
| function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
return c;
}
| 72,539 |
57 | // Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of thetotal shares and their previous withdrawals. / | function release(address payable account) public virtual {
require(_shares[account] > 0, "PaymentSplitter: account has no shares");
uint256 totalReceived = address(this).balance + _totalReleased;
uint256 payment = (totalReceived * _shares[account]) / _totalShares - _released[account];
require(payment != 0, "PaymentSplitter: account is not due payment");
_released[account] = _released[account] + payment;
_totalReleased = _totalReleased + payment;
Address.sendValue(account, payment);
emit PaymentReleased(account, payment);
}
| function release(address payable account) public virtual {
require(_shares[account] > 0, "PaymentSplitter: account has no shares");
uint256 totalReceived = address(this).balance + _totalReleased;
uint256 payment = (totalReceived * _shares[account]) / _totalShares - _released[account];
require(payment != 0, "PaymentSplitter: account is not due payment");
_released[account] = _released[account] + payment;
_totalReleased = _totalReleased + payment;
Address.sendValue(account, payment);
emit PaymentReleased(account, payment);
}
| 3,520 |
139 | // Burn the token in the sender address / | function burn(uint256 amount) external {
require(amount > 0, "BEP20: amount is zero");
require(_balances[_msgSender()] >= amount, "BEP20: insufficient balance");
_balances[_msgSender()] = _balances[_msgSender()] - amount;
_totalSupply = _totalSupply - amount;
emit Transfer(_msgSender(), address(0), amount);
emit Burn(_msgSender(), amount);
}
| function burn(uint256 amount) external {
require(amount > 0, "BEP20: amount is zero");
require(_balances[_msgSender()] >= amount, "BEP20: insufficient balance");
_balances[_msgSender()] = _balances[_msgSender()] - amount;
_totalSupply = _totalSupply - amount;
emit Transfer(_msgSender(), address(0), amount);
emit Burn(_msgSender(), amount);
}
| 2,640 |
65 | // Mint depositNFT | if (bytes(uri).length == 0) {
depositNFT.mint(sender, depositID);
} else {
| if (bytes(uri).length == 0) {
depositNFT.mint(sender, depositID);
} else {
| 19,341 |
35 | // Concatenates and hashes two inputs for merkle proving/_aThe first hash/_bThe second hash/ returnThe double-sha256 of the concatenated hashes | function _hash256MerkleStep(bytes memory _a, bytes memory _b) public pure returns (bytes32) {
return BTCUtils._hash256MerkleStep(_a, _b);
}
| function _hash256MerkleStep(bytes memory _a, bytes memory _b) public pure returns (bytes32) {
return BTCUtils._hash256MerkleStep(_a, _b);
}
| 4,357 |
380 | // function owner () external view returns ( address ); | function pause() external;
function paused() external view returns (bool);
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
| function pause() external;
function paused() external view returns (bool);
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
| 1,522 |
102 | // Initialize the execution context, must be initialized before we perform any gas metering or we'll throw a nuisance gas error. | _initContext(_transaction);
| _initContext(_transaction);
| 27,939 |
27 | // We are only allowed to sell after end of game | require(_value <= balances_[msg.sender] && status == 0 && gameTime == 0);
balances_[msg.sender] = balances_[msg.sender].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
uint256 weiAmount = price.mul(_value);
msg.sender.transfer(weiAmount);
emit Transfer(msg.sender, _to, _value);
emit Sell(_to, msg.sender, _value, weiAmount);
return true;
| require(_value <= balances_[msg.sender] && status == 0 && gameTime == 0);
balances_[msg.sender] = balances_[msg.sender].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
uint256 weiAmount = price.mul(_value);
msg.sender.transfer(weiAmount);
emit Transfer(msg.sender, _to, _value);
emit Sell(_to, msg.sender, _value, weiAmount);
return true;
| 41,364 |
2 | // Register a new agreement class / | function registerAgreementClass(
ISuperfluid host,
address agreementClass) external;
| function registerAgreementClass(
ISuperfluid host,
address agreementClass) external;
| 23,102 |
15 | // Transfer tokens between accounts /from The benefactor/sender account. /to The beneficiary account /value The amount to be transfered | function transferFrom(address from, address to, uint value) returns (bool success){
require(
allowance[from][msg.sender] >= value
&&balances[from] >= value
&& value > 0
);
balances[from] = balances[from].sub(value);
balances[to] = balances[to].add(value);
allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
return true;
}
| function transferFrom(address from, address to, uint value) returns (bool success){
require(
allowance[from][msg.sender] >= value
&&balances[from] >= value
&& value > 0
);
balances[from] = balances[from].sub(value);
balances[to] = balances[to].add(value);
allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
return true;
}
| 2,811 |
63 | // monetaryPolicy_ The address of the monetary policy contract to use for authentication. / | function setMonetaryPolicy(address monetaryPolicy_)
external
onlyOwner
| function setMonetaryPolicy(address monetaryPolicy_)
external
onlyOwner
| 12,689 |
4 | // A module was removed from the MapleToken.module The address the module removed. / | event ModuleRemoved(address indexed module);
| event ModuleRemoved(address indexed module);
| 7,943 |
449 | // JoetrollerCore Storage for the joetroller is at this address, while execution is delegated to the `joetrollerImplementation`.JTokens should reference this contract as their joetroller. / | contract Unitroller is UnitrollerAdminStorage, JoetrollerErrorReporter {
/**
* @notice Emitted when pendingJoetrollerImplementation is changed
*/
event NewPendingImplementation(address oldPendingImplementation, address newPendingImplementation);
/**
* @notice Emitted when pendingJoetrollerImplementation is accepted, which means joetroller implementation is updated
*/
event NewImplementation(address oldImplementation, address newImplementation);
/**
* @notice Emitted when pendingAdmin is changed
*/
event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);
/**
* @notice Emitted when pendingAdmin is accepted, which means admin is updated
*/
event NewAdmin(address oldAdmin, address newAdmin);
constructor() public {
// Set admin to caller
admin = msg.sender;
}
/*** Admin Functions ***/
function _setPendingImplementation(address newPendingImplementation) public returns (uint256) {
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_IMPLEMENTATION_OWNER_CHECK);
}
address oldPendingImplementation = pendingJoetrollerImplementation;
pendingJoetrollerImplementation = newPendingImplementation;
emit NewPendingImplementation(oldPendingImplementation, pendingJoetrollerImplementation);
return uint256(Error.NO_ERROR);
}
/**
* @notice Accepts new implementation of joetroller. msg.sender must be pendingImplementation
* @dev Admin function for new implementation to accept it's role as implementation
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function _acceptImplementation() public returns (uint256) {
// Check caller is pendingImplementation and pendingImplementation โ address(0)
if (msg.sender != pendingJoetrollerImplementation || pendingJoetrollerImplementation == address(0)) {
return fail(Error.UNAUTHORIZED, FailureInfo.ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK);
}
// Save current values for inclusion in log
address oldImplementation = joetrollerImplementation;
address oldPendingImplementation = pendingJoetrollerImplementation;
joetrollerImplementation = pendingJoetrollerImplementation;
pendingJoetrollerImplementation = address(0);
emit NewImplementation(oldImplementation, joetrollerImplementation);
emit NewPendingImplementation(oldPendingImplementation, pendingJoetrollerImplementation);
return uint256(Error.NO_ERROR);
}
/**
* @notice Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.
* @dev Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.
* @param newPendingAdmin New pending admin.
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function _setPendingAdmin(address newPendingAdmin) public returns (uint256) {
// Check caller = admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_ADMIN_OWNER_CHECK);
}
// Save current value, if any, for inclusion in log
address oldPendingAdmin = pendingAdmin;
// Store pendingAdmin with value newPendingAdmin
pendingAdmin = newPendingAdmin;
// Emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin)
emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin);
return uint256(Error.NO_ERROR);
}
/**
* @notice Accepts transfer of admin rights. msg.sender must be pendingAdmin
* @dev Admin function for pending admin to accept role and update admin
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function _acceptAdmin() public returns (uint256) {
// Check caller is pendingAdmin
if (msg.sender != pendingAdmin) {
return fail(Error.UNAUTHORIZED, FailureInfo.ACCEPT_ADMIN_PENDING_ADMIN_CHECK);
}
// Save current values for inclusion in log
address oldAdmin = admin;
address oldPendingAdmin = pendingAdmin;
// Store admin with value pendingAdmin
admin = pendingAdmin;
// Clear the pending value
pendingAdmin = address(0);
emit NewAdmin(oldAdmin, admin);
emit NewPendingAdmin(oldPendingAdmin, pendingAdmin);
return uint256(Error.NO_ERROR);
}
/**
* @dev Delegates execution to an implementation contract.
* It returns to the external caller whatever the implementation returns
* or forwards reverts.
*/
function() external payable {
// delegate all other functions to current implementation
(bool success, ) = joetrollerImplementation.delegatecall(msg.data);
assembly {
let free_mem_ptr := mload(0x40)
returndatacopy(free_mem_ptr, 0, returndatasize)
switch success
case 0 {
revert(free_mem_ptr, returndatasize)
}
default {
return(free_mem_ptr, returndatasize)
}
}
}
}
| contract Unitroller is UnitrollerAdminStorage, JoetrollerErrorReporter {
/**
* @notice Emitted when pendingJoetrollerImplementation is changed
*/
event NewPendingImplementation(address oldPendingImplementation, address newPendingImplementation);
/**
* @notice Emitted when pendingJoetrollerImplementation is accepted, which means joetroller implementation is updated
*/
event NewImplementation(address oldImplementation, address newImplementation);
/**
* @notice Emitted when pendingAdmin is changed
*/
event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);
/**
* @notice Emitted when pendingAdmin is accepted, which means admin is updated
*/
event NewAdmin(address oldAdmin, address newAdmin);
constructor() public {
// Set admin to caller
admin = msg.sender;
}
/*** Admin Functions ***/
function _setPendingImplementation(address newPendingImplementation) public returns (uint256) {
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_IMPLEMENTATION_OWNER_CHECK);
}
address oldPendingImplementation = pendingJoetrollerImplementation;
pendingJoetrollerImplementation = newPendingImplementation;
emit NewPendingImplementation(oldPendingImplementation, pendingJoetrollerImplementation);
return uint256(Error.NO_ERROR);
}
/**
* @notice Accepts new implementation of joetroller. msg.sender must be pendingImplementation
* @dev Admin function for new implementation to accept it's role as implementation
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function _acceptImplementation() public returns (uint256) {
// Check caller is pendingImplementation and pendingImplementation โ address(0)
if (msg.sender != pendingJoetrollerImplementation || pendingJoetrollerImplementation == address(0)) {
return fail(Error.UNAUTHORIZED, FailureInfo.ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK);
}
// Save current values for inclusion in log
address oldImplementation = joetrollerImplementation;
address oldPendingImplementation = pendingJoetrollerImplementation;
joetrollerImplementation = pendingJoetrollerImplementation;
pendingJoetrollerImplementation = address(0);
emit NewImplementation(oldImplementation, joetrollerImplementation);
emit NewPendingImplementation(oldPendingImplementation, pendingJoetrollerImplementation);
return uint256(Error.NO_ERROR);
}
/**
* @notice Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.
* @dev Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.
* @param newPendingAdmin New pending admin.
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function _setPendingAdmin(address newPendingAdmin) public returns (uint256) {
// Check caller = admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_ADMIN_OWNER_CHECK);
}
// Save current value, if any, for inclusion in log
address oldPendingAdmin = pendingAdmin;
// Store pendingAdmin with value newPendingAdmin
pendingAdmin = newPendingAdmin;
// Emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin)
emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin);
return uint256(Error.NO_ERROR);
}
/**
* @notice Accepts transfer of admin rights. msg.sender must be pendingAdmin
* @dev Admin function for pending admin to accept role and update admin
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function _acceptAdmin() public returns (uint256) {
// Check caller is pendingAdmin
if (msg.sender != pendingAdmin) {
return fail(Error.UNAUTHORIZED, FailureInfo.ACCEPT_ADMIN_PENDING_ADMIN_CHECK);
}
// Save current values for inclusion in log
address oldAdmin = admin;
address oldPendingAdmin = pendingAdmin;
// Store admin with value pendingAdmin
admin = pendingAdmin;
// Clear the pending value
pendingAdmin = address(0);
emit NewAdmin(oldAdmin, admin);
emit NewPendingAdmin(oldPendingAdmin, pendingAdmin);
return uint256(Error.NO_ERROR);
}
/**
* @dev Delegates execution to an implementation contract.
* It returns to the external caller whatever the implementation returns
* or forwards reverts.
*/
function() external payable {
// delegate all other functions to current implementation
(bool success, ) = joetrollerImplementation.delegatecall(msg.data);
assembly {
let free_mem_ptr := mload(0x40)
returndatacopy(free_mem_ptr, 0, returndatasize)
switch success
case 0 {
revert(free_mem_ptr, returndatasize)
}
default {
return(free_mem_ptr, returndatasize)
}
}
}
}
| 33,279 |
20 | // The reserved balance is the total balance outstanding on all open leaderboards. We keep track of this figure to prevent the developers from pulling out money currently pledged | uint public contractReservedBalance;
function setMinMaxDays(uint8 _minDays, uint8 _maxDays) external ;
function openLeaderboard(uint8 numDays, string message) external payable ;
function closeLeaderboard(uint16 leaderboardId) onlySERAPHIM external;
function setMedalsClaimed(uint16 leaderboardId) onlySERAPHIM external ;
function withdrawEther() onlyCREATOR external;
function getTeamFromLeaderboard(uint16 leaderboardId, uint8 rank) public constant returns (uint64 angelId, uint64 petId, uint64 accessoryId) ;
| uint public contractReservedBalance;
function setMinMaxDays(uint8 _minDays, uint8 _maxDays) external ;
function openLeaderboard(uint8 numDays, string message) external payable ;
function closeLeaderboard(uint16 leaderboardId) onlySERAPHIM external;
function setMedalsClaimed(uint16 leaderboardId) onlySERAPHIM external ;
function withdrawEther() onlyCREATOR external;
function getTeamFromLeaderboard(uint16 leaderboardId, uint8 rank) public constant returns (uint64 angelId, uint64 petId, uint64 accessoryId) ;
| 24,084 |
56 | // IUniswapV2Factory | interface IUniswapV2Factory {
event PairCreated(
address indexed token0,
address indexed token1,
address pair,
uint256
);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view
returns (address pair);
function allPairs(uint256) external view returns (address pair);
function allPairsLength() external view returns (uint256);
function createPair(address tokenA, address tokenB) external
returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
| interface IUniswapV2Factory {
event PairCreated(
address indexed token0,
address indexed token1,
address pair,
uint256
);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view
returns (address pair);
function allPairs(uint256) external view returns (address pair);
function allPairsLength() external view returns (uint256);
function createPair(address tokenA, address tokenB) external
returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
| 17,725 |
64 | // Tax and development fees will start at 0 so we don't have a big impact when deploying to Uniswap development wallet address is null but the method to set the address is exposed | uint256 private _taxFee = 3;
uint256 private _developmentFee = 3;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousDevelopmentFee = _developmentFee;
address payable public _developmentWalletAddress;
address payable public _marketingWalletAddress;
IUniswapV2Router02 public immutable uniswapV2Router;
| uint256 private _taxFee = 3;
uint256 private _developmentFee = 3;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousDevelopmentFee = _developmentFee;
address payable public _developmentWalletAddress;
address payable public _marketingWalletAddress;
IUniswapV2Router02 public immutable uniswapV2Router;
| 6,034 |
125 | // check items equipped on tamag | for (uint256 i = 0; i < indivEffectEquip.length(); i++){
uint256 equipId = indivEffectEquip.at(i);
if (tamag.isEquipped(tamagId, equipId)){
bonus = bonus.add(tma.bonusEffect(equipId));
}
| for (uint256 i = 0; i < indivEffectEquip.length(); i++){
uint256 equipId = indivEffectEquip.at(i);
if (tamag.isEquipped(tamagId, equipId)){
bonus = bonus.add(tma.bonusEffect(equipId));
}
| 24,979 |
199 | // Initialize the ERC20 token contract | erc20Token = IERC20(_erc20TokenAddress);
| erc20Token = IERC20(_erc20TokenAddress);
| 19,200 |
13 | // mints reputation to user according to his share in last month claims _claimer the user to distribute reputation to / | function claimReputation(address _claimer) public {
uint256 prevMonth = currentMonth - 1;
uint256 monthlyDist = months[prevMonth].monthlyDistribution;
uint256 userClaims = months[prevMonth].claims[_claimer];
if (
lastMonthClaimed[_claimer] < prevMonth &&
userClaims > 0 &&
monthlyDist > 0
) {
lastMonthClaimed[_claimer] = prevMonth;
uint256 userShare = (monthlyDist * userClaims) /
months[prevMonth].totalClaims;
if (userShare > 0) {
GReputation grep = GReputation(
nameService.getAddress("REPUTATION")
);
grep.mint(_claimer, userShare);
emit ReputationEarned(
_claimer,
prevMonth,
userClaims,
userShare
);
}
}
}
| function claimReputation(address _claimer) public {
uint256 prevMonth = currentMonth - 1;
uint256 monthlyDist = months[prevMonth].monthlyDistribution;
uint256 userClaims = months[prevMonth].claims[_claimer];
if (
lastMonthClaimed[_claimer] < prevMonth &&
userClaims > 0 &&
monthlyDist > 0
) {
lastMonthClaimed[_claimer] = prevMonth;
uint256 userShare = (monthlyDist * userClaims) /
months[prevMonth].totalClaims;
if (userShare > 0) {
GReputation grep = GReputation(
nameService.getAddress("REPUTATION")
);
grep.mint(_claimer, userShare);
emit ReputationEarned(
_claimer,
prevMonth,
userClaims,
userShare
);
}
}
}
| 24,414 |
26 | // an event emitted when someone donated ERC721 tokens to the FrAactionHub | event DonatedErc721(
address indexed contributor,
uint256 id
);
| event DonatedErc721(
address indexed contributor,
uint256 id
);
| 18,476 |
17 | // Cannot donate to deleted token/null address | require(donationBeneficiary[donationId] != address(0));
| require(donationBeneficiary[donationId] != address(0));
| 526 |
0 | // The appended data consists of a deadline, plus the [v,r,s] signature. For simplicity, we use a full 256 bit slot for each of these values, even if 'v' is typically an 8 bit value. | uint256 internal constant _EXTRA_CALLDATA_LENGTH = 4 * 32;
| uint256 internal constant _EXTRA_CALLDATA_LENGTH = 4 * 32;
| 12,216 |
31 | // Buy some put tickets | function buyPutTickets() public payable {
buyTickets(1);
}
| function buyPutTickets() public payable {
buyTickets(1);
}
| 32,342 |
326 | // Replaces an index in the withdrawal stack with another strategy./index The index in the stack to replace./replacementStrategy The strategy to override the index with./Strategies that are untrusted, duplicated, or have no balance are/ filtered out when encountered at withdrawal time, not validated upfront. | function replaceWithdrawalStackIndex(uint256 index, Strategy replacementStrategy) external requiresAuth {
// Get the (soon to be) replaced strategy.
Strategy replacedStrategy = withdrawalStack[index];
// Update the index with the replacement strategy.
withdrawalStack[index] = replacementStrategy;
emit WithdrawalStackIndexReplaced(msg.sender, index, replacedStrategy, replacementStrategy);
}
| function replaceWithdrawalStackIndex(uint256 index, Strategy replacementStrategy) external requiresAuth {
// Get the (soon to be) replaced strategy.
Strategy replacedStrategy = withdrawalStack[index];
// Update the index with the replacement strategy.
withdrawalStack[index] = replacementStrategy;
emit WithdrawalStackIndexReplaced(msg.sender, index, replacedStrategy, replacementStrategy);
}
| 21,497 |
66 | // checks if an account is frozen / | function isFrozen(address account) public view returns (bool) {
return _frozenAccounts.has(account);
}
| function isFrozen(address account) public view returns (bool) {
return _frozenAccounts.has(account);
}
| 17,610 |
1 | // STORAGE //The max iterations to use when this vault interacts with Morpho. | uint96 internal _maxIterations;
| uint96 internal _maxIterations;
| 41,526 |
24 | // Mints a token for a particular mint instance. mintIdThe ID of the mint instance. requestedQuantity The quantity of tokens to mint. / | function mint(
| function mint(
| 9,051 |
54 | // Indicates whether a contract implements the `ERC1155TokenReceiver` functions and so can accept ERC1155 token types.interfaceID The ERC-165 interface ID that is queried for support.s This function MUST return true if it implements the ERC1155TokenReceiver interface and ERC-165 interface. This function MUST NOT consume more than 5,000 gas.return Wheter ERC-165 or ERC1155TokenReceiver interfaces are supported. / | function supportsInterface(bytes4 interfaceID) external view returns (bool);
| function supportsInterface(bytes4 interfaceID) external view returns (bool);
| 15,930 |
239 | // ============ Constructor ============ //Set state variables and map asset pairs to their oracles_controller Address of controller contract / | constructor(IController _controller) public {
controller = _controller;
}
| constructor(IController _controller) public {
controller = _controller;
}
| 29,517 |
69 | // Withdraws a portion of the callers dividend earnings. / | function withdrawAmount(uint256 _amountOfP3D)
public
| function withdrawAmount(uint256 _amountOfP3D)
public
| 21,492 |
Subsets and Splits