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
|
---|---|---|---|---|
39 | // Get the total number of administrators.return The total number of administrators. / | function getAdminCount() external view returns (uint256) {
return adminArray.length;
}
| function getAdminCount() external view returns (uint256) {
return adminArray.length;
}
| 23,219 |
9 | // If it's 0 then the DKG is still pending start. If >0, it is the DKG's start block | uint256 public startBlock = 0;
| uint256 public startBlock = 0;
| 2,724 |
123 | // Calculate total payoff of all outstanding options This value will decrease as options are redeemed For calls, divide by expiry price since payoff should be in terms of the`baseToken` / | function calcPayoff(
uint256[] memory strikePrices,
uint256 expiryPrice,
bool isPut,
uint256[] memory longSupplies,
uint256[] memory shortSupplies
| function calcPayoff(
uint256[] memory strikePrices,
uint256 expiryPrice,
bool isPut,
uint256[] memory longSupplies,
uint256[] memory shortSupplies
| 40,469 |
12 | // get Aave all reserved tokens / | function getAllReservesTokens() external view returns(IAaveProtocolDataProvider.TokenData[] memory) {
require(lendingPoolAddressProvider != address(0), "JAave: set lending pool address provider");
IAaveProtocolDataProvider aaveProtocolDataProvider = getDataProvider();
return aaveProtocolDataProvider.getAllReservesTokens();
}
| function getAllReservesTokens() external view returns(IAaveProtocolDataProvider.TokenData[] memory) {
require(lendingPoolAddressProvider != address(0), "JAave: set lending pool address provider");
IAaveProtocolDataProvider aaveProtocolDataProvider = getDataProvider();
return aaveProtocolDataProvider.getAllReservesTokens();
}
| 31,666 |
6 | // is Strat, assume it's approved | contract ExampleStrat {
function deposit() payable public {
// nop
}
function harvest() public {
// only pool members can do this
}
function withdraw() public {
// only pool members but then what?
}
}
| contract ExampleStrat {
function deposit() payable public {
// nop
}
function harvest() public {
// only pool members can do this
}
function withdraw() public {
// only pool members but then what?
}
}
| 29,067 |
246 | // Returns true if the address is the SetToken's manager / | function isSetManager(ISetToken _setToken, address _toCheck) internal view returns(bool) {
return _setToken.manager() == _toCheck;
}
| function isSetManager(ISetToken _setToken, address _toCheck) internal view returns(bool) {
return _setToken.manager() == _toCheck;
}
| 29,524 |
47 | // Get the latest effective price/tokenAddress Destination token address/payback As the charging fee may change, it is suggested that the caller pay more fees, and the excess fees will be returned through this address/ return blockNumber The block number of price/ return price The token price. (1eth equivalent to (price) token) | function latestPrice(address tokenAddress, address payback) external payable returns (uint blockNumber, uint price);
| function latestPrice(address tokenAddress, address payback) external payable returns (uint blockNumber, uint price);
| 66,016 |
208 | // Set the number of update delay blocks/fromBlockNumber Block number from which the update applies/newUpdateDelayBlocks The new update delay blocks value | function setUpdateDelayBlocks(uint256 fromBlockNumber, uint256 newUpdateDelayBlocks)
public
onlyOperator
onlyDelayedBlockNumber(fromBlockNumber)
| function setUpdateDelayBlocks(uint256 fromBlockNumber, uint256 newUpdateDelayBlocks)
public
onlyOperator
onlyDelayedBlockNumber(fromBlockNumber)
| 24,837 |
62 | // Deprecated: Use Open Zeppeling one instead / | contract StandardTokenData {
/*
* Storage
*/
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowances;
uint totalTokens;
}
| contract StandardTokenData {
/*
* Storage
*/
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowances;
uint totalTokens;
}
| 39,419 |
149 | // unlend token_amount or actual balance, whatever is less | uint256 amount = _amount.min(IERC20(_wrapped).balanceOf(address(basket)));
| uint256 amount = _amount.min(IERC20(_wrapped).balanceOf(address(basket)));
| 82,472 |
113 | // Store admin = pendingAnchorAdmin. | anchorAdmin = pendingAnchorAdmin;
| anchorAdmin = pendingAnchorAdmin;
| 53,073 |
129 | // Allows the DAO to set the season and Fuxi Jinzi per token ID/ in one transaction. This ensures that there is not a gap where a user/ can claim more Fuxi Jinzi than others/season_ The season to use for claiming fuxi/fuxiJinziDisplayValue The amount of Fuxi a user can claim./ This should be input as the display value, not in raw decimals. If you/ want to mint 100 Fuxi, you should enter "100" rather than the value of/ 10010^18./We would save a tiny amount of gas by modifying the season and/ fuxiJinzi variables directly. It is better practice for security,/ however, | function daoSetSeasonAndfuxiJinziPerTokenID(
uint256 season_,
uint256 fuxiJinziDisplayValue
| function daoSetSeasonAndfuxiJinziPerTokenID(
uint256 season_,
uint256 fuxiJinziDisplayValue
| 28,170 |
3 | // get points from a single match matchIndex index of the matchmatches token predictions return / | function getMatchPoints (uint256 matchIndex, uint160 matches, MatchResult[] matchResults, bool[] starMatches) private pure returns(uint16 matchPoints) {
uint8 tResult = uint8(matches & MATCH_RESULT_MASK);
uint8 tUnder49 = uint8((matches >> 2) & MATCH_UNDEROVER_MASK);
uint8 tTouchdowns = uint8((matches >> 3) & MATCH_TOUCHDOWNS_MASK);
uint8 rResult = matchResults[matchIndex].result;
uint8 rUnder49 = matchResults[matchIndex].under49;
uint8 rTouchdowns = matchResults[matchIndex].touchdowns;
if (rResult == tResult) {
matchPoints += 5;
if(rResult == 0) {
matchPoints += 5;
}
if(starMatches[matchIndex]) {
matchPoints += 2;
}
}
if(tUnder49 == rUnder49) {
matchPoints += 1;
}
if(tTouchdowns == rTouchdowns) {
matchPoints += 4;
}
}
| function getMatchPoints (uint256 matchIndex, uint160 matches, MatchResult[] matchResults, bool[] starMatches) private pure returns(uint16 matchPoints) {
uint8 tResult = uint8(matches & MATCH_RESULT_MASK);
uint8 tUnder49 = uint8((matches >> 2) & MATCH_UNDEROVER_MASK);
uint8 tTouchdowns = uint8((matches >> 3) & MATCH_TOUCHDOWNS_MASK);
uint8 rResult = matchResults[matchIndex].result;
uint8 rUnder49 = matchResults[matchIndex].under49;
uint8 rTouchdowns = matchResults[matchIndex].touchdowns;
if (rResult == tResult) {
matchPoints += 5;
if(rResult == 0) {
matchPoints += 5;
}
if(starMatches[matchIndex]) {
matchPoints += 2;
}
}
if(tUnder49 == rUnder49) {
matchPoints += 1;
}
if(tTouchdowns == rTouchdowns) {
matchPoints += 4;
}
}
| 45,903 |
32 | // Sets the skill on an expenditure slot. Can only be called by expenditure owner./_id Expenditure identifier/_slot Number of the slot/_skillId Id of the new skill to set | function setExpenditureSkill(uint256 _id, uint256 _slot, uint256 _skillId) public;
| function setExpenditureSkill(uint256 _id, uint256 _slot, uint256 _skillId) public;
| 3,471 |
14 | // Using max amount to withdraw stETH from DSA to vault to withdraw any ideal stETH from DSA. | targets_[spellIndex_] = "BASIC-A";
calldatas_[spellIndex_] = abi.encodeWithSignature(
"withdraw(address,uint256,address,uint256,uint256)",
STETH_ADDRESS,
type(uint256).max,
address(this),
0,
0
);
| targets_[spellIndex_] = "BASIC-A";
calldatas_[spellIndex_] = abi.encodeWithSignature(
"withdraw(address,uint256,address,uint256,uint256)",
STETH_ADDRESS,
type(uint256).max,
address(this),
0,
0
);
| 38,717 |
49 | // call returns 0 on error. | case 0 {
revert(pos, len)
}
| case 0 {
revert(pos, len)
}
| 10,292 |
5 | // set id | addrToMailBox[msg.sender][id].id = id;
| addrToMailBox[msg.sender][id].id = id;
| 2,491 |
8 | // Run Runo token with token IDtokenIds_ array of tokenId / | function run(
uint256[] memory tokenIds_
| function run(
uint256[] memory tokenIds_
| 26,861 |
21 | // The maximum allowable fee rate | uint16 public constant MAX_FEE = 100;
| uint16 public constant MAX_FEE = 100;
| 36,513 |
1 | // Events//Contract Variables//Public Functions//Sends a cross domain message to the target messenger. _target Target contract address. _message Message to send to the target. _gasLimit Gas limit for the provided message. / | function sendMessage(
address _target,
bytes calldata _message,
uint32 _gasLimit
) external;
| function sendMessage(
address _target,
bytes calldata _message,
uint32 _gasLimit
) external;
| 3,029 |
32 | // VaultParameters Unit Protocol: Artem Zakharov ([email protected]), Alexander Ponomorev (@bcngod) / | contract VaultParameters is Auth {
// map token to stability fee percentage; 3 decimals
mapping(address => uint) public stabilityFee;
// map token to liquidation fee percentage, 0 decimals
mapping(address => uint) public liquidationFee;
// map token to USDP mint limit
mapping(address => uint) public tokenDebtLimit;
// permissions to modify the Vault
mapping(address => bool) public canModifyVault;
// managers
mapping(address => bool) public isManager;
// enabled oracle types
mapping(uint => mapping (address => bool)) public isOracleTypeEnabled;
// address of the Vault
address payable public vault;
// The foundation address
address public foundation;
/**
* The address for an Ethereum contract is deterministically computed from the address of its creator (sender)
* and how many transactions the creator has sent (nonce). The sender and nonce are RLP encoded and then
* hashed with Keccak-256.
* Therefore, the Vault address can be pre-computed and passed as an argument before deployment.
**/
constructor(address payable _vault, address _foundation) public Auth(address(this)) {
require(_vault != address(0), "Unit Protocol: ZERO_ADDRESS");
require(_foundation != address(0), "Unit Protocol: ZERO_ADDRESS");
isManager[msg.sender] = true;
vault = _vault;
foundation = _foundation;
}
/**
* @notice Only manager is able to call this function
* @dev Grants and revokes manager's status of any address
* @param who The target address
* @param permit The permission flag
**/
function setManager(address who, bool permit) external onlyManager {
isManager[who] = permit;
}
/**
* @notice Only manager is able to call this function
* @dev Sets the foundation address
* @param newFoundation The new foundation address
**/
function setFoundation(address newFoundation) external onlyManager {
require(newFoundation != address(0), "Unit Protocol: ZERO_ADDRESS");
foundation = newFoundation;
}
/**
* @notice Only manager is able to call this function
* @dev Sets ability to use token as the main collateral
* @param asset The address of the main collateral token
* @param stabilityFeeValue The percentage of the year stability fee (3 decimals)
* @param liquidationFeeValue The liquidation fee percentage (0 decimals)
* @param usdpLimit The USDP token issue limit
* @param oracles The enables oracle types
**/
function setCollateral(
address asset,
uint stabilityFeeValue,
uint liquidationFeeValue,
uint usdpLimit,
uint[] calldata oracles
) external onlyManager {
setStabilityFee(asset, stabilityFeeValue);
setLiquidationFee(asset, liquidationFeeValue);
setTokenDebtLimit(asset, usdpLimit);
for (uint i=0; i < oracles.length; i++) {
setOracleType(oracles[i], asset, true);
}
}
/**
* @notice Only manager is able to call this function
* @dev Sets a permission for an address to modify the Vault
* @param who The target address
* @param permit The permission flag
**/
function setVaultAccess(address who, bool permit) external onlyManager {
canModifyVault[who] = permit;
}
/**
* @notice Only manager is able to call this function
* @dev Sets the percentage of the year stability fee for a particular collateral
* @param asset The address of the main collateral token
* @param newValue The stability fee percentage (3 decimals)
**/
function setStabilityFee(address asset, uint newValue) public onlyManager {
stabilityFee[asset] = newValue;
}
/**
* @notice Only manager is able to call this function
* @dev Sets the percentage of the liquidation fee for a particular collateral
* @param asset The address of the main collateral token
* @param newValue The liquidation fee percentage (0 decimals)
**/
function setLiquidationFee(address asset, uint newValue) public onlyManager {
require(newValue <= 100, "Unit Protocol: VALUE_OUT_OF_RANGE");
liquidationFee[asset] = newValue;
}
/**
* @notice Only manager is able to call this function
* @dev Enables/disables oracle types
* @param _type The type of the oracle
* @param asset The address of the main collateral token
* @param enabled The control flag
**/
function setOracleType(uint _type, address asset, bool enabled) public onlyManager {
isOracleTypeEnabled[_type][asset] = enabled;
}
/**
* @notice Only manager is able to call this function
* @dev Sets USDP limit for a specific collateral
* @param asset The address of the main collateral token
* @param limit The limit number
**/
function setTokenDebtLimit(address asset, uint limit) public onlyManager {
tokenDebtLimit[asset] = limit;
}
}
| contract VaultParameters is Auth {
// map token to stability fee percentage; 3 decimals
mapping(address => uint) public stabilityFee;
// map token to liquidation fee percentage, 0 decimals
mapping(address => uint) public liquidationFee;
// map token to USDP mint limit
mapping(address => uint) public tokenDebtLimit;
// permissions to modify the Vault
mapping(address => bool) public canModifyVault;
// managers
mapping(address => bool) public isManager;
// enabled oracle types
mapping(uint => mapping (address => bool)) public isOracleTypeEnabled;
// address of the Vault
address payable public vault;
// The foundation address
address public foundation;
/**
* The address for an Ethereum contract is deterministically computed from the address of its creator (sender)
* and how many transactions the creator has sent (nonce). The sender and nonce are RLP encoded and then
* hashed with Keccak-256.
* Therefore, the Vault address can be pre-computed and passed as an argument before deployment.
**/
constructor(address payable _vault, address _foundation) public Auth(address(this)) {
require(_vault != address(0), "Unit Protocol: ZERO_ADDRESS");
require(_foundation != address(0), "Unit Protocol: ZERO_ADDRESS");
isManager[msg.sender] = true;
vault = _vault;
foundation = _foundation;
}
/**
* @notice Only manager is able to call this function
* @dev Grants and revokes manager's status of any address
* @param who The target address
* @param permit The permission flag
**/
function setManager(address who, bool permit) external onlyManager {
isManager[who] = permit;
}
/**
* @notice Only manager is able to call this function
* @dev Sets the foundation address
* @param newFoundation The new foundation address
**/
function setFoundation(address newFoundation) external onlyManager {
require(newFoundation != address(0), "Unit Protocol: ZERO_ADDRESS");
foundation = newFoundation;
}
/**
* @notice Only manager is able to call this function
* @dev Sets ability to use token as the main collateral
* @param asset The address of the main collateral token
* @param stabilityFeeValue The percentage of the year stability fee (3 decimals)
* @param liquidationFeeValue The liquidation fee percentage (0 decimals)
* @param usdpLimit The USDP token issue limit
* @param oracles The enables oracle types
**/
function setCollateral(
address asset,
uint stabilityFeeValue,
uint liquidationFeeValue,
uint usdpLimit,
uint[] calldata oracles
) external onlyManager {
setStabilityFee(asset, stabilityFeeValue);
setLiquidationFee(asset, liquidationFeeValue);
setTokenDebtLimit(asset, usdpLimit);
for (uint i=0; i < oracles.length; i++) {
setOracleType(oracles[i], asset, true);
}
}
/**
* @notice Only manager is able to call this function
* @dev Sets a permission for an address to modify the Vault
* @param who The target address
* @param permit The permission flag
**/
function setVaultAccess(address who, bool permit) external onlyManager {
canModifyVault[who] = permit;
}
/**
* @notice Only manager is able to call this function
* @dev Sets the percentage of the year stability fee for a particular collateral
* @param asset The address of the main collateral token
* @param newValue The stability fee percentage (3 decimals)
**/
function setStabilityFee(address asset, uint newValue) public onlyManager {
stabilityFee[asset] = newValue;
}
/**
* @notice Only manager is able to call this function
* @dev Sets the percentage of the liquidation fee for a particular collateral
* @param asset The address of the main collateral token
* @param newValue The liquidation fee percentage (0 decimals)
**/
function setLiquidationFee(address asset, uint newValue) public onlyManager {
require(newValue <= 100, "Unit Protocol: VALUE_OUT_OF_RANGE");
liquidationFee[asset] = newValue;
}
/**
* @notice Only manager is able to call this function
* @dev Enables/disables oracle types
* @param _type The type of the oracle
* @param asset The address of the main collateral token
* @param enabled The control flag
**/
function setOracleType(uint _type, address asset, bool enabled) public onlyManager {
isOracleTypeEnabled[_type][asset] = enabled;
}
/**
* @notice Only manager is able to call this function
* @dev Sets USDP limit for a specific collateral
* @param asset The address of the main collateral token
* @param limit The limit number
**/
function setTokenDebtLimit(address asset, uint limit) public onlyManager {
tokenDebtLimit[asset] = limit;
}
}
| 51,730 |
16 | // id => hold_t | mapping(uint256 => hold_t) private _holds; //@_indexes start with 1
| mapping(uint256 => hold_t) private _holds; //@_indexes start with 1
| 20,724 |
11 | // events | event OnBuy(address user, uint32 round, uint32 index, uint8[5] nums);
event OnRewardDaily(address user, uint32 round, uint32 index, uint reward);
event OnRewardWeekly(address user, uint32 round, uint32 index,uint reward);
event OnRewardDailyFailed(address user, uint32 round, uint32 index);
event OnRewardWeeklyFailed(address user, uint32 round, uint32 index);
event OnNewRound(uint32 round);
event OnFreeze(uint32 round);
event OnUnFreeze(uint32 round);
event OnDrawStart(uint32 round);
event OnDrawFinished(uint32 round, uint8[5] jackpot);
| event OnBuy(address user, uint32 round, uint32 index, uint8[5] nums);
event OnRewardDaily(address user, uint32 round, uint32 index, uint reward);
event OnRewardWeekly(address user, uint32 round, uint32 index,uint reward);
event OnRewardDailyFailed(address user, uint32 round, uint32 index);
event OnRewardWeeklyFailed(address user, uint32 round, uint32 index);
event OnNewRound(uint32 round);
event OnFreeze(uint32 round);
event OnUnFreeze(uint32 round);
event OnDrawStart(uint32 round);
event OnDrawFinished(uint32 round, uint8[5] jackpot);
| 46,547 |
118 | // dev set Zunami (main contract) address zunamiAddr - address of main contract (Zunami) / | function setZunami(address zunamiAddr) external onlyOwner {
zunami = IZunami(zunamiAddr);
}
| function setZunami(address zunamiAddr) external onlyOwner {
zunami = IZunami(zunamiAddr);
}
| 9,891 |
3 | // 부수적으로 지급할 토큰이 있는 경우 | vestingInfos[recruiter][to][subToken] = VestingInfo({
startTime: startTime,
endTime: endTime,
initialLocked: safe96(subAmount),
totalClaimed: 0
});
| vestingInfos[recruiter][to][subToken] = VestingInfo({
startTime: startTime,
endTime: endTime,
initialLocked: safe96(subAmount),
totalClaimed: 0
});
| 8,327 |
93 | // This event MUST emit when ether is distributed to token holders./from The address which sends ether to this contract./weiAmount The amount of distributed ether in wei. | event DividendsDistributed(
address indexed from,
uint256 weiAmount
);
| event DividendsDistributed(
address indexed from,
uint256 weiAmount
);
| 12,790 |
68 | // Burn unsold tokens from the ICO balance.Only applies when the ICO was ended./ | function burnUnsoldTokens() whenIcoSaleHasEnded onlyOwner public {
require(tokensRemainingIco > 0);
token.burnFromIco();
tokensRemainingIco = 0;
}
| function burnUnsoldTokens() whenIcoSaleHasEnded onlyOwner public {
require(tokensRemainingIco > 0);
token.burnFromIco();
tokensRemainingIco = 0;
}
| 14,399 |
0 | // Returns public state (automatic accessor) | string public aPublicString = "woa";
| string public aPublicString = "woa";
| 2,717 |
220 | // Lastly, check to make sure _addr hasn't already claimed a free pack. | return referrerHasBoughtPack && !hasClaimedFreeReferralPack[_addr];
| return referrerHasBoughtPack && !hasClaimedFreeReferralPack[_addr];
| 29,420 |
49 | // Sets `amount` as the allowance of `spender` over the `owner` s tokens. This 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 virtual {
require(owner != address(0), "IERC20: approve from the zero address");
require(spender != address(0), "IERC20: 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 virtual {
require(owner != address(0), "IERC20: approve from the zero address");
require(spender != address(0), "IERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
| 28,348 |
1,444 | // 723 | entry "agroinfiltrated" : ENG_ADJECTIVE
| entry "agroinfiltrated" : ENG_ADJECTIVE
| 17,335 |
22 | // record issue of pod and update state | tokenTypes[_tokenId] = 2;
podToCampaignIds[voteId] = _tokenId;
redeemedPod[_tokenId][donorAddress] = voteId;
podCount++;
| tokenTypes[_tokenId] = 2;
podToCampaignIds[voteId] = _tokenId;
redeemedPod[_tokenId][donorAddress] = voteId;
podCount++;
| 15,348 |
9 | // Commission percentage of exchange | uint256 public feeExchange;
| uint256 public feeExchange;
| 43,845 |
70 | // value of taxed tokens | uint256 stableAmount = (tokensToSwap * oldPrice) / PRECISION;
uint256 totalOfCurrentStable = _adjustedStableBalance(
payoutStable.balance,
payoutStable.decimals
);
| uint256 stableAmount = (tokensToSwap * oldPrice) / PRECISION;
uint256 totalOfCurrentStable = _adjustedStableBalance(
payoutStable.balance,
payoutStable.decimals
);
| 14,519 |
140 | // Creates `_amount` tokens and assigns them to `_account`, increasingthe total supply. | * Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address _account, uint256 _amount) internal nonReentrant {
require(_account != address(0), "Mint to the zero address");
bool isNonRebasingAccount = _isNonRebasingAccount(_account);
uint256 creditAmount = _amount.mulTruncate(_creditsPerToken(_account));
_creditBalances[_account] = _creditBalances[_account].add(creditAmount);
// If the account is non rebasing and doesn't have a set creditsPerToken
// then set it i.e. this is a mint from a fresh contract
if (isNonRebasingAccount) {
nonRebasingSupply = nonRebasingSupply.add(_amount);
} else {
rebasingCredits = rebasingCredits.add(creditAmount);
}
_totalSupply = _totalSupply.add(_amount);
require(_totalSupply < MAX_SUPPLY, "Max supply");
emit Transfer(address(0), _account, _amount);
}
| * Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address _account, uint256 _amount) internal nonReentrant {
require(_account != address(0), "Mint to the zero address");
bool isNonRebasingAccount = _isNonRebasingAccount(_account);
uint256 creditAmount = _amount.mulTruncate(_creditsPerToken(_account));
_creditBalances[_account] = _creditBalances[_account].add(creditAmount);
// If the account is non rebasing and doesn't have a set creditsPerToken
// then set it i.e. this is a mint from a fresh contract
if (isNonRebasingAccount) {
nonRebasingSupply = nonRebasingSupply.add(_amount);
} else {
rebasingCredits = rebasingCredits.add(creditAmount);
}
_totalSupply = _totalSupply.add(_amount);
require(_totalSupply < MAX_SUPPLY, "Max supply");
emit Transfer(address(0), _account, _amount);
}
| 25,465 |
9 | // Emitted when an offer is invalidated due to other market activity.When this occurs, the collector which made the offer has their FETH balance unlockedand the funds are available to place other offers or to be withdrawn. This occurs when the offer is no longer eligible to be accepted,e.g. when a bid is placed in an auction for this NFT. nftContract The address of the NFT contract. tokenId The id of the NFT. / | event OfferInvalidated(address indexed nftContract, uint256 indexed tokenId);
| event OfferInvalidated(address indexed nftContract, uint256 indexed tokenId);
| 17,917 |
93 | // This is the current recommended method to use. | (bool sent, ) = _owner.call{value: amount}("");
| (bool sent, ) = _owner.call{value: amount}("");
| 41,155 |
4 | // SafeMath / | library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
}
| library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
}
| 5,354 |
20 | // Drop Satisfaction | senderBox.partnerNonce = 0;
prtnerBox.partnerNonce = 0;
| senderBox.partnerNonce = 0;
prtnerBox.partnerNonce = 0;
| 42,649 |
123 | // calculate conversion options | (uint256 pool, uint256 extra, uint96 bonus) = calculateOptionsComponents(
emp,
calcAtTime,
conversionOfferedAt,
disableAcceleratedVesting
);
| (uint256 pool, uint256 extra, uint96 bonus) = calculateOptionsComponents(
emp,
calcAtTime,
conversionOfferedAt,
disableAcceleratedVesting
);
| 44,196 |
84 | // add that token into the contract balance check if we have any pending reward/yield, add it to pendingGains variable | if(_tokenAddress == SYFP){
users[msg.sender][_tokenAddress].pendingGains = PendingReward(msg.sender);
users[msg.sender][_tokenAddress].period = stakingPeriod;
users[msg.sender][_tokenAddress].rate = tokens[_tokenAddress].rate; // rate for stakers will be fixed at time of staking
}
| if(_tokenAddress == SYFP){
users[msg.sender][_tokenAddress].pendingGains = PendingReward(msg.sender);
users[msg.sender][_tokenAddress].period = stakingPeriod;
users[msg.sender][_tokenAddress].rate = tokens[_tokenAddress].rate; // rate for stakers will be fixed at time of staking
}
| 47,648 |
35 | // Don't want to keep typing address(0). Typecasting just for clarity. | uint160 private constant EMPTY = uint160(address(0));
| uint160 private constant EMPTY = uint160(address(0));
| 4,740 |
6 | // Function to be called by top level contract after initialization to enable the contractat a future block number rather than immediately./ | function initializedAt(uint256 _blockNumber) internal onlyInit {
INITIALIZATION_BLOCK_POSITION.setStorageUint256(_blockNumber);
}
| function initializedAt(uint256 _blockNumber) internal onlyInit {
INITIALIZATION_BLOCK_POSITION.setStorageUint256(_blockNumber);
}
| 23,468 |
3 | // increments the value of currentTokenID / | function _incrementTokenTypeId() private {
LibERC115Facet.Layout storage ercl = LibERC115Facet.layout();
ercl.currentTokenID++;
}
| function _incrementTokenTypeId() private {
LibERC115Facet.Layout storage ercl = LibERC115Facet.layout();
ercl.currentTokenID++;
}
| 4,012 |
30 | // Returns the ceiling of the division of two numbers. This differs from standard division with `/` in that it rounds up insteadof rounding down. / | function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
| function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
| 3,157 |
6 | // Value of total amount requested by borrowers in market (in Wei) | uint totalRequested;
| uint totalRequested;
| 25,083 |
138 | // Event emitted when the reserves are added / | event ReservesAdded(address benefactor, uint256 addAmount, uint256 newTotalReserves);
| event ReservesAdded(address benefactor, uint256 addAmount, uint256 newTotalReserves);
| 9,874 |
16 | // A library of utilities for (multi)signatures/Alexander Kern <[email protected]>/This library can be linked to another Solidity contract to expose signature manipulation functions. | library SignatureUtils {
/// @notice Converts a bytes32 to an signed message hash.
/// @param _msg The bytes32 message (i.e. keccak256 result) to encrypt
function toEthBytes32SignedMessageHash (
bytes32 _msg
)
pure
public
returns (bytes32 signHash)
{
signHash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", _msg));
}
/// @notice Converts a byte array to a personal signed message hash (result of `web3.personal.sign(...)`) by concatenating its length.
/// @param _msg The bytes array to encrypt
function toEthPersonalSignedMessageHash(
bytes memory _msg
)
pure
public
returns (bytes32 signHash)
{
signHash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", uintToString(_msg.length), _msg));
}
/// @notice Converts a uint to its decimal string representation.
/// @param v The uint to convert
function uintToString(
uint v
)
pure
public
returns (string memory)
{
uint w = v;
bytes32 x;
if (v == 0) {
x = "0";
} else {
while (w > 0) {
x = bytes32(uint(x) / (2 ** 8));
x |= bytes32(((w % 10) + 48) * 2 ** (8 * 31));
w /= 10;
}
}
bytes memory bytesString = new bytes(32);
uint charCount = 0;
for (uint j = 0; j < 32; j++) {
byte char = byte(bytes32(uint(x) * 2 ** (8 * j)));
if (char != 0) {
bytesString[charCount] = char;
charCount++;
}
}
bytes memory resultBytes = new bytes(charCount);
for (uint j = 0; j < charCount; j++) {
resultBytes[j] = bytesString[j];
}
return string(resultBytes);
}
/// @notice Extracts the r, s, and v parameters to `ecrecover(...)` from the signature at position `_pos` in a densely packed signatures bytes array.
/// @dev Based on [OpenZeppelin's ECRecovery](https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/ECRecovery.sol)
/// @param _signatures The signatures bytes array
/// @param _pos The position of the signature in the bytes array (0 indexed)
function parseSignature(
bytes memory _signatures,
uint _pos
)
pure
public
returns (uint8 v, bytes32 r, bytes32 s)
{
uint offset = _pos * 65;
// The signature format is a compact form of:
// {bytes32 r}{bytes32 s}{uint8 v}
// Compact means, uint8 is not padded to 32 bytes.
assembly { // solium-disable-line security/no-inline-assembly
r := mload(add(_signatures, add(32, offset)))
s := mload(add(_signatures, add(64, offset)))
// Here we are loading the last 32 bytes, including 31 bytes
// of 's'. There is no 'mload8' to do this.
//
// 'byte' is not working due to the Solidity parser, so lets
// use the second best option, 'and'
v := and(mload(add(_signatures, add(65, offset))), 0xff)
}
if (v < 27) v += 27;
require(v == 27 || v == 28);
}
/// @notice Counts the number of signatures in a signatures bytes array. Returns 0 if the length is invalid.
/// @param _signatures The signatures bytes array
/// @dev Signatures are 65 bytes long and are densely packed.
function countSignatures(
bytes memory _signatures
)
pure
public
returns (uint)
{
return _signatures.length % 65 == 0 ? _signatures.length / 65 : 0;
}
/// @notice Recovers an address using a message hash and a signature in a bytes array.
/// @param _hash The signed message hash
/// @param _signatures The signatures bytes array
/// @param _pos The signature's position in the bytes array (0 indexed)
function recoverAddress(
bytes32 _hash,
bytes memory _signatures,
uint _pos
)
pure
public
returns (address)
{
uint8 v;
bytes32 r;
bytes32 s;
(v, r, s) = parseSignature(_signatures, _pos);
return ecrecover(_hash, v, r, s);
}
/// @notice Recovers an array of addresses using a message hash and a signatures bytes array.
/// @param _hash The signed message hash
/// @param _signatures The signatures bytes array
function recoverAddresses(
bytes32 _hash,
bytes memory _signatures
)
pure
public
returns (address[] memory addresses)
{
uint8 v;
bytes32 r;
bytes32 s;
uint count = countSignatures(_signatures);
addresses = new address[](count);
for (uint i = 0; i < count; i++) {
(v, r, s) = parseSignature(_signatures, i);
addresses[i] = ecrecover(_hash, v, r, s);
}
}
} | library SignatureUtils {
/// @notice Converts a bytes32 to an signed message hash.
/// @param _msg The bytes32 message (i.e. keccak256 result) to encrypt
function toEthBytes32SignedMessageHash (
bytes32 _msg
)
pure
public
returns (bytes32 signHash)
{
signHash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", _msg));
}
/// @notice Converts a byte array to a personal signed message hash (result of `web3.personal.sign(...)`) by concatenating its length.
/// @param _msg The bytes array to encrypt
function toEthPersonalSignedMessageHash(
bytes memory _msg
)
pure
public
returns (bytes32 signHash)
{
signHash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", uintToString(_msg.length), _msg));
}
/// @notice Converts a uint to its decimal string representation.
/// @param v The uint to convert
function uintToString(
uint v
)
pure
public
returns (string memory)
{
uint w = v;
bytes32 x;
if (v == 0) {
x = "0";
} else {
while (w > 0) {
x = bytes32(uint(x) / (2 ** 8));
x |= bytes32(((w % 10) + 48) * 2 ** (8 * 31));
w /= 10;
}
}
bytes memory bytesString = new bytes(32);
uint charCount = 0;
for (uint j = 0; j < 32; j++) {
byte char = byte(bytes32(uint(x) * 2 ** (8 * j)));
if (char != 0) {
bytesString[charCount] = char;
charCount++;
}
}
bytes memory resultBytes = new bytes(charCount);
for (uint j = 0; j < charCount; j++) {
resultBytes[j] = bytesString[j];
}
return string(resultBytes);
}
/// @notice Extracts the r, s, and v parameters to `ecrecover(...)` from the signature at position `_pos` in a densely packed signatures bytes array.
/// @dev Based on [OpenZeppelin's ECRecovery](https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/ECRecovery.sol)
/// @param _signatures The signatures bytes array
/// @param _pos The position of the signature in the bytes array (0 indexed)
function parseSignature(
bytes memory _signatures,
uint _pos
)
pure
public
returns (uint8 v, bytes32 r, bytes32 s)
{
uint offset = _pos * 65;
// The signature format is a compact form of:
// {bytes32 r}{bytes32 s}{uint8 v}
// Compact means, uint8 is not padded to 32 bytes.
assembly { // solium-disable-line security/no-inline-assembly
r := mload(add(_signatures, add(32, offset)))
s := mload(add(_signatures, add(64, offset)))
// Here we are loading the last 32 bytes, including 31 bytes
// of 's'. There is no 'mload8' to do this.
//
// 'byte' is not working due to the Solidity parser, so lets
// use the second best option, 'and'
v := and(mload(add(_signatures, add(65, offset))), 0xff)
}
if (v < 27) v += 27;
require(v == 27 || v == 28);
}
/// @notice Counts the number of signatures in a signatures bytes array. Returns 0 if the length is invalid.
/// @param _signatures The signatures bytes array
/// @dev Signatures are 65 bytes long and are densely packed.
function countSignatures(
bytes memory _signatures
)
pure
public
returns (uint)
{
return _signatures.length % 65 == 0 ? _signatures.length / 65 : 0;
}
/// @notice Recovers an address using a message hash and a signature in a bytes array.
/// @param _hash The signed message hash
/// @param _signatures The signatures bytes array
/// @param _pos The signature's position in the bytes array (0 indexed)
function recoverAddress(
bytes32 _hash,
bytes memory _signatures,
uint _pos
)
pure
public
returns (address)
{
uint8 v;
bytes32 r;
bytes32 s;
(v, r, s) = parseSignature(_signatures, _pos);
return ecrecover(_hash, v, r, s);
}
/// @notice Recovers an array of addresses using a message hash and a signatures bytes array.
/// @param _hash The signed message hash
/// @param _signatures The signatures bytes array
function recoverAddresses(
bytes32 _hash,
bytes memory _signatures
)
pure
public
returns (address[] memory addresses)
{
uint8 v;
bytes32 r;
bytes32 s;
uint count = countSignatures(_signatures);
addresses = new address[](count);
for (uint i = 0; i < count; i++) {
(v, r, s) = parseSignature(_signatures, i);
addresses[i] = ecrecover(_hash, v, r, s);
}
}
} | 28,639 |
74 | // Get token flows array of addresses, inflows and outflows _rebalancingSetToken The rebalancing Set Token instance_quantityThe amount of currentSet to be rebalancedreturn combinedTokenArray Array of token addressesreturn inflowArrayArray of amount of tokens inserted into system in bidreturn outflowArray Array of amount of tokens returned from system in bid / | function getTokenFlows(
IRebalancingSetToken _rebalancingSetToken,
uint256 _quantity
)
internal
view
returns (address[] memory, uint256[] memory, uint256[] memory)
| function getTokenFlows(
IRebalancingSetToken _rebalancingSetToken,
uint256 _quantity
)
internal
view
returns (address[] memory, uint256[] memory, uint256[] memory)
| 44,689 |
9 | // auth is a bit unintuitive for wrapping, see NFT.sol:isApprovedOrOwner() | require(holder == msg.sender || holder == address(this), "UOPT:ownership");
newTokenId = hegexoption.mintHegexoption(msg.sender);
chefData.setuid(newTokenId, _uId);
chefData.setid(_uId, newTokenId);
chefData.setoptiontype(_uId, _optionType);
emit Wrapped(msg.sender, _uId);
| require(holder == msg.sender || holder == address(this), "UOPT:ownership");
newTokenId = hegexoption.mintHegexoption(msg.sender);
chefData.setuid(newTokenId, _uId);
chefData.setid(_uId, newTokenId);
chefData.setoptiontype(_uId, _optionType);
emit Wrapped(msg.sender, _uId);
| 39,255 |
111 | // removes a canonical from the list, useful when mistake. | function removeCanonical(string memory _att_name) public onlyOwner{
require(isAttCanonical(_att_name),"That attribute is not canonical, nothing to remove");
attCanonical.isCanonical[_att_name]=false;
uint256 index;
//find the index where the att_name is at
for(uint256 i=0; i<=attCanonical.canonicals.length-1; i++){
if(keccak256(abi.encodePacked(attCanonical.canonicals[i])) == keccak256(abi.encodePacked(_att_name))){
index = i;
return;
}
}
//move all the elements after that att_name so we remove the att_name from array.
for(uint256 i=index; i<=attCanonical.canonicals.length-1; i++){
attCanonical.canonicals[i] = attCanonical.canonicals[i + 1];
}
//delete the last element in the array cuz now it is repeated
delete attCanonical.canonicals[attCanonical.canonicals.length-1];
}
| function removeCanonical(string memory _att_name) public onlyOwner{
require(isAttCanonical(_att_name),"That attribute is not canonical, nothing to remove");
attCanonical.isCanonical[_att_name]=false;
uint256 index;
//find the index where the att_name is at
for(uint256 i=0; i<=attCanonical.canonicals.length-1; i++){
if(keccak256(abi.encodePacked(attCanonical.canonicals[i])) == keccak256(abi.encodePacked(_att_name))){
index = i;
return;
}
}
//move all the elements after that att_name so we remove the att_name from array.
for(uint256 i=index; i<=attCanonical.canonicals.length-1; i++){
attCanonical.canonicals[i] = attCanonical.canonicals[i + 1];
}
//delete the last element in the array cuz now it is repeated
delete attCanonical.canonicals[attCanonical.canonicals.length-1];
}
| 8,744 |
16 | // Claims the ownership of the storage. / | function claimStorageOwnership() public onlyOwner {
token.claimOwnership();
}
| function claimStorageOwnership() public onlyOwner {
token.claimOwnership();
}
| 39,855 |
2 | // / userAddress => gameId => BidIndex | mapping(address => mapping(uint256 => uint256)) public userBidIndex;
| mapping(address => mapping(uint256 => uint256)) public userBidIndex;
| 36,533 |
85 | // Grant acess to mint heroes. | function grantAccessMint(address _address)
onlyOwner
public
| function grantAccessMint(address _address)
onlyOwner
public
| 82,267 |
165 | // prettier-ignore | function uri(uint kind) public view override returns (string memory) {
require(kind < gemCount, 'gem kind not exist');
string memory output = string(abi.encodePacked(
'<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 350 350"><style>.base { fill: ',
gems[kind].color,
'; font-family: serif; font-size: 14px; }</style><rect width="100%" height="100%" fill="white" /><text x="10" y="20" class="base">',
gems[kind].name,
'</text><text x="10" y="40" class="base">',
'</text></svg>'
));
string memory json = Base64.encode(bytes(string(abi.encodePacked(
'{ "name": "',
gems[kind].name,
'", ',
'"description" : ',
'"Provably Rare Gems", ',
'"image": "data:image/svg+xml;base64,',
Base64.encode(bytes(output)),
'}'
))));
return string(abi.encodePacked('data:application/json;base64,', json));
}
| function uri(uint kind) public view override returns (string memory) {
require(kind < gemCount, 'gem kind not exist');
string memory output = string(abi.encodePacked(
'<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 350 350"><style>.base { fill: ',
gems[kind].color,
'; font-family: serif; font-size: 14px; }</style><rect width="100%" height="100%" fill="white" /><text x="10" y="20" class="base">',
gems[kind].name,
'</text><text x="10" y="40" class="base">',
'</text></svg>'
));
string memory json = Base64.encode(bytes(string(abi.encodePacked(
'{ "name": "',
gems[kind].name,
'", ',
'"description" : ',
'"Provably Rare Gems", ',
'"image": "data:image/svg+xml;base64,',
Base64.encode(bytes(output)),
'}'
))));
return string(abi.encodePacked('data:application/json;base64,', json));
}
| 28,324 |
38 | // Map addresses whose tokens we have already issued. // Centrally issued token we are distributing to our contributors // Party (team multisig) who is in the control of the token pool. Note that this will be different from the owner address (scripted) that calls this contract. // How many addresses have received their tokens. / | function Issuer(address _owner, address _allower, StandardTokenExt _token) {
owner = _owner;
allower = _allower;
token = _token;
}
| function Issuer(address _owner, address _allower, StandardTokenExt _token) {
owner = _owner;
allower = _allower;
token = _token;
}
| 34,807 |
70 | // bytes4(keccak256('totalSupply()')) == 0x18160ddd bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59 bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7 => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63/ | bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63;
| bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63;
| 40,755 |
125 | // Post-mint freeze settings | function setPostMintFreeze(uint256 _frozenForSeconds) public onlyTeamOrOwner {
freezePostMintForSeconds = _frozenForSeconds;
}
| function setPostMintFreeze(uint256 _frozenForSeconds) public onlyTeamOrOwner {
freezePostMintForSeconds = _frozenForSeconds;
}
| 23,111 |
27 | // require(totalSupply(id) + amount <= maxSupply[id], "Not enough left of that token."); | if (totalSupply(id) + amount <= maxSupply[id]) {
totalMints.increment();
_mint(account, id, amount, data);
return true;
} else {
| if (totalSupply(id) + amount <= maxSupply[id]) {
totalMints.increment();
_mint(account, id, amount, data);
return true;
} else {
| 9,928 |
113 | // Wrap the ETH we got from the msg.sender | Wrap(msg.value);
| Wrap(msg.value);
| 29,289 |
3 | // The constant sine lookup table was generated by generate_trigonometry.py. We must use a constant bytes array because constant arrays are not supported in Solidity. Each entry in the lookup table is 4 bytes. Since we're using 32-bit parameters for the lookup table, we get a table size of 2^(32/4) + 1 = 257, where the first and last entries are equivalent (hence the table size of 256 defined above) | uint8 constant entry_bytes = 4; // each entry in the lookup table is 4 bytes
uint256 constant entry_mask = ((1 << (8 * entry_bytes)) - 1); // mask used to cast bytes32 -> lookup table entry
bytes constant sin_table =
hex"00_00_00_00_00_c9_0f_88_01_92_1d_20_02_5b_26_d7_03_24_2a_bf_03_ed_26_e6_04_b6_19_5d_05_7f_00_35_06_47_d9_7c_07_10_a3_45_07_d9_5b_9e_08_a2_00_9a_09_6a_90_49_0a_33_08_bc_0a_fb_68_05_0b_c3_ac_35_0c_8b_d3_5e_0d_53_db_92_0e_1b_c2_e4_0e_e3_87_66_0f_ab_27_2b_10_72_a0_48_11_39_f0_cf_12_01_16_d5_12_c8_10_6e_13_8e_db_b1_14_55_76_b1_15_1b_df_85_15_e2_14_44_16_a8_13_05_17_6d_d9_de_18_33_66_e8_18_f8_b8_3c_19_bd_cb_f3_1a_82_a0_25_1b_47_32_ef_1c_0b_82_6a_1c_cf_8c_b3_1d_93_4f_e5_1e_56_ca_1e_1f_19_f9_7b_1f_dc_dc_1b_20_9f_70_1c_21_61_b3_9f_22_23_a4_c5_22_e5_41_af_23_a6_88_7e_24_67_77_57_25_28_0c_5d_25_e8_45_b6_26_a8_21_85_27_67_9d_f4_28_26_b9_28_28_e5_71_4a_29_a3_c4_85_2a_61_b1_01_2b_1f_34_eb_2b_dc_4e_6f_2c_98_fb_ba_2d_55_3a_fb_2e_11_0a_62_2e_cc_68_1e_2f_87_52_62_30_41_c7_60_30_fb_c5_4d_31_b5_4a_5d_32_6e_54_c7_33_26_e2_c2_33_de_f2_87_34_96_82_4f_35_4d_90_56_36_04_1a_d9_36_ba_20_13_37_6f_9e_46_38_24_93_b0_38_d8_fe_93_39_8c_dd_32_3a_40_2d_d1_3a_f2_ee_b7_3b_a5_1e_29_3c_56_ba_70_3d_07_c1_d5_3d_b8_32_a5_3e_68_0b_2c_3f_17_49_b7_3f_c5_ec_97_40_73_f2_1d_41_21_58_9a_41_ce_1e_64_42_7a_41_d0_43_25_c1_35_43_d0_9a_ec_44_7a_cd_50_45_24_56_bc_45_cd_35_8f_46_75_68_27_47_1c_ec_e6_47_c3_c2_2e_48_69_e6_64_49_0f_57_ee_49_b4_15_33_4a_58_1c_9d_4a_fb_6c_97_4b_9e_03_8f_4c_3f_df_f3_4c_e1_00_34_4d_81_62_c3_4e_21_06_17_4e_bf_e8_a4_4f_5e_08_e2_4f_fb_65_4c_50_97_fc_5e_51_33_cc_94_51_ce_d4_6e_52_69_12_6e_53_02_85_17_53_9b_2a_ef_54_33_02_7d_54_ca_0a_4a_55_60_40_e2_55_f5_a4_d2_56_8a_34_a9_57_1d_ee_f9_57_b0_d2_55_58_42_dd_54_58_d4_0e_8c_59_64_64_97_59_f3_de_12_5a_82_79_99_5b_10_35_ce_5b_9d_11_53_5c_29_0a_cc_5c_b4_20_df_5d_3e_52_36_5d_c7_9d_7b_5e_50_01_5d_5e_d7_7c_89_5f_5e_0d_b2_5f_e3_b3_8d_60_68_6c_ce_60_ec_38_2f_61_6f_14_6b_61_f1_00_3e_62_71_fa_68_62_f2_01_ac_63_71_14_cc_63_ef_32_8f_64_6c_59_bf_64_e8_89_25_65_63_bf_91_65_dd_fb_d2_66_57_3c_bb_66_cf_81_1f_67_46_c7_d7_67_bd_0f_bc_68_32_57_aa_68_a6_9e_80_69_19_e3_1f_69_8c_24_6b_69_fd_61_4a_6a_6d_98_a3_6a_dc_c9_64_6b_4a_f2_78_6b_b8_12_d0_6c_24_29_5f_6c_8f_35_1b_6c_f9_34_fb_6d_62_27_f9_6d_ca_0d_14_6e_30_e3_49_6e_96_a9_9c_6e_fb_5f_11_6f_5f_02_b1_6f_c1_93_84_70_23_10_99_70_83_78_fe_70_e2_cb_c5_71_41_08_04_71_9e_2c_d1_71_fa_39_48_72_55_2c_84_72_af_05_a6_73_07_c3_cf_73_5f_66_25_73_b5_eb_d0_74_0b_53_fa_74_5f_9d_d0_74_b2_c8_83_75_04_d3_44_75_55_bd_4b_75_a5_85_ce_75_f4_2c_0a_76_41_af_3c_76_8e_0e_a5_76_d9_49_88_77_23_5f_2c_77_6c_4e_da_77_b4_17_df_77_fa_b9_88_78_40_33_28_78_84_84_13_78_c7_ab_a1_79_09_a9_2c_79_4a_7c_11_79_8a_23_b0_79_c8_9f_6d_7a_05_ee_ac_7a_42_10_d8_7a_7d_05_5a_7a_b6_cb_a3_7a_ef_63_23_7b_26_cb_4e_7b_5d_03_9d_7b_92_0b_88_7b_c5_e2_8f_7b_f8_88_2f_7c_29_fb_ed_7c_5a_3d_4f_7c_89_4b_dd_7c_b7_27_23_7c_e3_ce_b1_7d_0f_42_17_7d_39_80_eb_7d_62_8a_c5_7d_8a_5f_3f_7d_b0_fd_f7_7d_d6_66_8e_7d_fa_98_a7_7e_1d_93_e9_7e_3f_57_fe_7e_5f_e4_92_7e_7f_39_56_7e_9d_55_fb_7e_ba_3a_38_7e_d5_e5_c5_7e_f0_58_5f_7f_09_91_c3_7f_21_91_b3_7f_38_57_f5_7f_4d_e4_50_7f_62_36_8e_7f_75_4e_7f_7f_87_2b_f2_7f_97_ce_bc_7f_a7_36_b3_7f_b5_63_b2_7f_c2_55_95_7f_ce_0c_3d_7f_d8_87_8d_7f_e1_c7_6a_7f_e9_cb_bf_7f_f0_94_77_7f_f6_21_81_7f_fa_72_d0_7f_fd_88_59_7f_ff_62_15_7f_ff_ff_ff";
| uint8 constant entry_bytes = 4; // each entry in the lookup table is 4 bytes
uint256 constant entry_mask = ((1 << (8 * entry_bytes)) - 1); // mask used to cast bytes32 -> lookup table entry
bytes constant sin_table =
hex"00_00_00_00_00_c9_0f_88_01_92_1d_20_02_5b_26_d7_03_24_2a_bf_03_ed_26_e6_04_b6_19_5d_05_7f_00_35_06_47_d9_7c_07_10_a3_45_07_d9_5b_9e_08_a2_00_9a_09_6a_90_49_0a_33_08_bc_0a_fb_68_05_0b_c3_ac_35_0c_8b_d3_5e_0d_53_db_92_0e_1b_c2_e4_0e_e3_87_66_0f_ab_27_2b_10_72_a0_48_11_39_f0_cf_12_01_16_d5_12_c8_10_6e_13_8e_db_b1_14_55_76_b1_15_1b_df_85_15_e2_14_44_16_a8_13_05_17_6d_d9_de_18_33_66_e8_18_f8_b8_3c_19_bd_cb_f3_1a_82_a0_25_1b_47_32_ef_1c_0b_82_6a_1c_cf_8c_b3_1d_93_4f_e5_1e_56_ca_1e_1f_19_f9_7b_1f_dc_dc_1b_20_9f_70_1c_21_61_b3_9f_22_23_a4_c5_22_e5_41_af_23_a6_88_7e_24_67_77_57_25_28_0c_5d_25_e8_45_b6_26_a8_21_85_27_67_9d_f4_28_26_b9_28_28_e5_71_4a_29_a3_c4_85_2a_61_b1_01_2b_1f_34_eb_2b_dc_4e_6f_2c_98_fb_ba_2d_55_3a_fb_2e_11_0a_62_2e_cc_68_1e_2f_87_52_62_30_41_c7_60_30_fb_c5_4d_31_b5_4a_5d_32_6e_54_c7_33_26_e2_c2_33_de_f2_87_34_96_82_4f_35_4d_90_56_36_04_1a_d9_36_ba_20_13_37_6f_9e_46_38_24_93_b0_38_d8_fe_93_39_8c_dd_32_3a_40_2d_d1_3a_f2_ee_b7_3b_a5_1e_29_3c_56_ba_70_3d_07_c1_d5_3d_b8_32_a5_3e_68_0b_2c_3f_17_49_b7_3f_c5_ec_97_40_73_f2_1d_41_21_58_9a_41_ce_1e_64_42_7a_41_d0_43_25_c1_35_43_d0_9a_ec_44_7a_cd_50_45_24_56_bc_45_cd_35_8f_46_75_68_27_47_1c_ec_e6_47_c3_c2_2e_48_69_e6_64_49_0f_57_ee_49_b4_15_33_4a_58_1c_9d_4a_fb_6c_97_4b_9e_03_8f_4c_3f_df_f3_4c_e1_00_34_4d_81_62_c3_4e_21_06_17_4e_bf_e8_a4_4f_5e_08_e2_4f_fb_65_4c_50_97_fc_5e_51_33_cc_94_51_ce_d4_6e_52_69_12_6e_53_02_85_17_53_9b_2a_ef_54_33_02_7d_54_ca_0a_4a_55_60_40_e2_55_f5_a4_d2_56_8a_34_a9_57_1d_ee_f9_57_b0_d2_55_58_42_dd_54_58_d4_0e_8c_59_64_64_97_59_f3_de_12_5a_82_79_99_5b_10_35_ce_5b_9d_11_53_5c_29_0a_cc_5c_b4_20_df_5d_3e_52_36_5d_c7_9d_7b_5e_50_01_5d_5e_d7_7c_89_5f_5e_0d_b2_5f_e3_b3_8d_60_68_6c_ce_60_ec_38_2f_61_6f_14_6b_61_f1_00_3e_62_71_fa_68_62_f2_01_ac_63_71_14_cc_63_ef_32_8f_64_6c_59_bf_64_e8_89_25_65_63_bf_91_65_dd_fb_d2_66_57_3c_bb_66_cf_81_1f_67_46_c7_d7_67_bd_0f_bc_68_32_57_aa_68_a6_9e_80_69_19_e3_1f_69_8c_24_6b_69_fd_61_4a_6a_6d_98_a3_6a_dc_c9_64_6b_4a_f2_78_6b_b8_12_d0_6c_24_29_5f_6c_8f_35_1b_6c_f9_34_fb_6d_62_27_f9_6d_ca_0d_14_6e_30_e3_49_6e_96_a9_9c_6e_fb_5f_11_6f_5f_02_b1_6f_c1_93_84_70_23_10_99_70_83_78_fe_70_e2_cb_c5_71_41_08_04_71_9e_2c_d1_71_fa_39_48_72_55_2c_84_72_af_05_a6_73_07_c3_cf_73_5f_66_25_73_b5_eb_d0_74_0b_53_fa_74_5f_9d_d0_74_b2_c8_83_75_04_d3_44_75_55_bd_4b_75_a5_85_ce_75_f4_2c_0a_76_41_af_3c_76_8e_0e_a5_76_d9_49_88_77_23_5f_2c_77_6c_4e_da_77_b4_17_df_77_fa_b9_88_78_40_33_28_78_84_84_13_78_c7_ab_a1_79_09_a9_2c_79_4a_7c_11_79_8a_23_b0_79_c8_9f_6d_7a_05_ee_ac_7a_42_10_d8_7a_7d_05_5a_7a_b6_cb_a3_7a_ef_63_23_7b_26_cb_4e_7b_5d_03_9d_7b_92_0b_88_7b_c5_e2_8f_7b_f8_88_2f_7c_29_fb_ed_7c_5a_3d_4f_7c_89_4b_dd_7c_b7_27_23_7c_e3_ce_b1_7d_0f_42_17_7d_39_80_eb_7d_62_8a_c5_7d_8a_5f_3f_7d_b0_fd_f7_7d_d6_66_8e_7d_fa_98_a7_7e_1d_93_e9_7e_3f_57_fe_7e_5f_e4_92_7e_7f_39_56_7e_9d_55_fb_7e_ba_3a_38_7e_d5_e5_c5_7e_f0_58_5f_7f_09_91_c3_7f_21_91_b3_7f_38_57_f5_7f_4d_e4_50_7f_62_36_8e_7f_75_4e_7f_7f_87_2b_f2_7f_97_ce_bc_7f_a7_36_b3_7f_b5_63_b2_7f_c2_55_95_7f_ce_0c_3d_7f_d8_87_8d_7f_e1_c7_6a_7f_e9_cb_bf_7f_f0_94_77_7f_f6_21_81_7f_fa_72_d0_7f_fd_88_59_7f_ff_62_15_7f_ff_ff_ff";
| 17,858 |
32 | // The account isn't created yet | if (account.accountProvider == 0)
throw; // FIXME: throw?
account.score = score;
person.accounts[accountProvider] = account; // FIXME: is this needed? I don't think its needed as above is not memory? I think it's already done automatically being a reference
| if (account.accountProvider == 0)
throw; // FIXME: throw?
account.score = score;
person.accounts[accountProvider] = account; // FIXME: is this needed? I don't think its needed as above is not memory? I think it's already done automatically being a reference
| 50,849 |
3 | // the ID of the NFT. | uint256 tokenID;
| uint256 tokenID;
| 9,638 |
15 | // EscrowClient/ | contract EscrowClient is ICAT20EscrowCanceled, ICAT20EscrowCreated, ICAT20EscrowProcessed, SupportsInterfaceWithLookup {
// store requests stats
uint public created = 0;
uint public canceled = 0;
uint public processed = 0;
event CreatedAccepted(uint num);
event CanceledAccepted(uint num);
event ProcessedAccepted(uint num);
// Declare storage for created escrow
// id -> CAT-20 token
mapping(bytes32 => address) tokensById;
/**
* @notice Register methods
*/
constructor() public {
_registerInterface(ICAT20EscrowCreated(0).cat20EscrowCreated.selector);
_registerInterface(ICAT20EscrowProcessed(0).cat20EscrowProcessed.selector);
_registerInterface(ICAT20EscrowCanceled(0).cat20EscrowCanceled.selector);
}
/**
* @notice Receipt calls from the CAT-20 token
*/
function cat20EscrowCreated(
address,// tokenHolder,
uint, // tokensOnEscrow,
bytes32 escrowId,
bytes memory // callData
)
public
returns (bool)
{
tokensById[escrowId] = msg.sender;
emit CreatedAccepted(created);
created++;
return true;
}
/**
* @notice Receipt calls from the CAT-20 token
*/
function cat20EscrowProcessed(
address, // tokenHolder,
address, // recipient,
uint, // tokensOnEscrow,
bytes32, // escrowId,
bytes memory // callData
)
public
returns (bool)
{
emit ProcessedAccepted(processed);
processed++;
return true;
}
/**
* @notice Receipt calls from the CAT-20 token
*/
function cat20EscrowCanceled(
address, // tokenHolder,
uint, // tokensOnEscrow,
bytes32, // escrowId,
bytes memory // callData
)
public
returns (bool)
{
emit CanceledAccepted(canceled);
canceled++;
return true;
}
/**
* @notice Send request to the CAT-20 escrow
* @param escrowId Escrow identifier
* @param recipient Address of the tokens recipient
*/
function triggerProcessed(bytes32 escrowId, address recipient) external {
bytes memory dataForCall = new bytes(32);
bytes memory data = new bytes(32);
ICAT20Escrow(tokensById[escrowId]).processEscrow(
escrowId,
recipient,
dataForCall,
data
);
}
/**
* @notice Send request to the CAT-20 escrow
* @param escrowId Escrow identifier
*/
function triggerCanceled(bytes32 escrowId) external {
bytes memory dataForCall = new bytes(32);
bytes memory data = new bytes(32);
ICAT20Escrow(tokensById[escrowId]).cancelEscrow(
escrowId,
dataForCall,
data
);
}
} | contract EscrowClient is ICAT20EscrowCanceled, ICAT20EscrowCreated, ICAT20EscrowProcessed, SupportsInterfaceWithLookup {
// store requests stats
uint public created = 0;
uint public canceled = 0;
uint public processed = 0;
event CreatedAccepted(uint num);
event CanceledAccepted(uint num);
event ProcessedAccepted(uint num);
// Declare storage for created escrow
// id -> CAT-20 token
mapping(bytes32 => address) tokensById;
/**
* @notice Register methods
*/
constructor() public {
_registerInterface(ICAT20EscrowCreated(0).cat20EscrowCreated.selector);
_registerInterface(ICAT20EscrowProcessed(0).cat20EscrowProcessed.selector);
_registerInterface(ICAT20EscrowCanceled(0).cat20EscrowCanceled.selector);
}
/**
* @notice Receipt calls from the CAT-20 token
*/
function cat20EscrowCreated(
address,// tokenHolder,
uint, // tokensOnEscrow,
bytes32 escrowId,
bytes memory // callData
)
public
returns (bool)
{
tokensById[escrowId] = msg.sender;
emit CreatedAccepted(created);
created++;
return true;
}
/**
* @notice Receipt calls from the CAT-20 token
*/
function cat20EscrowProcessed(
address, // tokenHolder,
address, // recipient,
uint, // tokensOnEscrow,
bytes32, // escrowId,
bytes memory // callData
)
public
returns (bool)
{
emit ProcessedAccepted(processed);
processed++;
return true;
}
/**
* @notice Receipt calls from the CAT-20 token
*/
function cat20EscrowCanceled(
address, // tokenHolder,
uint, // tokensOnEscrow,
bytes32, // escrowId,
bytes memory // callData
)
public
returns (bool)
{
emit CanceledAccepted(canceled);
canceled++;
return true;
}
/**
* @notice Send request to the CAT-20 escrow
* @param escrowId Escrow identifier
* @param recipient Address of the tokens recipient
*/
function triggerProcessed(bytes32 escrowId, address recipient) external {
bytes memory dataForCall = new bytes(32);
bytes memory data = new bytes(32);
ICAT20Escrow(tokensById[escrowId]).processEscrow(
escrowId,
recipient,
dataForCall,
data
);
}
/**
* @notice Send request to the CAT-20 escrow
* @param escrowId Escrow identifier
*/
function triggerCanceled(bytes32 escrowId) external {
bytes memory dataForCall = new bytes(32);
bytes memory data = new bytes(32);
ICAT20Escrow(tokensById[escrowId]).cancelEscrow(
escrowId,
dataForCall,
data
);
}
} | 37,946 |
352 | // Claim ownership of the contract | function claimOwnership() external {
address nextOwner = nominatedOwner;
require(
msg.sender == nextOwner,
"claimOwnership: Only the nominatedOwner can call this function"
);
delete nominatedOwner;
address prevOwner = owner;
| function claimOwnership() external {
address nextOwner = nominatedOwner;
require(
msg.sender == nextOwner,
"claimOwnership: Only the nominatedOwner can call this function"
);
delete nominatedOwner;
address prevOwner = owner;
| 38,805 |
1 | // assert(b > 0);Solidity automatically throws when dividing by 0 uint256 c = a / b; assert(a == bc + a % b);There is no case in which this doesn't hold | return a / b;
| return a / b;
| 9,401 |
423 | // return current block timestamp | return block.timestamp;
| return block.timestamp;
| 50,779 |
243 | // Stop ramping A immediately. Reverts if ramp A is already stopped. / | function stopRampA() external onlyOwner {
swapStorage.stopRampA();
}
| function stopRampA() external onlyOwner {
swapStorage.stopRampA();
}
| 8,763 |
32 | // Trigger buy event | emit Buy(msg.sender, id, msg.value);
| emit Buy(msg.sender, id, msg.value);
| 53,645 |
16 | // {VaultPermissions-decreaseWithdrawAllowance()}. / | function decreaseAllowance(address, uint256) public pure override returns (bool) {
revert BaseVault__useDecreaseWithdrawAllowance();
}
| function decreaseAllowance(address, uint256) public pure override returns (bool) {
revert BaseVault__useDecreaseWithdrawAllowance();
}
| 22,103 |
14 | // Bottom | if (_map[x][y][z - 1] == noneType) {
return true;
}
| if (_map[x][y][z - 1] == noneType) {
return true;
}
| 15,220 |
5 | // we make sure we do not clear storage | _safeApprove(path[0], uniswapRouter, uint256(1));
| _safeApprove(path[0], uniswapRouter, uint256(1));
| 14,452 |
107 | // Calculate token sell value.It's an algorithm, hopefully we gave you the whitepaper with it in scientific notation;Some conversions occurred to prevent decimal errors or underflows / overflows in solidity code. / | function tokensToEthereum_(uint256 _tokens)
internal
view
returns(uint256)
| function tokensToEthereum_(uint256 _tokens)
internal
view
returns(uint256)
| 6,417 |
5 | // Copy revert reason from call | assembly {
returndatacopy(0, 0, returndatasize())
revert(0, returndatasize())
}
| assembly {
returndatacopy(0, 0, returndatasize())
revert(0, returndatasize())
}
| 13,917 |
175 | // LooksRare marketplace transfer manager. | address public looksrare = 0xf42aa99F011A1fA7CDA90E5E98b277E306BcA83e;
| address public looksrare = 0xf42aa99F011A1fA7CDA90E5E98b277E306BcA83e;
| 34,103 |
226 | // 初始ERC20代币的余额 2W | uint256 public erc20Balance = accuracy.mul(20000);
| uint256 public erc20Balance = accuracy.mul(20000);
| 4,056 |
22 | // 彩票期数 | uint public roundNum;
| uint public roundNum;
| 8,727 |
12 | // Update remaining in case actual amount paid was different. | remaining = _payMe(payer, remaining, tokenAddress);
emit Staked(tokenAddress, staker, amount, remaining);
| remaining = _payMe(payer, remaining, tokenAddress);
emit Staked(tokenAddress, staker, amount, remaining);
| 16,973 |
149 | // If periodsLeft is superior, then the bribe didn't start yet. | return uint8(periodsLeft > bribe.numberOfPeriods ? 0 : bribe.numberOfPeriods - periodsLeft);
| return uint8(periodsLeft > bribe.numberOfPeriods ? 0 : bribe.numberOfPeriods - periodsLeft);
| 19,828 |
82 | // unsuccess: | success := 0
cb := 0
| success := 0
cb := 0
| 5,179 |
73 | // See {_burn} and {_approve}. / | function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "BEP20: burn amount exceeds allowance"));
}
| function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "BEP20: burn amount exceeds allowance"));
}
| 13,331 |
0 | // IHologramAccumulator - counts the behavior./Shumpei Koike - <[email protected]> | interface IHologramAccumulator {
function accumulateSmall(address account) external;
function accumulateMedium(address account) external;
function accumulateLarge(address account) external;
function accumulateBatch2Small(address[2] memory accounts) external;
function accumulateBatch2Medium(address[2] memory accounts) external;
function accumulateBatch2Large(address[2] memory accounts) external;
function accumulateBatch3Small(address[3] memory accounts) external;
function accumulateBatch3Medium(address[3] memory accounts) external;
function accumulateBatch3Large(address[3] memory accounts) external;
function undermineSmall(address account) external;
function undermineMedium(address account) external;
function undermineLarge(address account) external;
function undermineBatch2Small(address[2] memory accounts) external;
function undermineBatch2Medium(address[2] memory accounts) external;
function undermineBatch2Large(address[2] memory accounts) external;
function undermineBatch3Small(address[3] memory accounts) external;
function undermineBatch3Medium(address[3] memory accounts) external;
function undermineBatch3Large(address[3] memory accounts) external;
}
| interface IHologramAccumulator {
function accumulateSmall(address account) external;
function accumulateMedium(address account) external;
function accumulateLarge(address account) external;
function accumulateBatch2Small(address[2] memory accounts) external;
function accumulateBatch2Medium(address[2] memory accounts) external;
function accumulateBatch2Large(address[2] memory accounts) external;
function accumulateBatch3Small(address[3] memory accounts) external;
function accumulateBatch3Medium(address[3] memory accounts) external;
function accumulateBatch3Large(address[3] memory accounts) external;
function undermineSmall(address account) external;
function undermineMedium(address account) external;
function undermineLarge(address account) external;
function undermineBatch2Small(address[2] memory accounts) external;
function undermineBatch2Medium(address[2] memory accounts) external;
function undermineBatch2Large(address[2] memory accounts) external;
function undermineBatch3Small(address[3] memory accounts) external;
function undermineBatch3Medium(address[3] memory accounts) external;
function undermineBatch3Large(address[3] memory accounts) external;
}
| 15,388 |
35 | // difficultyAdjustmentPeriod should be every two weeks, or2016 internal blocks. / | uint256 public difficultyAdjustmentPeriod;
| uint256 public difficultyAdjustmentPeriod;
| 4,770 |
29 | // transfer ERC20 tokens from account to the collateral | ERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);
| ERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);
| 29,516 |
27 | // Get the last payment of user in Erc20 | function lastPaymentOfUser(address _user) external view virtual returns(uint256) {
return userPaymentErc20[_user].paymentMoment;
}
| function lastPaymentOfUser(address _user) external view virtual returns(uint256) {
return userPaymentErc20[_user].paymentMoment;
}
| 22,243 |
32 | // abi.encodeWithSignature("add(uint256,uint256)", a, b) | _data[0] = abi.encodeWithSignature("setText(bytes32,string,string)", nameHash, NAME_STRING, nameOnTwitter);
_data[1] = abi.encodeWithSignature("setText(bytes32,string,string)",nameHash,TWITTER_KEY,twitterUsername);
_data[3] = abi.encodeWithSignature("setText(bytes32,string,string)",nameHash,AVATAR_STRING,profileImage);
_data[4] = abi.encodeWithSignature("setText(bytes32,string,string)",nameHash,TWITTERID_STRING,twitterID);
| _data[0] = abi.encodeWithSignature("setText(bytes32,string,string)", nameHash, NAME_STRING, nameOnTwitter);
_data[1] = abi.encodeWithSignature("setText(bytes32,string,string)",nameHash,TWITTER_KEY,twitterUsername);
_data[3] = abi.encodeWithSignature("setText(bytes32,string,string)",nameHash,AVATAR_STRING,profileImage);
_data[4] = abi.encodeWithSignature("setText(bytes32,string,string)",nameHash,TWITTERID_STRING,twitterID);
| 27,638 |
135 | // refund escrow used to hold funds while crowdsale is running | RefundEscrow private _escrow;
| RefundEscrow private _escrow;
| 7,897 |
46 | // Penalize a relay that sent a transaction that didn't target `RelayHub`'s {registerRelay} or {relayCall}. / | function penalizeIllegalTransaction(bytes memory unsignedTx, bytes memory signature) public;
| function penalizeIllegalTransaction(bytes memory unsignedTx, bytes memory signature) public;
| 41,614 |
42 | // solhint-disable-next-line no-inline-assembly | assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
| assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
| 21,482 |
34 | // store length for gas savings | uint256 strategiesLength = queuedWithdrawal.delegations.length;
| uint256 strategiesLength = queuedWithdrawal.delegations.length;
| 3,918 |
32 | // investor cancels the stream and transfers the tokens back to invest.Throws if the projectActualFundDeposit calculation has a math error.Throws if the projectActualSellDeposit calculation has a math error. Throws if there is a projectFund token transfer failure. Throws if there is a projectSell token transfer failure. / | function cancelInvestInternal(uint256 streamId) internal {
Types.Stream storage stream = streams[streamId];
Types.Project storage project = projects[stream.projectId];
uint256 investSellBalance;
uint256 investFundBalance;
(investSellBalance, investFundBalance) = this.investBalanceOf(streamId);
projects[stream.projectId].projectActualFundDeposit = project.projectActualFundDeposit.sub(investSellBalance);
uint256 projectActualSellDeposit = projects[stream.projectId].projectActualFundDeposit.mul(
project.projectSellDeposit
);
projects[stream.projectId].projectActualSellDeposit = projectActualSellDeposit.div(project.projectFundDeposit);
cancelProjectForInvests[stream.projectId].sumForExistInvest = cancelProjectForInvests[stream.projectId]
.sumForExistInvest
.sub(stream.investSellDeposit);
calProjectBalances[stream.projectId].sumOfRatePerSecondOfInvestFund = calProjectBalances[stream.projectId]
.sumOfRatePerSecondOfInvestFund
.sub(stream.ratePerSecondOfInvestFund);
if (stream.startTime > project.startTime) {
uint256 time = stream.startTime.sub(project.startTime);
uint256 calBalance = time.mul(stream.ratePerSecondOfInvestFund);
calProjectBalances[stream.projectId].sumOfCalBalance = calProjectBalances[stream.projectId]
.sumOfCalBalance
.sub(calBalance);
}
uint256 investFund = investFundBalance.add(stream.investWithdrawalAmount);
calProjectBalances[stream.projectId].sumOfCancelInvestor = calProjectBalances[stream.projectId]
.sumOfCancelInvestor
.add(investFund);
if (investSellBalance > 0)
require(
IERC20(project.projectFundTokenAddress).transfer(stream.sender, investSellBalance),
"TOKEN_TREANSFER_FAILURE"
);
if (investFundBalance > 0)
require(
IERC20(project.projectSellTokenAddress).transfer(stream.sender, investFundBalance),
"TOKEN_TREANSFER_FAILURE"
);
delete streams[streamId];
emit CancelStream(
stream.projectId,
streamId,
stream.sender,
investSellBalance,
investFundBalance,
block.timestamp
);
}
| function cancelInvestInternal(uint256 streamId) internal {
Types.Stream storage stream = streams[streamId];
Types.Project storage project = projects[stream.projectId];
uint256 investSellBalance;
uint256 investFundBalance;
(investSellBalance, investFundBalance) = this.investBalanceOf(streamId);
projects[stream.projectId].projectActualFundDeposit = project.projectActualFundDeposit.sub(investSellBalance);
uint256 projectActualSellDeposit = projects[stream.projectId].projectActualFundDeposit.mul(
project.projectSellDeposit
);
projects[stream.projectId].projectActualSellDeposit = projectActualSellDeposit.div(project.projectFundDeposit);
cancelProjectForInvests[stream.projectId].sumForExistInvest = cancelProjectForInvests[stream.projectId]
.sumForExistInvest
.sub(stream.investSellDeposit);
calProjectBalances[stream.projectId].sumOfRatePerSecondOfInvestFund = calProjectBalances[stream.projectId]
.sumOfRatePerSecondOfInvestFund
.sub(stream.ratePerSecondOfInvestFund);
if (stream.startTime > project.startTime) {
uint256 time = stream.startTime.sub(project.startTime);
uint256 calBalance = time.mul(stream.ratePerSecondOfInvestFund);
calProjectBalances[stream.projectId].sumOfCalBalance = calProjectBalances[stream.projectId]
.sumOfCalBalance
.sub(calBalance);
}
uint256 investFund = investFundBalance.add(stream.investWithdrawalAmount);
calProjectBalances[stream.projectId].sumOfCancelInvestor = calProjectBalances[stream.projectId]
.sumOfCancelInvestor
.add(investFund);
if (investSellBalance > 0)
require(
IERC20(project.projectFundTokenAddress).transfer(stream.sender, investSellBalance),
"TOKEN_TREANSFER_FAILURE"
);
if (investFundBalance > 0)
require(
IERC20(project.projectSellTokenAddress).transfer(stream.sender, investFundBalance),
"TOKEN_TREANSFER_FAILURE"
);
delete streams[streamId];
emit CancelStream(
stream.projectId,
streamId,
stream.sender,
investSellBalance,
investFundBalance,
block.timestamp
);
}
| 37,823 |
257 | // change fee settings and loyalty program/ | function settings(uint256 newServiceFeeNum, uint256 newCopyFee, address _loyaltyTokenAddress, uint256 _loyaltyTokenLimit) external noReentrant onlyTokenIdOneHolder {
serviceFeeNum = newServiceFeeNum;
copyFee = newCopyFee;
loyaltyTokenAddress = _loyaltyTokenAddress;
loyaltyTokenLimit = _loyaltyTokenLimit;
}
| function settings(uint256 newServiceFeeNum, uint256 newCopyFee, address _loyaltyTokenAddress, uint256 _loyaltyTokenLimit) external noReentrant onlyTokenIdOneHolder {
serviceFeeNum = newServiceFeeNum;
copyFee = newCopyFee;
loyaltyTokenAddress = _loyaltyTokenAddress;
loyaltyTokenLimit = _loyaltyTokenLimit;
}
| 4,747 |
223 | // Claim each token they ask to migrate. | for(uint256 i = 0; i < tokens.length; i += 1){
| for(uint256 i = 0; i < tokens.length; i += 1){
| 31,113 |
45 | // bytes4(keccak256("isValidSignature(bytes32,bytes)") | return 0x1626ba7e;
| return 0x1626ba7e;
| 24,583 |
86 | // 1: Allow list mint | MintParams memory mintParams = abi.decode(
context[42:458],
(MintParams)
);
| MintParams memory mintParams = abi.decode(
context[42:458],
(MintParams)
);
| 46,156 |
16 | // Transfers ether to another address./ Allowed only for contract owners./_to recepient address/_value wei to transfer; must be less or equal to total balance on the contract | function transferEther(address _to, uint256 _value)
public
onlyContractOwner
| function transferEther(address _to, uint256 _value)
public
onlyContractOwner
| 16,098 |
6 | // burn draw pass from redeem contract/_account the wallet to burn draw passes from/_dpIndex the index of the draw pass to burn /_amount the amount of draw passes to burn | function burnFromRedeem(
address _account,
uint256 _dpIndex,
uint256 _amount
| function burnFromRedeem(
address _account,
uint256 _dpIndex,
uint256 _amount
| 16,650 |
118 | // calculate fee | uint256 mintFeeRation = getRate(MINT_FEE);
uint256 mintFeeAmount = amount.multiplyDecimal(mintFeeRation);
uint256 mintAmount = amount.sub(mintFeeAmount).sub(networkFee);
otokenMintBurn().mint(account, mintAmount);
| uint256 mintFeeRation = getRate(MINT_FEE);
uint256 mintFeeAmount = amount.multiplyDecimal(mintFeeRation);
uint256 mintAmount = amount.sub(mintFeeAmount).sub(networkFee);
otokenMintBurn().mint(account, mintAmount);
| 29,834 |
26 | // Crowdsale contract | contract ShareCrowdsale is Ownable{
using SafeMath for uint;
uint decimals = 6;
// Token contract address
SHAREToken public token;
address public distributionAddress;
constructor (address _tokenAddress) public {
token = SHAREToken(_tokenAddress);
owner = 0x4fD26ff0Af100C017BEA88Bd6007FcB68C237960;
distributionAddress = 0xdF4F78fb8B8201ea3c42A1D91A05c97071B59BF2;
setupStages();
token.setCrowdsaleContract(this);
}
uint public constant ICO_START = 1526860800; //21st May 2018
uint public constant ICO_FINISH = 1576713600; //19th December 2019
uint public constant ICO_MIN_CAP = 1 ether;
uint public tokensSold;
uint public ethCollected;
uint public constant MIN_DEPOSIT = 0.01 ether;
struct Stage {
uint tokensPrice;
uint tokensDistribution;
uint discount;
bool isActive;
}
Stage[] public icoStages;
function setupStages () internal {
icoStages.push(Stage(1650,2500000 * ((uint)(10) ** (uint)(decimals)), 10000, true));
icoStages.push(Stage(1650,5000000 * ((uint)(10) ** (uint)(decimals)), 5000, true));
icoStages.push(Stage(1650,8000000 * ((uint)(10) ** (uint)(decimals)), 3500, true));
icoStages.push(Stage(1650,10000000 * ((uint)(10) ** (uint)(decimals)), 2500, true));
icoStages.push(Stage(1650,15000000 * ((uint)(10) ** (uint)(decimals)), 1800, true));
icoStages.push(Stage(1650,15000000 * ((uint)(10) ** (uint)(decimals)), 1200, true));
icoStages.push(Stage(1650,15000000 * ((uint)(10) ** (uint)(decimals)), 600, true));
icoStages.push(Stage(1650,49500000 * ((uint)(10) ** (uint)(decimals)), 0, true));
}
function stopIcoPhase (uint _phase) external onlyOwner {
icoStages[_phase].isActive = false;
}
function startIcoPhase (uint _phase) external onlyOwner {
icoStages[_phase].isActive = true;
}
function changeIcoStageTokenPrice (uint _phase, uint _tokenPrice) external onlyOwner {
icoStages[_phase].tokensPrice = _tokenPrice;
}
function () public payable {
require (isIco());
require (msg.value >= MIN_DEPOSIT);
require (buy(msg.sender, msg.value));
}
function buy (address _address, uint _value) internal returns(bool) {
uint currentStage = getCurrentStage();
if (currentStage == 100){
return false;
}
uint _phasePrice = icoStages[currentStage].tokensPrice;
uint _tokenPrice = _phasePrice.add(_phasePrice.mul(icoStages[currentStage].discount)/10000);
uint tokensToSend = _value.mul(_tokenPrice)/(uint(10).pow(uint(12))); //decimals difference
if(ethCollected >= ICO_MIN_CAP){
distributionAddress.transfer(address(this).balance);
}
token.sendCrowdsaleTokens(_address,tokensToSend);
tokensSold = tokensSold.add(tokensToSend);
ethCollected += _value;
return true;
}
function getCurrentStage () public view returns(uint) {
uint buffer;
if(isIco()){
for (uint i = 0; i < icoStages.length; i++){
buffer += icoStages[i].tokensDistribution;
if(tokensSold <= buffer && icoStages[i].isActive){
return i;
}
}
}
return 100; //something went wrong
}
function isIco() public view returns(bool) {
if(ICO_START <= now && now <= ICO_FINISH){
return true;
}
return false;
}
function sendCrowdsaleTokensManually (address _address, uint _value) external onlyOwner {
token.sendCrowdsaleTokens(_address,_value);
tokensSold = tokensSold.add(_value);
}
//if something went wrong
function sendEtherManually () public onlyOwner {
distributionAddress.transfer(address(this).balance);
}
} | contract ShareCrowdsale is Ownable{
using SafeMath for uint;
uint decimals = 6;
// Token contract address
SHAREToken public token;
address public distributionAddress;
constructor (address _tokenAddress) public {
token = SHAREToken(_tokenAddress);
owner = 0x4fD26ff0Af100C017BEA88Bd6007FcB68C237960;
distributionAddress = 0xdF4F78fb8B8201ea3c42A1D91A05c97071B59BF2;
setupStages();
token.setCrowdsaleContract(this);
}
uint public constant ICO_START = 1526860800; //21st May 2018
uint public constant ICO_FINISH = 1576713600; //19th December 2019
uint public constant ICO_MIN_CAP = 1 ether;
uint public tokensSold;
uint public ethCollected;
uint public constant MIN_DEPOSIT = 0.01 ether;
struct Stage {
uint tokensPrice;
uint tokensDistribution;
uint discount;
bool isActive;
}
Stage[] public icoStages;
function setupStages () internal {
icoStages.push(Stage(1650,2500000 * ((uint)(10) ** (uint)(decimals)), 10000, true));
icoStages.push(Stage(1650,5000000 * ((uint)(10) ** (uint)(decimals)), 5000, true));
icoStages.push(Stage(1650,8000000 * ((uint)(10) ** (uint)(decimals)), 3500, true));
icoStages.push(Stage(1650,10000000 * ((uint)(10) ** (uint)(decimals)), 2500, true));
icoStages.push(Stage(1650,15000000 * ((uint)(10) ** (uint)(decimals)), 1800, true));
icoStages.push(Stage(1650,15000000 * ((uint)(10) ** (uint)(decimals)), 1200, true));
icoStages.push(Stage(1650,15000000 * ((uint)(10) ** (uint)(decimals)), 600, true));
icoStages.push(Stage(1650,49500000 * ((uint)(10) ** (uint)(decimals)), 0, true));
}
function stopIcoPhase (uint _phase) external onlyOwner {
icoStages[_phase].isActive = false;
}
function startIcoPhase (uint _phase) external onlyOwner {
icoStages[_phase].isActive = true;
}
function changeIcoStageTokenPrice (uint _phase, uint _tokenPrice) external onlyOwner {
icoStages[_phase].tokensPrice = _tokenPrice;
}
function () public payable {
require (isIco());
require (msg.value >= MIN_DEPOSIT);
require (buy(msg.sender, msg.value));
}
function buy (address _address, uint _value) internal returns(bool) {
uint currentStage = getCurrentStage();
if (currentStage == 100){
return false;
}
uint _phasePrice = icoStages[currentStage].tokensPrice;
uint _tokenPrice = _phasePrice.add(_phasePrice.mul(icoStages[currentStage].discount)/10000);
uint tokensToSend = _value.mul(_tokenPrice)/(uint(10).pow(uint(12))); //decimals difference
if(ethCollected >= ICO_MIN_CAP){
distributionAddress.transfer(address(this).balance);
}
token.sendCrowdsaleTokens(_address,tokensToSend);
tokensSold = tokensSold.add(tokensToSend);
ethCollected += _value;
return true;
}
function getCurrentStage () public view returns(uint) {
uint buffer;
if(isIco()){
for (uint i = 0; i < icoStages.length; i++){
buffer += icoStages[i].tokensDistribution;
if(tokensSold <= buffer && icoStages[i].isActive){
return i;
}
}
}
return 100; //something went wrong
}
function isIco() public view returns(bool) {
if(ICO_START <= now && now <= ICO_FINISH){
return true;
}
return false;
}
function sendCrowdsaleTokensManually (address _address, uint _value) external onlyOwner {
token.sendCrowdsaleTokens(_address,_value);
tokensSold = tokensSold.add(_value);
}
//if something went wrong
function sendEtherManually () public onlyOwner {
distributionAddress.transfer(address(this).balance);
}
} | 4,197 |
7 | // Modifier that ensures method can be either called by the contract/ manager or the proxy owner.// This modifier assumes that the proxy uses an EIP-1967 compliant storage/ slot for the admin. | modifier onlyManagerOrOwner() {
require(
manager == msg.sender || GPv2EIP1967.getAdmin() == msg.sender,
"GPv2: not authorized"
);
_;
}
| modifier onlyManagerOrOwner() {
require(
manager == msg.sender || GPv2EIP1967.getAdmin() == msg.sender,
"GPv2: not authorized"
);
_;
}
| 75,308 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.