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 |
|---|---|---|---|---|
1,327 | // Emit reward retrieval for this vote. |
emit RewardsRetrieved(
voterAddress,
roundId,
toRetrieve[i].identifier,
toRetrieve[i].time,
|
emit RewardsRetrieved(
voterAddress,
roundId,
toRetrieve[i].identifier,
toRetrieve[i].time,
| 1,997 |
16 | // Market | bool public marketPaused;
bool public contractSealed;
mapping(address => uint256) public xDaiBalance;
mapping(bytes32 => bool) public cancelledOffers;
| bool public marketPaused;
bool public contractSealed;
mapping(address => uint256) public xDaiBalance;
mapping(bytes32 => bool) public cancelledOffers;
| 5,255 |
34 | // Returns the count of all users who have interacted with the contract. return _userCount The count of all users who have interacted with the contract./ | function getUserCount() public view returns(uint256 _userCount){
address[] memory _usersArray = userStorage.getUsersArray();
return _usersArray.length;
}
| function getUserCount() public view returns(uint256 _userCount){
address[] memory _usersArray = userStorage.getUsersArray();
return _usersArray.length;
}
| 7,970 |
1 | // lender Address of lender to verifyreturn Value indicating whether given lender address is allowed to put funds into an instrument or not / | function isAllowed(address lender) external view returns (bool);
| function isAllowed(address lender) external view returns (bool);
| 19,357 |
221 | // NiftyPlanetNiftyPlanet shared asset contract / | contract NiftyPlanet is AssetContract, ReentrancyGuard {
mapping(address => bool) public sharedProxyAddresses;
using SafeMath for uint256;
using TokenIdentifiers for uint256;
event CreatorChanged(uint256 indexed _id, address indexed _creator);
mapping(uint256 => address) internal _creatorOverride;
/**
* @dev Require msg.sender to be the creator of the token id
*/
modifier creatorOnly(uint256 _id) {
require(
_isCreatorOrProxy(_id, _msgSender()),
"AssetContractShared#creatorOnly: ONLY_CREATOR_ALLOWED"
);
_;
}
/**
* @dev Require the caller to own the full supply of the token
*/
modifier onlyFullTokenOwner(uint256 _id) {
require(
_ownsTokenAmount(_msgSender(), _id, _id.tokenMaxSupply()),
"AssetContractShared#onlyFullTokenOwner: ONLY_FULL_TOKEN_OWNER_ALLOWED"
);
_;
}
constructor(
string memory _name,
string memory _symbol,
address _proxyRegistryAddress,
string memory _templateURI
)
public
AssetContract(_name, _symbol, _proxyRegistryAddress, _templateURI)
{}
/**
* @dev Allows owner to change the proxy registry
*/
function setProxyRegistryAddress(address _address) public onlyOwner {
proxyRegistryAddress = _address;
}
/**
* @dev Allows owner to add a shared proxy address
*/
function addSharedProxyAddress(address _address) public onlyOwner {
sharedProxyAddresses[_address] = true;
}
/**
* @dev Allows owner to remove a shared proxy address
*/
function removeSharedProxyAddress(address _address) public onlyOwner {
delete sharedProxyAddresses[_address];
}
function mint(
address _to,
uint256 _id,
uint256 _quantity,
bytes memory _data
) public nonReentrant() {
_requireMintable(_msgSender(), _id, _quantity);
_mint(_to, _id, _quantity, _data);
}
function batchMint(
address _to,
uint256[] memory _ids,
uint256[] memory _quantities,
bytes memory _data
) public nonReentrant() {
for (uint256 i = 0; i < _ids.length; i++) {
_requireMintable(_msgSender(), _ids[i], _quantities[i]);
}
_batchMint(_to, _ids, _quantities, _data);
}
/////////////////////////////////
// CONVENIENCE CREATOR METHODS //
/////////////////////////////////
/**
* @dev Will update the URI for the token
* @param _id The token ID to update. msg.sender must be its creator, the uri must be impermanent,
* and the creator must own all of the token supply
* @param _uri New URI for the token.
*/
function setURI(uint256 _id, string memory _uri) public creatorOnly(_id) onlyImpermanentURI(_id) onlyFullTokenOwner(_id) {
_setURI(_id, _uri);
}
/**
* @dev setURI, but permanent
*/
function setPermanentURI(uint256 _id, string memory _uri)
public
creatorOnly(_id)
onlyImpermanentURI(_id)
onlyFullTokenOwner(_id) {
_setPermanentURI(_id, _uri);
}
/**
* @dev Change the creator address for given token
* @param _to Address of the new creator
* @param _id Token IDs to change creator of
*/
function setCreator(uint256 _id, address _to) public creatorOnly(_id) {
require(
_to != address(0),
"AssetContractShared#setCreator: INVALID_ADDRESS."
);
_creatorOverride[_id] = _to;
emit CreatorChanged(_id, _to);
}
/**
* @dev Get the creator for a token
* @param _id The token id to look up
*/
function creator(uint256 _id) public view returns (address) {
if (_creatorOverride[_id] != address(0)) {
return _creatorOverride[_id];
} else {
return _id.tokenCreator();
}
}
/**
* @dev Get the maximum supply for a token
* @param _id The token id to look up
*/
function maxSupply(uint256 _id) public pure returns (uint256) {
return _id.tokenMaxSupply();
}
// Override ERC1155Tradable for birth events
function _origin(uint256 _id) internal view returns (address) {
return _id.tokenCreator();
}
function _requireMintable(
address _address,
uint256 _id,
uint256 _amount
) internal view {
require(
_isCreatorOrProxy(_id, _address),
"AssetContractShared#_requireMintable: ONLY_CREATOR_ALLOWED"
);
require(
_remainingSupply(_id) >= _amount,
"AssetContractShared#_requireMintable: SUPPLY_EXCEEDED"
);
}
function _remainingSupply(uint256 _id) internal view returns (uint256) {
return maxSupply(_id).sub(totalSupply(_id));
}
function _isCreatorOrProxy(uint256 _id, address _address)
internal
view
returns (bool)
{
address creator_ = creator(_id);
return creator_ == _address || _isProxyForUser(creator_, _address);
}
// Overrides ERC1155Tradable to allow a shared proxy address
function _isProxyForUser(address _user, address _address)
internal
view
returns (bool)
{
if (sharedProxyAddresses[_address]) {
return true;
}
return super._isProxyForUser(_user, _address);
}
} | contract NiftyPlanet is AssetContract, ReentrancyGuard {
mapping(address => bool) public sharedProxyAddresses;
using SafeMath for uint256;
using TokenIdentifiers for uint256;
event CreatorChanged(uint256 indexed _id, address indexed _creator);
mapping(uint256 => address) internal _creatorOverride;
/**
* @dev Require msg.sender to be the creator of the token id
*/
modifier creatorOnly(uint256 _id) {
require(
_isCreatorOrProxy(_id, _msgSender()),
"AssetContractShared#creatorOnly: ONLY_CREATOR_ALLOWED"
);
_;
}
/**
* @dev Require the caller to own the full supply of the token
*/
modifier onlyFullTokenOwner(uint256 _id) {
require(
_ownsTokenAmount(_msgSender(), _id, _id.tokenMaxSupply()),
"AssetContractShared#onlyFullTokenOwner: ONLY_FULL_TOKEN_OWNER_ALLOWED"
);
_;
}
constructor(
string memory _name,
string memory _symbol,
address _proxyRegistryAddress,
string memory _templateURI
)
public
AssetContract(_name, _symbol, _proxyRegistryAddress, _templateURI)
{}
/**
* @dev Allows owner to change the proxy registry
*/
function setProxyRegistryAddress(address _address) public onlyOwner {
proxyRegistryAddress = _address;
}
/**
* @dev Allows owner to add a shared proxy address
*/
function addSharedProxyAddress(address _address) public onlyOwner {
sharedProxyAddresses[_address] = true;
}
/**
* @dev Allows owner to remove a shared proxy address
*/
function removeSharedProxyAddress(address _address) public onlyOwner {
delete sharedProxyAddresses[_address];
}
function mint(
address _to,
uint256 _id,
uint256 _quantity,
bytes memory _data
) public nonReentrant() {
_requireMintable(_msgSender(), _id, _quantity);
_mint(_to, _id, _quantity, _data);
}
function batchMint(
address _to,
uint256[] memory _ids,
uint256[] memory _quantities,
bytes memory _data
) public nonReentrant() {
for (uint256 i = 0; i < _ids.length; i++) {
_requireMintable(_msgSender(), _ids[i], _quantities[i]);
}
_batchMint(_to, _ids, _quantities, _data);
}
/////////////////////////////////
// CONVENIENCE CREATOR METHODS //
/////////////////////////////////
/**
* @dev Will update the URI for the token
* @param _id The token ID to update. msg.sender must be its creator, the uri must be impermanent,
* and the creator must own all of the token supply
* @param _uri New URI for the token.
*/
function setURI(uint256 _id, string memory _uri) public creatorOnly(_id) onlyImpermanentURI(_id) onlyFullTokenOwner(_id) {
_setURI(_id, _uri);
}
/**
* @dev setURI, but permanent
*/
function setPermanentURI(uint256 _id, string memory _uri)
public
creatorOnly(_id)
onlyImpermanentURI(_id)
onlyFullTokenOwner(_id) {
_setPermanentURI(_id, _uri);
}
/**
* @dev Change the creator address for given token
* @param _to Address of the new creator
* @param _id Token IDs to change creator of
*/
function setCreator(uint256 _id, address _to) public creatorOnly(_id) {
require(
_to != address(0),
"AssetContractShared#setCreator: INVALID_ADDRESS."
);
_creatorOverride[_id] = _to;
emit CreatorChanged(_id, _to);
}
/**
* @dev Get the creator for a token
* @param _id The token id to look up
*/
function creator(uint256 _id) public view returns (address) {
if (_creatorOverride[_id] != address(0)) {
return _creatorOverride[_id];
} else {
return _id.tokenCreator();
}
}
/**
* @dev Get the maximum supply for a token
* @param _id The token id to look up
*/
function maxSupply(uint256 _id) public pure returns (uint256) {
return _id.tokenMaxSupply();
}
// Override ERC1155Tradable for birth events
function _origin(uint256 _id) internal view returns (address) {
return _id.tokenCreator();
}
function _requireMintable(
address _address,
uint256 _id,
uint256 _amount
) internal view {
require(
_isCreatorOrProxy(_id, _address),
"AssetContractShared#_requireMintable: ONLY_CREATOR_ALLOWED"
);
require(
_remainingSupply(_id) >= _amount,
"AssetContractShared#_requireMintable: SUPPLY_EXCEEDED"
);
}
function _remainingSupply(uint256 _id) internal view returns (uint256) {
return maxSupply(_id).sub(totalSupply(_id));
}
function _isCreatorOrProxy(uint256 _id, address _address)
internal
view
returns (bool)
{
address creator_ = creator(_id);
return creator_ == _address || _isProxyForUser(creator_, _address);
}
// Overrides ERC1155Tradable to allow a shared proxy address
function _isProxyForUser(address _user, address _address)
internal
view
returns (bool)
{
if (sharedProxyAddresses[_address]) {
return true;
}
return super._isProxyForUser(_user, _address);
}
} | 28,348 |
85 | // See {IERC721Metadata-name}. / | function name() public view virtual override returns (string memory) {
return _name;
}
| function name() public view virtual override returns (string memory) {
return _name;
}
| 55,738 |
2 | // Used by the DAppChain Gateway to mint tokens that have been deposited to the Mainnet Gateway | function mintToGateway(uint256 _uid) public {
require(msg.sender == gateway);
_mint(gateway, _uid);
}
| function mintToGateway(uint256 _uid) public {
require(msg.sender == gateway);
_mint(gateway, _uid);
}
| 41,383 |
322 | // Siring auction will throw if the bid fails. | siringAuction.bid.value(currentPrice - auctioneerCut)(_sireId, msg.sender);
_breedWith(uint32(_matronId), uint32(_sireId));
| siringAuction.bid.value(currentPrice - auctioneerCut)(_sireId, msg.sender);
_breedWith(uint32(_matronId), uint32(_sireId));
| 15,260 |
233 | // Get the OPEN STATE/ | function getOpenState() external pure returns (STATE) {
return STATE.OPEN;
}
| function getOpenState() external pure returns (STATE) {
return STATE.OPEN;
}
| 53,291 |
33 | // returns the number of the airlines registred to the contract / | function getAirlinesNumber() external view requireIsOperational returns(uint256)
| function getAirlinesNumber() external view requireIsOperational returns(uint256)
| 39,324 |
84 | // PullPayment Base contract supporting async send for pull payments. Inherit from thiscontract and use _asyncTransfer instead of send or transfer. / | contract PullPayment {
Escrow private _escrow;
constructor () internal {
_escrow = new Escrow();
}
/**
* @dev Withdraw accumulated balance.
* @param payee Whose balance will be withdrawn.
*/
function withdrawPayments(address payable payee) public {
_escrow.withdraw(payee);
}
/**
* @dev Returns the credit owed to an address.
* @param dest The creditor's address.
*/
function payments(address dest) public view returns (uint256) {
return _escrow.depositsOf(dest);
}
/**
* @dev Called by the payer to store the sent amount as credit to be pulled.
* @param dest The destination address of the funds.
* @param amount The amount to transfer.
*/
function _asyncTransfer(address dest, uint256 amount) internal {
_escrow.deposit.value(amount)(dest);
}
}
| contract PullPayment {
Escrow private _escrow;
constructor () internal {
_escrow = new Escrow();
}
/**
* @dev Withdraw accumulated balance.
* @param payee Whose balance will be withdrawn.
*/
function withdrawPayments(address payable payee) public {
_escrow.withdraw(payee);
}
/**
* @dev Returns the credit owed to an address.
* @param dest The creditor's address.
*/
function payments(address dest) public view returns (uint256) {
return _escrow.depositsOf(dest);
}
/**
* @dev Called by the payer to store the sent amount as credit to be pulled.
* @param dest The destination address of the funds.
* @param amount The amount to transfer.
*/
function _asyncTransfer(address dest, uint256 amount) internal {
_escrow.deposit.value(amount)(dest);
}
}
| 47,195 |
21 | // The amount of ETH that is used to allocate to deposits and fill the pending unstake requests. | uint256 public unallocatedETH;
| uint256 public unallocatedETH;
| 32,721 |
1 | // @inheritdoc IEyeconsRebasePoolV1 | function initialize(
uint256 upgradingPrice_,
IERC20MetadataUpgradeable tether_,
address payable treasury_,
address eye_,
address eyecons_,
address authority_
)
external
initializer
| function initialize(
uint256 upgradingPrice_,
IERC20MetadataUpgradeable tether_,
address payable treasury_,
address eye_,
address eyecons_,
address authority_
)
external
initializer
| 41,675 |
204 | // Updates the pending claim start variable, the lowest claim id with a pending decision/payout. / | function setpendingClaimStart(uint _start) external onlyInternal {
require(pendingClaimStart <= _start);
pendingClaimStart = _start;
}
| function setpendingClaimStart(uint _start) external onlyInternal {
require(pendingClaimStart <= _start);
pendingClaimStart = _start;
}
| 33,312 |
5 | // See {IERC1888-issue}./`_to` cannot be the zero address. | function issue(address _to, bytes calldata _validityData, uint256 _topic, uint256 _value, bytes calldata _data) external override returns (uint256 id) {
require(_to != address(0x0), "_to must be non-zero.");
_validate(_msgSender(), _validityData);
id = ++_latestCertificateId;
ERC1155._mint(_to, id, _value, new bytes(0)); // Check **
certificateStorage[id] = Certificate({
topic: _topic,
| function issue(address _to, bytes calldata _validityData, uint256 _topic, uint256 _value, bytes calldata _data) external override returns (uint256 id) {
require(_to != address(0x0), "_to must be non-zero.");
_validate(_msgSender(), _validityData);
id = ++_latestCertificateId;
ERC1155._mint(_to, id, _value, new bytes(0)); // Check **
certificateStorage[id] = Certificate({
topic: _topic,
| 35,100 |
7 | // check if the nft address is erc1155 compliant | require(IERC165(_erc1155).supportsInterface(_INTERFACE_ID_ERC1155));
| require(IERC165(_erc1155).supportsInterface(_INTERFACE_ID_ERC1155));
| 34,318 |
79 | // Collects and distributes the primary sale value of NFTs being claimed. | function _collectMakePiggyFee() internal virtual {
if (makePiggyFee == 0) {
return;
}
require(msg.value == makePiggyFee, "Must send the correct fee");
CurrencyTransferLib.transferCurrency(
CurrencyTransferLib.NATIVE_TOKEN,
msg.sender,
feeRecipient,
makePiggyFee
);
}
| function _collectMakePiggyFee() internal virtual {
if (makePiggyFee == 0) {
return;
}
require(msg.value == makePiggyFee, "Must send the correct fee");
CurrencyTransferLib.transferCurrency(
CurrencyTransferLib.NATIVE_TOKEN,
msg.sender,
feeRecipient,
makePiggyFee
);
}
| 28,274 |
169 | // UTILS // Called by admin on deployment for KNC Approves Kyber Proxy contract to trade KNC Token to approve on proxy contract Pass _reset as true if resetting allowance to zero / | function approveKyberProxyContract(address _token, bool _reset)
external
onlyOwnerOrManager
| function approveKyberProxyContract(address _token, bool _reset)
external
onlyOwnerOrManager
| 75,852 |
226 | // lib/dss-test/lib/dss-interfaces/src/dss/EndAbstract.sol/ pragma solidity >=0.5.12; / https:github.com/makerdao/dss/blob/master/src/end.sol | interface EndAbstract {
function wards(address) external view returns (uint256);
function rely(address) external;
function deny(address) external;
function vat() external view returns (address);
function cat() external view returns (address);
function dog() external view returns (address);
function vow() external view returns (address);
function pot() external view returns (address);
function spot() external view returns (address);
function cure() external view returns (address);
function live() external view returns (uint256);
function when() external view returns (uint256);
function wait() external view returns (uint256);
function debt() external view returns (uint256);
function tag(bytes32) external view returns (uint256);
function gap(bytes32) external view returns (uint256);
function Art(bytes32) external view returns (uint256);
function fix(bytes32) external view returns (uint256);
function bag(address) external view returns (uint256);
function out(bytes32, address) external view returns (uint256);
function file(bytes32, address) external;
function file(bytes32, uint256) external;
function cage() external;
function cage(bytes32) external;
function skip(bytes32, uint256) external;
function snip(bytes32, uint256) external;
function skim(bytes32, address) external;
function free(bytes32) external;
function thaw() external;
function flow(bytes32) external;
function pack(uint256) external;
function cash(bytes32, uint256) external;
}
| interface EndAbstract {
function wards(address) external view returns (uint256);
function rely(address) external;
function deny(address) external;
function vat() external view returns (address);
function cat() external view returns (address);
function dog() external view returns (address);
function vow() external view returns (address);
function pot() external view returns (address);
function spot() external view returns (address);
function cure() external view returns (address);
function live() external view returns (uint256);
function when() external view returns (uint256);
function wait() external view returns (uint256);
function debt() external view returns (uint256);
function tag(bytes32) external view returns (uint256);
function gap(bytes32) external view returns (uint256);
function Art(bytes32) external view returns (uint256);
function fix(bytes32) external view returns (uint256);
function bag(address) external view returns (uint256);
function out(bytes32, address) external view returns (uint256);
function file(bytes32, address) external;
function file(bytes32, uint256) external;
function cage() external;
function cage(bytes32) external;
function skip(bytes32, uint256) external;
function snip(bytes32, uint256) external;
function skim(bytes32, address) external;
function free(bytes32) external;
function thaw() external;
function flow(bytes32) external;
function pack(uint256) external;
function cash(bytes32, uint256) external;
}
| 27,713 |
12 | // Irreversibly activate the kill switch. | kill_switch = true;
| kill_switch = true;
| 19,917 |
211 | // _rollupParams = [ confirmPeriodBlocks, extraChallengeTimeBlocks, arbGasSpeedLimitPerBlock, baseStake ] connectedContracts = [delayedBridge, sequencerInbox, outbox, rollupEventBridge, challengeFactory, nodeFactory] | function initialize(
bytes32 _machineHash,
uint256[4] calldata _rollupParams,
address _stakeToken,
address _owner,
bytes calldata _extraConfig,
address[6] calldata connectedContracts,
address[2] calldata _facets,
uint256[2] calldata sequencerInboxParams
| function initialize(
bytes32 _machineHash,
uint256[4] calldata _rollupParams,
address _stakeToken,
address _owner,
bytes calldata _extraConfig,
address[6] calldata connectedContracts,
address[2] calldata _facets,
uint256[2] calldata sequencerInboxParams
| 35,833 |
10 | // Read the bytes4 from array memory | assembly {
result := mload(add(b, add(index,32)))
| assembly {
result := mload(add(b, add(index,32)))
| 39,432 |
9 | // pause unpause | function pause() public onlyOwner {
_pause();
}
| function pause() public onlyOwner {
_pause();
}
| 12,598 |
150 | // Enable a delegate to act on the behalf of an user | function _addDelegate(address user, address delegate) internal {
require(!delegated[user][delegate], "Delegable: Already delegated");
delegated[user][delegate] = true;
emit Delegate(user, delegate, true);
}
| function _addDelegate(address user, address delegate) internal {
require(!delegated[user][delegate], "Delegable: Already delegated");
delegated[user][delegate] = true;
emit Delegate(user, delegate, true);
}
| 56,352 |
189 | // Multiplies an `Unsigned` and an unscaled uint256 and "ceil's" the product, reverting on overflow. a a FixedPoint. b a FixedPoint.return the product of `a` and `b`. / | function mulCeil(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {
// Since b is an int, there is no risk of truncation and we can just mul it normally
return Unsigned(a.rawValue.mul(b));
}
| function mulCeil(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) {
// Since b is an int, there is no risk of truncation and we can just mul it normally
return Unsigned(a.rawValue.mul(b));
}
| 61,835 |
131 | // Mint tokens for each ids in _ids _to The address to mint tokens to _idsArray of ids to mint _amountsArray of amount of tokens to mint per id _dataData to pass if receiver is contract / | function _batchMint(address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data)
internal
| function _batchMint(address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data)
internal
| 27,171 |
12 | // If block timeFromExpectedUpdate is greater than interpolationThreshold we linearize the current price to try to reduce error | if (timeFromExpectedUpdate < interpolationThreshold) {
return currentEMAValue;
} else {
| if (timeFromExpectedUpdate < interpolationThreshold) {
return currentEMAValue;
} else {
| 27,809 |
94 | // cant take reward asset | require(_token != oliv, "oliv");
| require(_token != oliv, "oliv");
| 14,042 |
11 | // Bonus muliplier for early GovernanceToken makers. | uint256[] public REWARD_MULTIPLIER; // init in constructor function
uint256[] public HALVING_AT_BLOCK; // init in constructor function
uint256[] public blockDeltaStartStage;
uint256[] public blockDeltaEndStage;
uint256[] public userFeeStage;
uint256[] public devFeeStage;
uint256 public FINISH_BONUS_AT_BLOCK;
uint256 public userDepFee;
uint256 public devDepFee;
| uint256[] public REWARD_MULTIPLIER; // init in constructor function
uint256[] public HALVING_AT_BLOCK; // init in constructor function
uint256[] public blockDeltaStartStage;
uint256[] public blockDeltaEndStage;
uint256[] public userFeeStage;
uint256[] public devFeeStage;
uint256 public FINISH_BONUS_AT_BLOCK;
uint256 public userDepFee;
uint256 public devDepFee;
| 17,119 |
263 | // withdraw an amount of shares for underlying | function withdraw(uint256 shares) external override defense {
_withdraw(msg.sender, shares);
}
| function withdraw(uint256 shares) external override defense {
_withdraw(msg.sender, shares);
}
| 5,802 |
73 | // read deposit at specified index and return | return users[_user].deposits[_depositId];
| return users[_user].deposits[_depositId];
| 11,132 |
27 | // define packages here | definePackage("Silver Package", 30, 8);
definePackage("Gold Package", 60, 10);
definePackage("Platinum Package", 90, 12);
| definePackage("Silver Package", 30, 8);
definePackage("Gold Package", 60, 10);
definePackage("Platinum Package", 90, 12);
| 1,659 |
38 | // bool sell = false;this define input for limit | int256 yes = 1;
int256 no = 2;
| int256 yes = 1;
int256 no = 2;
| 4,700 |
49 | // Allows anyone to transfer the Change tokens once trading has started_from address The address which you want to send tokens from_to address The address which you want to transfer to_value uint the amout of tokens to be transfered / | function transferFrom(address _from, address _to, uint _value) hasStartedTrading whenNotPaused public returns (bool) {
return super.transferFrom(_from, _to, _value);
}
| function transferFrom(address _from, address _to, uint _value) hasStartedTrading whenNotPaused public returns (bool) {
return super.transferFrom(_from, _to, _value);
}
| 34,407 |
18 | // Construction method of Extra Holding contract/Arrays of recipients and their share parts should be equal and not empty/Sum of all shares should be exact equal to 10000/_holdingToken is address of affilated contract/_recipients is array of recipients/_partions is array of recipients shares | function ExtraHolderContract(
address _holdingToken,
address[] _recipients,
uint[] _partions)
public
| function ExtraHolderContract(
address _holdingToken,
address[] _recipients,
uint[] _partions)
public
| 41,608 |
19 | // the member is in the systemthe member is not in a community | if ((member[_newMember].isMember = true) && (member[_newMember].memberCommunity == 0)) {
member[_newMember].memberCommunity = _communityID;
member[_newMember].balance = 0;
member[_newMember].creditLine = community[_communityID].defaultCreditLine;
member[_newMember].trust = community[_communityID].defaultTrust;
community[_communityID].nrMembers ++;
JoinCommunity (_newMember, member[_newMember].alias, _communityID, community[_communityID].communityName, now);
}
| if ((member[_newMember].isMember = true) && (member[_newMember].memberCommunity == 0)) {
member[_newMember].memberCommunity = _communityID;
member[_newMember].balance = 0;
member[_newMember].creditLine = community[_communityID].defaultCreditLine;
member[_newMember].trust = community[_communityID].defaultTrust;
community[_communityID].nrMembers ++;
JoinCommunity (_newMember, member[_newMember].alias, _communityID, community[_communityID].communityName, now);
}
| 12,167 |
19 | // Compute the end of the cooldown time (based on current cooldownIndex) | aps.cooldownEndTime = uint48(now + uint256(cooldowns[aps.cooldownIndex]));
| aps.cooldownEndTime = uint48(now + uint256(cooldowns[aps.cooldownIndex]));
| 17,760 |
5 | // Address of the KeeperDAO liquidity pool. This is will be the/ address to which the `helloCallback` function must return all bororwed/ assets (and all excess profits). | address payable public liquidityPool;
| address payable public liquidityPool;
| 21,133 |
19 | // Convenience and rounding functions when dealing with numbers already factored by 1018 or 1027Math operations with safety checks that throw on error/ | library SafeMathFixedPoint {
using SafeMath for uint256;
function mul27(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = x.mul(y).add(5 * 10**26).div(10**27);
}
function mul18(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = x.mul(y).add(5 * 10**17).div(10**18);
}
function div18(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = x.mul(10**18).add(y.div(2)).div(y);
}
function div27(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = x.mul(10**27).add(y.div(2)).div(y);
}
}
| library SafeMathFixedPoint {
using SafeMath for uint256;
function mul27(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = x.mul(y).add(5 * 10**26).div(10**27);
}
function mul18(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = x.mul(y).add(5 * 10**17).div(10**18);
}
function div18(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = x.mul(10**18).add(y.div(2)).div(y);
}
function div27(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = x.mul(10**27).add(y.div(2)).div(y);
}
}
| 15,896 |
168 | // The minimum period of mining (block number) | uint256 public segment = 240;
CynToken public cyn;
address public devaddr;
uint256 public capacity = 1000000000 * 10**18;
uint256 public totalSupply = 0;
| uint256 public segment = 240;
CynToken public cyn;
address public devaddr;
uint256 public capacity = 1000000000 * 10**18;
uint256 public totalSupply = 0;
| 35,986 |
8 | // Mapping of Tier Package BitMap to Tier ID | mapping(uint256 => uint256) internal tiers;
| mapping(uint256 => uint256) internal tiers;
| 8,343 |
60 | // the minted token is added _totalSupply value tokens to be minted _address receiver of minted tokens / | function mint(uint256 value, address _address) external onlyOwner {
_mint(_address, value);
}
| function mint(uint256 value, address _address) external onlyOwner {
_mint(_address, value);
}
| 25,412 |
1 | // Info of each MCV2 user./ `amount` LP token amount the user has provided./ `rewardDebt` Used to calculate the correct amount of rewards. See explanation below.// We do some fancy math here. Basically, any point in time, the amount of POPS/ entitled to a user but is pending to be distributed is:// pending reward = (user sharepool.accPopsPerShare) - user.rewardDebt// Whenever a user deposits or withdraws LP tokens to a pool. Here's what happens:/ 1. The pool's `accPopsPerShare` (and `lastRewardBlock`) gets updated./ 2. User receives the pending reward sent to his/her address./ 3. User's `amount` gets updated. Pool's `totalBoostedShare` gets updated./ 4. | struct UserInfo {
uint256 amount;
uint256 rewardDebt;
uint256 extraRewardDebt;
uint256 boostMultiplier;
}
| struct UserInfo {
uint256 amount;
uint256 rewardDebt;
uint256 extraRewardDebt;
uint256 boostMultiplier;
}
| 24,812 |
14 | // Each farmer starts with 5 fields & 3 Sunflowers | land.push(empty);
land.push(sunflower);
land.push(sunflower);
land.push(sunflower);
land.push(empty);
syncedAt[msg.sender] = block.timestamp;
| land.push(empty);
land.push(sunflower);
land.push(sunflower);
land.push(sunflower);
land.push(empty);
syncedAt[msg.sender] = block.timestamp;
| 52,193 |
39 | // An extra check to prevent re-entrancy through target call. | if (callResult == true) {
require(!transaction.executed, "This transaction has already been executed.");
transaction.executed = true;
}
| if (callResult == true) {
require(!transaction.executed, "This transaction has already been executed.");
transaction.executed = true;
}
| 11,564 |
72 | // // Adjust the scale of an integer adjustment Amount to adjust by e.g. scaleBy(1e18, -1) == 1e17 / | function scaleBy(uint256 x, int8 adjustment)
internal
pure
returns (uint256)
| function scaleBy(uint256 x, int8 adjustment)
internal
pure
returns (uint256)
| 27,203 |
387 | // This function will try encoding a timestamp and output-ing what happens | function encodeTimestamp(uint256 timestamp)
external
returns (string memory)
| function encodeTimestamp(uint256 timestamp)
external
returns (string memory)
| 32,954 |
2 | // Events | event LodgingFacilityCreated(bytes32 facilityId, address indexed owner, string dataURI);
event LodgingFacilityUpdated(bytes32 facilityId, string dataURI);
event LodgingFacilityActiveState(bytes32 facilityId, bool active);
event LodgingFacilityOwnershipTransfer(bytes32 facilityId, address indexed prevOwner, address indexed newOwner);
event LodgingFacilityRemoved(bytes32 facilityId);
event SpaceAdded(bytes32 spaceId, bytes32 facilityId, uint256 capacity, uint256 pricePerNightWei, bool active, string dataURI);
event SpaceUpdated(bytes32 spaceId, uint256 capacity, uint256 pricePerNightWei, string dataURI);
event SpaceRemoved(bytes32 spaceId);
event SpaceActiveState(bytes32 spaceId, bool active);
event NewStay(bytes32 spaceId, uint256 tokenId);
| event LodgingFacilityCreated(bytes32 facilityId, address indexed owner, string dataURI);
event LodgingFacilityUpdated(bytes32 facilityId, string dataURI);
event LodgingFacilityActiveState(bytes32 facilityId, bool active);
event LodgingFacilityOwnershipTransfer(bytes32 facilityId, address indexed prevOwner, address indexed newOwner);
event LodgingFacilityRemoved(bytes32 facilityId);
event SpaceAdded(bytes32 spaceId, bytes32 facilityId, uint256 capacity, uint256 pricePerNightWei, bool active, string dataURI);
event SpaceUpdated(bytes32 spaceId, uint256 capacity, uint256 pricePerNightWei, string dataURI);
event SpaceRemoved(bytes32 spaceId);
event SpaceActiveState(bytes32 spaceId, bool active);
event NewStay(bytes32 spaceId, uint256 tokenId);
| 21,281 |
59 | // Withdraws the ether distributed to the sender./SHOULD transfer `dividendOf(msg.sender)` wei to `msg.sender`, and `dividendOf(msg.sender)` SHOULD be 0 after the transfer./MUST emit a `DividendWithdrawn` event if the amount of ether transferred is greater than 0. | function withdrawDividend() external;
| function withdrawDividend() external;
| 24,022 |
8 | // calculate the quotient and remainder with the given precision | uint256 _precisionFactor = 10**_precision;
uint256 _quotient = _integerAsUint / _denominator;
uint256 _remainder = ((_integerAsUint * _precisionFactor) / _denominator) %
_precisionFactor;
if (_remainder == 0) {
return
string(
abi.encodePacked(_integerToString(_quotient), suffices[(len - 1) / 3])
);
}
| uint256 _precisionFactor = 10**_precision;
uint256 _quotient = _integerAsUint / _denominator;
uint256 _remainder = ((_integerAsUint * _precisionFactor) / _denominator) %
_precisionFactor;
if (_remainder == 0) {
return
string(
abi.encodePacked(_integerToString(_quotient), suffices[(len - 1) / 3])
);
}
| 33,041 |
48 | // ERC165 Interface ID for ERC721TokenReceiver. | interfaceId == this.onERC721Received.selector ||
| interfaceId == this.onERC721Received.selector ||
| 37,940 |
29 | // Sets the reward amount and merkle proof from off-chain. _rewardTokenAddress The reward token address proof the MerkleProof provided by AlphaHomora amount The accumulated (total) amount of rewards. / | function setProofAndAmount(
address _rewardTokenAddress,
bytes32[] calldata proof,
uint256 amount
| function setProofAndAmount(
address _rewardTokenAddress,
bytes32[] calldata proof,
uint256 amount
| 44,410 |
324 | // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96. we then downcast because we know the result always fits within 160 bits due to our tick input constraint we round up in the division so getTickAtSqrtRatio of the output price is always consistent | sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));
| sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));
| 6,313 |
9 | // ---------------------------------------------------------------------------- Ownership contract _newOwner is address of new owner ---------------------------------------------------------------------------- | contract Owned {
address public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = 0x94f5b6461b192B18c143417556Fbe2abB4460476;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
// transfer Ownership to other address
function transferOwnership(address _newOwner) public onlyOwner {
require(_newOwner != address(0x0));
emit OwnershipTransferred(owner,_newOwner);
owner = _newOwner;
}
}
| contract Owned {
address public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = 0x94f5b6461b192B18c143417556Fbe2abB4460476;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
// transfer Ownership to other address
function transferOwnership(address _newOwner) public onlyOwner {
require(_newOwner != address(0x0));
emit OwnershipTransferred(owner,_newOwner);
owner = _newOwner;
}
}
| 42,052 |
59 | // withdraw without caring about Rewards | function emergencyWithdraw(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(depositTime[msg.sender]) > cliffTime, "Please wait before withdrawing!");
lastClaimedTime[msg.sender] = now;
lastDivPoints[msg.sender] = totalDivPoints;
uint fee = amountToWithdraw.mul(withdrawFeePercentX100).div(1e4);
uint amountAfterFee = amountToWithdraw.sub(fee);
require(Token(trustedDepositTokenAddress).transfer(owner, fee), "Could not transfer fee!");
require(Token(trustedDepositTokenAddress).transfer(msg.sender, amountAfterFee), "Could not transfer tokens.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw);
totalTokens = totalTokens.sub(amountToWithdraw);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
| function emergencyWithdraw(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(depositTime[msg.sender]) > cliffTime, "Please wait before withdrawing!");
lastClaimedTime[msg.sender] = now;
lastDivPoints[msg.sender] = totalDivPoints;
uint fee = amountToWithdraw.mul(withdrawFeePercentX100).div(1e4);
uint amountAfterFee = amountToWithdraw.sub(fee);
require(Token(trustedDepositTokenAddress).transfer(owner, fee), "Could not transfer fee!");
require(Token(trustedDepositTokenAddress).transfer(msg.sender, amountAfterFee), "Could not transfer tokens.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw);
totalTokens = totalTokens.sub(amountToWithdraw);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
| 10,452 |
101 | // event for LP added to vBRIGHT tokenAmount amount of tokens added to LP ethAmount ETH paid for purchase liquidity the LP tokenAddress address / | event onLpvAdded(
uint256 tokenAmount,
| event onLpvAdded(
uint256 tokenAmount,
| 84,968 |
66 | // we paid out (using creditCigarettes()) more than the actual CIG harvested. This can happen if rewards were decreased. In this case, cancel out the reward from the paid credit, and remainder will be debited next time fetchCigarettes() is called. | paidCigDebt = paid - cigReward;
| paidCigDebt = paid - cigReward;
| 36,317 |
16 | // File: contracts/interfaces/controller/IManagerActions.sol/控制器合约基金经理操作接口定义 | interface IManagerActions {
/// @notice 设置代币交易路径
/// @dev This function can only be called by manager
/// @dev 设置路径时不能修改为0地址,且path路径里的token必须验证是否受信任
/// @param fund 基金地址
/// @param distToken 目标代币地址
/// @param path 符合uniswap v3格式的交易路径
function setPath(
address fund,
address distToken,
bytes memory path
) external;
/// @notice 初始化头寸, 允许投资额为0.
/// @dev This function can only be called by manager
/// @param fund 基金地址
/// @param token0 token0 地址
/// @param token1 token1 地址
/// @param fee 手续费率
/// @param tickLower 价格刻度下届
/// @param tickUpper 价格刻度上届
/// @param amount 初始化投入金额,允许为0, 为0表示仅初始化头寸,不作实质性投资
function init(
address fund,
address token0,
address token1,
uint24 fee,
int24 tickLower,
int24 tickUpper,
uint amount
) external;
/// @notice 投资指定头寸,可选复投手续费
/// @dev This function can only be called by manager
/// @param fund 基金地址
/// @param poolIndex 池子索引号
/// @param positionIndex 头寸索引号
/// @param amount 投资金额
/// @param collect 是否收集已产生的手续费并复投
function add(
address fund,
uint poolIndex,
uint positionIndex,
uint amount,
bool collect
) external;
/// @notice 撤资指定头寸
/// @dev This function can only be called by manager
/// @param fund 基金地址
/// @param poolIndex 池子索引号
/// @param positionIndex 头寸索引号
/// @param proportionX128 撤资比例,左移128位; 允许为0,为0表示只收集手续费
function sub(
address fund,
uint poolIndex,
uint positionIndex,
uint proportionX128
) external;
/// @notice 调整头寸投资
/// @dev This function can only be called by manager
/// @param fund 基金地址
/// @param poolIndex 池子索引号
/// @param subIndex 要移除的头寸索引号
/// @param addIndex 要添加的头寸索引号
/// @param proportionX128 调整比例,左移128位
function move(
address fund,
uint poolIndex,
uint subIndex,
uint addIndex,
uint proportionX128
) external;
}
| interface IManagerActions {
/// @notice 设置代币交易路径
/// @dev This function can only be called by manager
/// @dev 设置路径时不能修改为0地址,且path路径里的token必须验证是否受信任
/// @param fund 基金地址
/// @param distToken 目标代币地址
/// @param path 符合uniswap v3格式的交易路径
function setPath(
address fund,
address distToken,
bytes memory path
) external;
/// @notice 初始化头寸, 允许投资额为0.
/// @dev This function can only be called by manager
/// @param fund 基金地址
/// @param token0 token0 地址
/// @param token1 token1 地址
/// @param fee 手续费率
/// @param tickLower 价格刻度下届
/// @param tickUpper 价格刻度上届
/// @param amount 初始化投入金额,允许为0, 为0表示仅初始化头寸,不作实质性投资
function init(
address fund,
address token0,
address token1,
uint24 fee,
int24 tickLower,
int24 tickUpper,
uint amount
) external;
/// @notice 投资指定头寸,可选复投手续费
/// @dev This function can only be called by manager
/// @param fund 基金地址
/// @param poolIndex 池子索引号
/// @param positionIndex 头寸索引号
/// @param amount 投资金额
/// @param collect 是否收集已产生的手续费并复投
function add(
address fund,
uint poolIndex,
uint positionIndex,
uint amount,
bool collect
) external;
/// @notice 撤资指定头寸
/// @dev This function can only be called by manager
/// @param fund 基金地址
/// @param poolIndex 池子索引号
/// @param positionIndex 头寸索引号
/// @param proportionX128 撤资比例,左移128位; 允许为0,为0表示只收集手续费
function sub(
address fund,
uint poolIndex,
uint positionIndex,
uint proportionX128
) external;
/// @notice 调整头寸投资
/// @dev This function can only be called by manager
/// @param fund 基金地址
/// @param poolIndex 池子索引号
/// @param subIndex 要移除的头寸索引号
/// @param addIndex 要添加的头寸索引号
/// @param proportionX128 调整比例,左移128位
function move(
address fund,
uint poolIndex,
uint subIndex,
uint addIndex,
uint proportionX128
) external;
}
| 26,926 |
6 | // Returns array of exchange instances for a given pair _tokenThe address of the ERC-1155 token contract _currency The address of the ERC-20 token contract / | function getPairExchanges(address _token, address _currency) public override view returns (address[] memory) {
return pairExchanges[_token][_currency];
}
| function getPairExchanges(address _token, address _currency) public override view returns (address[] memory) {
return pairExchanges[_token][_currency];
}
| 51,643 |
15 | // Get token URI for a given Avastar Token ID.Reverts if given token id is not a valid Avastar Token ID. _tokenId the Token ID of a previously minted Avastar Prime or Replicantreturn uri the off-chain URI to the JSON metadata for the given Avastar / | function tokenURI(uint _tokenId)
external view
returns (string memory uri);
| function tokenURI(uint _tokenId)
external view
returns (string memory uri);
| 30,325 |
11 | // Dividend percentage should be a currently accepted value. | require (validDividendRates_[_divChoice]);
| require (validDividendRates_[_divChoice]);
| 53,469 |
22 | // accumulating penalty amount on each staked withdrawal to be sent to lockwallet | totalPenalty = totalPenalty.add(rewardPenalty);
| totalPenalty = totalPenalty.add(rewardPenalty);
| 47,662 |
118 | // The Token price storage | ITokenPriceRegistry public tokenPriceRegistry;
| ITokenPriceRegistry public tokenPriceRegistry;
| 26,249 |
66 | // fully redeem a past stake | newStakingShareSecondsToBurn = lastStake.stakingShares.mul(stakeTimeSec);
rewardAmount = computeNewReward(rewardAmount, newStakingShareSecondsToBurn, stakeTimeSec);
stakingShareSecondsToBurn = stakingShareSecondsToBurn.add(newStakingShareSecondsToBurn);
sharesLeftToBurn = sharesLeftToBurn.sub(lastStake.stakingShares);
accountStakes.pop();
| newStakingShareSecondsToBurn = lastStake.stakingShares.mul(stakeTimeSec);
rewardAmount = computeNewReward(rewardAmount, newStakingShareSecondsToBurn, stakeTimeSec);
stakingShareSecondsToBurn = stakingShareSecondsToBurn.add(newStakingShareSecondsToBurn);
sharesLeftToBurn = sharesLeftToBurn.sub(lastStake.stakingShares);
accountStakes.pop();
| 3,615 |
38 | // Get the "content hash" of a given subdomain.EIP1577 functionality / | function contenthash(bytes32 nodeID) public view returns (bytes memory) {
uint256 rescueOrder = getRescueOrderFromNodeId(nodeID);
return ContentsMapping[rescueOrder];
}
| function contenthash(bytes32 nodeID) public view returns (bytes memory) {
uint256 rescueOrder = getRescueOrderFromNodeId(nodeID);
return ContentsMapping[rescueOrder];
}
| 45,177 |
284 | // Maps collaterals to their custom fees on interest taken by the protocol./A fixed point number where 1e18 represents 100% and 0 represents 0%. | mapping(ERC20 => uint256) public getCustomFeePercentageForCollateral;
| mapping(ERC20 => uint256) public getCustomFeePercentageForCollateral;
| 61,561 |
304 | // Returns an Ethereum Signed Message, created from `s`. Thisproduces hash corresponding to the one signed with theJSON-RPC method as part of EIP-191. See {recover}. / | function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
| function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
| 20,810 |
26 | // Building the auction object | token_representation memory newAuction;
newAuction.contractAddress = _contract;
newAuction.tokenID = _tokenID;
newAuction.tokenKind = _tokenKind;
newAuction.tokenAmount = _tokenAmount;
uint256 auctionId;
if (_tokenKind == bytes4(keccak256("ERC721"))) {
require(
| token_representation memory newAuction;
newAuction.contractAddress = _contract;
newAuction.tokenID = _tokenID;
newAuction.tokenKind = _tokenKind;
newAuction.tokenAmount = _tokenAmount;
uint256 auctionId;
if (_tokenKind == bytes4(keccak256("ERC721"))) {
require(
| 19,367 |
5 | // Carries per-token metadata. | struct Token {
uint8 version;
uint8 highestRevealed;
// Changing a token to a different version requires an allowance,
// increasing by 1 per day. This is calculated as the difference in time
// since the token's allowance started incrementing, less the amount
// spent. See allowanceOf().
uint64 changeAllowanceStartTime;
int64 spent;
uint8 glitched;
}
| struct Token {
uint8 version;
uint8 highestRevealed;
// Changing a token to a different version requires an allowance,
// increasing by 1 per day. This is calculated as the difference in time
// since the token's allowance started incrementing, less the amount
// spent. See allowanceOf().
uint64 changeAllowanceStartTime;
int64 spent;
uint8 glitched;
}
| 6,187 |
15 | // Update or push new checkpoint | if (last._blockNumber == key) {
_unsafeAccess(self, pos - 1)._value = value;
} else {
| if (last._blockNumber == key) {
_unsafeAccess(self, pos - 1)._value = value;
} else {
| 6,433 |
617 | // Just a sanity case in the worst case if this function is called late (EVM only stores last 256 block hashes) | if (block.number.sub(startingIndexBlock) > 255) {
startingIndex = uint256(blockhash(block.number - 1)) % MAX_ITEMS;
}
| if (block.number.sub(startingIndexBlock) > 255) {
startingIndex = uint256(blockhash(block.number - 1)) % MAX_ITEMS;
}
| 2,889 |
15 | // Protocol-fee rate that will apply to newly-created VFs.E.g. 1.25% would be returned as 0.0125e18 / | function platformFeeRate_e18() external view returns (UFixed256x18) {
return _protocolFeeRate.toUFixed256x18();
}
| function platformFeeRate_e18() external view returns (UFixed256x18) {
return _protocolFeeRate.toUFixed256x18();
}
| 22,354 |
96 | // solhint-disable-next-line avoid-low-level-calls | (success, returnValue) = _contract.call(_data);
emit GENERICCALL1(_contract, _data, success);
| (success, returnValue) = _contract.call(_data);
emit GENERICCALL1(_contract, _data, success);
| 23,438 |
0 | // Whitelist / | function addToWhitelist(address _address) external onlyOwner {
whitelist[_address] = whitelistAllocation;
}
| function addToWhitelist(address _address) external onlyOwner {
whitelist[_address] = whitelistAllocation;
}
| 9,390 |
21 | // Defines a method for performing a delegation of coins from a delegator to a validator./delegatorAddress The address of the delegator/validatorAddress The address of the validator/amount The amount of the Coin to be delegated to the validator | function delegate(
address delegatorAddress,
string memory validatorAddress,
uint256 amount
) external returns (int64 completionTime);
| function delegate(
address delegatorAddress,
string memory validatorAddress,
uint256 amount
) external returns (int64 completionTime);
| 32,034 |
5 | // Require that the color is not pure. | modifier onlyImpureColor(bytes3 color) {
if (isPureColor(color)) revert PureColorNotAllowed();
_;
}
| modifier onlyImpureColor(bytes3 color) {
if (isPureColor(color)) revert PureColorNotAllowed();
_;
}
| 9,415 |
147 | // Function to change the fund owner wallet address/Only Gilgamesh Dev can trigger this function | function changeFundOwnerWalletAddress(address _fundOwnerWallet)
public
validate_address(_fundOwnerWallet)
| function changeFundOwnerWalletAddress(address _fundOwnerWallet)
public
validate_address(_fundOwnerWallet)
| 22,770 |
85 | // Get current day | uint dayIndex = statsByDay.length-1;
Day storage today = statsByDay[dayIndex];
| uint dayIndex = statsByDay.length-1;
Day storage today = statsByDay[dayIndex];
| 50,002 |
0 | // The Ownable constructor sets the original `owner` of the contract/to the sender. | constructor()
| constructor()
| 35,273 |
5 | // solium-disable-next-line linebreak-style / Implements a simple ownership model with 2-phase transfer. | contract Owned {
address public owner;
address public proposedOwner;
constructor() public
{
owner = msg.sender;
}
modifier onlyOwner() {
require(isOwner(msg.sender) == true, 'Require owner to execute transaction');
_;
}
function isOwner(address _address) public view returns (bool) {
return (_address == owner);
}
function initiateOwnershipTransfer(address _proposedOwner) public onlyOwner returns (bool success) {
require(_proposedOwner != address(0), 'Require proposedOwner != address(0)');
require(_proposedOwner != address(this), 'Require proposedOwner != address(this)');
require(_proposedOwner != owner, 'Require proposedOwner != owner');
proposedOwner = _proposedOwner;
return true;
}
function completeOwnershipTransfer() public returns (bool success) {
require(msg.sender == proposedOwner, 'Require msg.sender == proposedOwner');
owner = msg.sender;
proposedOwner = address(0);
return true;
}
}
| contract Owned {
address public owner;
address public proposedOwner;
constructor() public
{
owner = msg.sender;
}
modifier onlyOwner() {
require(isOwner(msg.sender) == true, 'Require owner to execute transaction');
_;
}
function isOwner(address _address) public view returns (bool) {
return (_address == owner);
}
function initiateOwnershipTransfer(address _proposedOwner) public onlyOwner returns (bool success) {
require(_proposedOwner != address(0), 'Require proposedOwner != address(0)');
require(_proposedOwner != address(this), 'Require proposedOwner != address(this)');
require(_proposedOwner != owner, 'Require proposedOwner != owner');
proposedOwner = _proposedOwner;
return true;
}
function completeOwnershipTransfer() public returns (bool success) {
require(msg.sender == proposedOwner, 'Require msg.sender == proposedOwner');
owner = msg.sender;
proposedOwner = address(0);
return true;
}
}
| 24,905 |
32 | // Add the new member | payees.push(payee);
balances[payee] = UserBalance(payees.length, 0);
| payees.push(payee);
balances[payee] = UserBalance(payees.length, 0);
| 36,936 |
7 | // Cryptographic utilities. | library CryptoUtils {
uint8 public constant UNCOMPRESSED_PUBLIC_KEY_SIZE = 64;
/// @dev Verifies ECDSA signature of a given message hash.
/// @param _hash bytes32 The hash which is the signed message.
/// @param _signature bytes The signature to verify.
/// @param _address The public address of the signer (allegedly).
function isSignatureValid(bytes32 _hash, bytes _signature, address _address) public pure returns (bool) {
if (_address == address(0)) {
return false;
}
address recovered = ECDSA.recover(_hash, _signature);
return recovered != address(0) && recovered == _address;
}
/// @dev Converts a public key to an address.
/// @param _publicKey bytes32 The uncompressed public key.
function toAddress(bytes _publicKey) public pure returns (address) {
if (_publicKey.length != UNCOMPRESSED_PUBLIC_KEY_SIZE) {
return address(0);
}
return address(keccak256(_publicKey));
}
/// @dev Verifies the Merkle proof for the existence of a specific data. Please not that that this implementation
/// assumes that each pair of leaves and each pair of pre-images are sorted (see tests for examples of
/// construction).
/// @param _proof bytes32[] The Merkle proof containing sibling SHA256 hashes on the branch from the leaf to the
/// root.
/// @param _root bytes32 The Merkle root.
/// @param _leaf bytes The data to check.
function isMerkleProofValid(bytes32[] _proof, bytes32 _root, bytes _leaf) public pure returns (bool) {
return isMerkleProofValid(_proof, _root, sha256(_leaf));
}
/// @dev Verifies the Merkle proof for the existence of a specific data. Please not that that this implementation
/// assumes that each pair of leaves and each pair of pre-images are sorted (see tests for examples of
/// construction).
/// @param _proof bytes32[] The Merkle proof containing sibling SHA256 hashes on the branch from the leaf to the
/// root.
/// @param _root bytes32 The Merkle root.
/// @param _leafHash bytes32 The hash of the data to check.
function isMerkleProofValid(bytes32[] _proof, bytes32 _root, bytes32 _leafHash) public pure returns (bool) {
bytes32 computedHash = _leafHash;
for (uint256 i = _proof.length; i > 0; i--) {
bytes32 proofElement = _proof[i-1];
if (computedHash < proofElement) {
// Hash the current computed hash with the current element of the proof.
computedHash = sha256(abi.encodePacked(computedHash, proofElement));
} else {
// Hash the current element of the proof with the current computed hash.
computedHash = sha256(abi.encodePacked(proofElement, computedHash));
}
}
// Check if the computed hash (root) is equal to the provided root.
return computedHash == _root;
}
}
| library CryptoUtils {
uint8 public constant UNCOMPRESSED_PUBLIC_KEY_SIZE = 64;
/// @dev Verifies ECDSA signature of a given message hash.
/// @param _hash bytes32 The hash which is the signed message.
/// @param _signature bytes The signature to verify.
/// @param _address The public address of the signer (allegedly).
function isSignatureValid(bytes32 _hash, bytes _signature, address _address) public pure returns (bool) {
if (_address == address(0)) {
return false;
}
address recovered = ECDSA.recover(_hash, _signature);
return recovered != address(0) && recovered == _address;
}
/// @dev Converts a public key to an address.
/// @param _publicKey bytes32 The uncompressed public key.
function toAddress(bytes _publicKey) public pure returns (address) {
if (_publicKey.length != UNCOMPRESSED_PUBLIC_KEY_SIZE) {
return address(0);
}
return address(keccak256(_publicKey));
}
/// @dev Verifies the Merkle proof for the existence of a specific data. Please not that that this implementation
/// assumes that each pair of leaves and each pair of pre-images are sorted (see tests for examples of
/// construction).
/// @param _proof bytes32[] The Merkle proof containing sibling SHA256 hashes on the branch from the leaf to the
/// root.
/// @param _root bytes32 The Merkle root.
/// @param _leaf bytes The data to check.
function isMerkleProofValid(bytes32[] _proof, bytes32 _root, bytes _leaf) public pure returns (bool) {
return isMerkleProofValid(_proof, _root, sha256(_leaf));
}
/// @dev Verifies the Merkle proof for the existence of a specific data. Please not that that this implementation
/// assumes that each pair of leaves and each pair of pre-images are sorted (see tests for examples of
/// construction).
/// @param _proof bytes32[] The Merkle proof containing sibling SHA256 hashes on the branch from the leaf to the
/// root.
/// @param _root bytes32 The Merkle root.
/// @param _leafHash bytes32 The hash of the data to check.
function isMerkleProofValid(bytes32[] _proof, bytes32 _root, bytes32 _leafHash) public pure returns (bool) {
bytes32 computedHash = _leafHash;
for (uint256 i = _proof.length; i > 0; i--) {
bytes32 proofElement = _proof[i-1];
if (computedHash < proofElement) {
// Hash the current computed hash with the current element of the proof.
computedHash = sha256(abi.encodePacked(computedHash, proofElement));
} else {
// Hash the current element of the proof with the current computed hash.
computedHash = sha256(abi.encodePacked(proofElement, computedHash));
}
}
// Check if the computed hash (root) is equal to the provided root.
return computedHash == _root;
}
}
| 7,756 |
26 | // Get the underlying price of a cToken, in the format expected by the Comptroller. Implements the PriceOracle interface for Compound v2. cToken The cToken address for price retrievalreturn Price denominated in USD for the given cToken address, in the format expected by the Comptroller. / | function getUnderlyingPrice(address cToken) external view returns (uint256) {
TokenConfig memory config = getTokenConfigByCToken(cToken);
// Comptroller needs prices in the format: ${raw price} * 1e36 / baseUnit
// The baseUnit of an asset is the amount of the smallest denomination of that asset per whole.
// For example, the baseUnit of NEAR is 1e24.
// Since the prices in this view have 6 decimals, we must scale them by 1e(36 - 6)/baseUnit
return mul(1e30, priceInternal(config)) / config.baseUnit;
}
| function getUnderlyingPrice(address cToken) external view returns (uint256) {
TokenConfig memory config = getTokenConfigByCToken(cToken);
// Comptroller needs prices in the format: ${raw price} * 1e36 / baseUnit
// The baseUnit of an asset is the amount of the smallest denomination of that asset per whole.
// For example, the baseUnit of NEAR is 1e24.
// Since the prices in this view have 6 decimals, we must scale them by 1e(36 - 6)/baseUnit
return mul(1e30, priceInternal(config)) / config.baseUnit;
}
| 14,546 |
152 | // TIME UTILITY FUNCTIONS / | function get_epoch_end(uint256 epoch) public view returns (uint256) {
return epoch_cycle.start_date.add(epoch.add(1).mul(epoch_cycle.duration));
}
| function get_epoch_end(uint256 epoch) public view returns (uint256) {
return epoch_cycle.start_date.add(epoch.add(1).mul(epoch_cycle.duration));
}
| 42,222 |
12 | // Mint a batch of tokens of length `batchSize` for `to`. Returns the token id of the first token minted in thebatch; if `batchSize` is 0, returns the number of consecutive ids minted so far. Requirements: | * - `batchSize` must not be greater than {_maxBatchSize}.
* - The function is called in the constructor of the contract (directly or indirectly).
*
* CAUTION: Does not emit a `Transfer` event. This is ERC721 compliant as long as it is done outside of the
* constructor, which is enforced by this function.
*
* CAUTION: Does not invoke `onERC721Received` on the receiver.
*
* Emits a {IERC2309-ConsecutiveTransfer} event.
*/
function _mintConsecutive(address to, uint96 batchSize) internal virtual returns (uint96) {
uint96 first = _totalConsecutiveSupply();
// minting a batch of size 0 is a no-op
if (batchSize > 0) {
require(!Address.isContract(address(this)), "ERC721Consecutive: batch minting restricted to constructor");
require(to != address(0), "ERC721Consecutive: mint to the zero address");
require(batchSize <= _maxBatchSize(), "ERC721Consecutive: batch too large");
// hook before
_beforeTokenTransfer(address(0), to, first, batchSize);
// push an ownership checkpoint & emit event
uint96 last = first + batchSize - 1;
_sequentialOwnership.push(last, uint160(to));
// The invariant required by this function is preserved because the new sequentialOwnership checkpoint
// is attributing ownership of `batchSize` new tokens to account `to`.
__unsafe_increaseBalance(to, batchSize);
emit ConsecutiveTransfer(first, last, address(0), to);
// hook after
_afterTokenTransfer(address(0), to, first, batchSize);
}
return first;
}
| * - `batchSize` must not be greater than {_maxBatchSize}.
* - The function is called in the constructor of the contract (directly or indirectly).
*
* CAUTION: Does not emit a `Transfer` event. This is ERC721 compliant as long as it is done outside of the
* constructor, which is enforced by this function.
*
* CAUTION: Does not invoke `onERC721Received` on the receiver.
*
* Emits a {IERC2309-ConsecutiveTransfer} event.
*/
function _mintConsecutive(address to, uint96 batchSize) internal virtual returns (uint96) {
uint96 first = _totalConsecutiveSupply();
// minting a batch of size 0 is a no-op
if (batchSize > 0) {
require(!Address.isContract(address(this)), "ERC721Consecutive: batch minting restricted to constructor");
require(to != address(0), "ERC721Consecutive: mint to the zero address");
require(batchSize <= _maxBatchSize(), "ERC721Consecutive: batch too large");
// hook before
_beforeTokenTransfer(address(0), to, first, batchSize);
// push an ownership checkpoint & emit event
uint96 last = first + batchSize - 1;
_sequentialOwnership.push(last, uint160(to));
// The invariant required by this function is preserved because the new sequentialOwnership checkpoint
// is attributing ownership of `batchSize` new tokens to account `to`.
__unsafe_increaseBalance(to, batchSize);
emit ConsecutiveTransfer(first, last, address(0), to);
// hook after
_afterTokenTransfer(address(0), to, first, batchSize);
}
return first;
}
| 10,409 |
26 | // withdraw AVT fees associated with each node for each month for a particular staker. node the index of the node from which fees are being withdrawn month the month for which the fees are being withdrawn / | function withdrawFees(uint8 node, uint8 month)
external
| function withdrawFees(uint8 node, uint8 month)
external
| 36,221 |
12 | // The second of the two tokens of the pool, sorted by address/ return The token contract address | function token1() external view returns (address);
| function token1() external view returns (address);
| 13,041 |
42 | // Check already added | require(participants[_participant].exists == true);
| require(participants[_participant].exists == true);
| 28,833 |
15 | // Reviews Function | function addReviews(uint256 productId, uint256 rating, string calldata comment, address user) external {
require(rating >= 1 && rating <= 5, "rating must be between 1 and 5");
Property storage property = properties[productId];
property.reviewers.push(user);
property.reviews.push(comment);
//Reviewsection
reviews[productId].push(Review(user, productId, rating, comment, 0));
userReviews[user].push(productId);
products[productId].totalRating += rating;
products[productId].numReviews++;
emit ReviewAdded(productId, user, rating, comment);
reviewsCounter++;
}
| function addReviews(uint256 productId, uint256 rating, string calldata comment, address user) external {
require(rating >= 1 && rating <= 5, "rating must be between 1 and 5");
Property storage property = properties[productId];
property.reviewers.push(user);
property.reviews.push(comment);
//Reviewsection
reviews[productId].push(Review(user, productId, rating, comment, 0));
userReviews[user].push(productId);
products[productId].totalRating += rating;
products[productId].numReviews++;
emit ReviewAdded(productId, user, rating, comment);
reviewsCounter++;
}
| 23,845 |
217 | // ----------------------------------------------------------------------------/BozyICO : ERC Token ICO - 0.00001 ETH/BOZY with max-cap of 60,000 ETH ---------------------------------------------------------------------------- | contract BozyICO is Bozy {
// Define public constant variables
mapping(address => uint256) public contributions;
address payable public deposit;
address public admin;
uint256 public raisedAmount;
uint256 public icoTokenSold;
uint256 public hardCap = 4000 ether;
//uint256 public goal = 2000 ether;
//uint256 public saleStart = block.timestamp + 30 days;
//uint256 public saleEnd = saleStart + 100 days;
//uint256 public TokenTransferStart = saleEnd + 10 days;
uint256 public maxContribution = 10 ether;
uint256 public minContribution = 0.001 ether;
bool public emergencyMode = false;
uint256 public goal = 300 ether; // test
uint256 public saleStart = block.timestamp + 30 seconds; // test
uint256 public saleEnd = saleStart + 3 minutes; // test
uint256 public TokenTransferStart = saleEnd + 1 minutes; // test
/// @param beforeStart : Returns 0 before ICO starts.
/// @param running : Returns 1 when ICO is running.
/// @param afterEnd : Returns 2 when ICO has ended.
/// @param halted : Returns 3 when ICO is paused.
enum State {beforeStart, running, afterEnd, halted}
State icoState;
/// @dev Triggers on any successful call to contribute().
/// @param _contributor : The address donating to the ICO.
/// @param _amount: The quantity in ETH of the contribution.
/// @param _tokens : The quantity of tokens sent to the contributor.
event Contribute(address _contributor, uint256 _amount, uint256 _tokens);
/// @dev All three of these values are immutable: set on construction.
constructor(address payable _deposit) {
deposit = _deposit;
admin = _msgSender();
icoState = State.beforeStart;
}
/// @dev Sends ETH.
receive() payable external {
contribute();
}
/// @notice Pauses ICO contribution.
function haltICO() public onlyFounder {
// Set the state to halt.
icoState = State.halted;
}
/// @notice Resumes ICO contribution.
function resumeICO() public onlyFounder {
// Set the state to running.
icoState = State.running;
}
/// @notice Changes the deposit address.
function changeDepositAddress(address payable _newDeposit) public onlyFounder {
// Change deposit address to a new one.
deposit = _newDeposit;
}
/// @notice Contributes to the ICO.
/// @notice MUST trigger Contribute event.
function contribute() payable public noneZero(_msgSender()) returns (bool success) {
// Set ICO state to the current state.
icoState = getICOState();
/// @dev Requires the ICO to be running.
require(icoState == State.running, "ICO is not running. Check ICO state.");
/// @dev Requires the value be greater than min. contribution and less than max. contribution.
require(_msgValue() >= minContribution && _msgValue() <= maxContribution, "Contribution out of range.");
/// @dev Requires the raised amount `raisedAmount` is at least less than the `hardCap`.
require(raisedAmount <= hardCap, "HardCap has been reached.");
// Increase raised amount of ETH. 0000.0009 - 90000
raisedAmount += _msgValue();
// Set token amount.
uint256 _tokens = (_msgValue() / tokenPrice) * (10 ** decimals);
// Check deposit balance.
uint256 _depositBalance = contributions[deposit];
// Increase ICO token sold amount.
icoTokenSold += _tokens;
// Increase Contributor ETH contribution.
contributions[_msgSender()] += _msgValue();
// Increase Deposit ETH balances.
contributions[deposit] = _depositBalance + _msgValue();
// Increase Contributor token holdings.
balances[_msgSender()] += _tokens;
// Decrease founder token holdings.
balances[founder] -= _tokens;
// Transfer ETH to deposit account.
payable(deposit).transfer(_msgValue());
// See {event Contribute}
emit Contribute(_msgSender(), _msgValue(), _tokens);
// Returns true on success.
return true;
}
/// @dev See {Bozy - transfer}
function transfer(address _to, uint256 _tokens) public override returns (bool success) {
/// @dev Requires the ICO has started.
require(block.timestamp > saleStart, "ICO is not running.");
/// @dev Requires the raisedAmount amount is greater than the goal.
require(block.timestamp > TokenTransferStart, "Transfer starts after ICO has ended.");
// Get the contract from ERC20.
Bozy.transfer(_to, _tokens);
// Returns true on success.
return true;
}
/// @dev See {Bozy - transferFrom}
function transferFrom(
address _from,
address _to,
uint256 _tokens
) public override returns (bool success) {
/// @dev Requires the ICO has started.
require(block.timestamp > saleStart, "ICO is not running.");
/// @dev Requires the raisedAmount amount is greater than the goal.
require(block.timestamp > TokenTransferStart, "Transfer starts after ICO has ended.");
// Get the contract one level higher in the inheritance hierarchy.
Bozy.transferFrom(_from, _to, _tokens);
// Returns true on success.
return true;
}
/// @notice Returns current ico states. Check {enum State}
function getICOState() public view returns(State) {
if(icoState == State.halted) {
return State.halted; // returns 3
} else
if(block.timestamp < saleStart) {
return State.beforeStart; // returns 0
} else if(block.timestamp >= saleStart && block.timestamp <= saleEnd) {
return State.running; // returns 1
} else {
return State.afterEnd; // returns 2
}
}
}
| contract BozyICO is Bozy {
// Define public constant variables
mapping(address => uint256) public contributions;
address payable public deposit;
address public admin;
uint256 public raisedAmount;
uint256 public icoTokenSold;
uint256 public hardCap = 4000 ether;
//uint256 public goal = 2000 ether;
//uint256 public saleStart = block.timestamp + 30 days;
//uint256 public saleEnd = saleStart + 100 days;
//uint256 public TokenTransferStart = saleEnd + 10 days;
uint256 public maxContribution = 10 ether;
uint256 public minContribution = 0.001 ether;
bool public emergencyMode = false;
uint256 public goal = 300 ether; // test
uint256 public saleStart = block.timestamp + 30 seconds; // test
uint256 public saleEnd = saleStart + 3 minutes; // test
uint256 public TokenTransferStart = saleEnd + 1 minutes; // test
/// @param beforeStart : Returns 0 before ICO starts.
/// @param running : Returns 1 when ICO is running.
/// @param afterEnd : Returns 2 when ICO has ended.
/// @param halted : Returns 3 when ICO is paused.
enum State {beforeStart, running, afterEnd, halted}
State icoState;
/// @dev Triggers on any successful call to contribute().
/// @param _contributor : The address donating to the ICO.
/// @param _amount: The quantity in ETH of the contribution.
/// @param _tokens : The quantity of tokens sent to the contributor.
event Contribute(address _contributor, uint256 _amount, uint256 _tokens);
/// @dev All three of these values are immutable: set on construction.
constructor(address payable _deposit) {
deposit = _deposit;
admin = _msgSender();
icoState = State.beforeStart;
}
/// @dev Sends ETH.
receive() payable external {
contribute();
}
/// @notice Pauses ICO contribution.
function haltICO() public onlyFounder {
// Set the state to halt.
icoState = State.halted;
}
/// @notice Resumes ICO contribution.
function resumeICO() public onlyFounder {
// Set the state to running.
icoState = State.running;
}
/// @notice Changes the deposit address.
function changeDepositAddress(address payable _newDeposit) public onlyFounder {
// Change deposit address to a new one.
deposit = _newDeposit;
}
/// @notice Contributes to the ICO.
/// @notice MUST trigger Contribute event.
function contribute() payable public noneZero(_msgSender()) returns (bool success) {
// Set ICO state to the current state.
icoState = getICOState();
/// @dev Requires the ICO to be running.
require(icoState == State.running, "ICO is not running. Check ICO state.");
/// @dev Requires the value be greater than min. contribution and less than max. contribution.
require(_msgValue() >= minContribution && _msgValue() <= maxContribution, "Contribution out of range.");
/// @dev Requires the raised amount `raisedAmount` is at least less than the `hardCap`.
require(raisedAmount <= hardCap, "HardCap has been reached.");
// Increase raised amount of ETH. 0000.0009 - 90000
raisedAmount += _msgValue();
// Set token amount.
uint256 _tokens = (_msgValue() / tokenPrice) * (10 ** decimals);
// Check deposit balance.
uint256 _depositBalance = contributions[deposit];
// Increase ICO token sold amount.
icoTokenSold += _tokens;
// Increase Contributor ETH contribution.
contributions[_msgSender()] += _msgValue();
// Increase Deposit ETH balances.
contributions[deposit] = _depositBalance + _msgValue();
// Increase Contributor token holdings.
balances[_msgSender()] += _tokens;
// Decrease founder token holdings.
balances[founder] -= _tokens;
// Transfer ETH to deposit account.
payable(deposit).transfer(_msgValue());
// See {event Contribute}
emit Contribute(_msgSender(), _msgValue(), _tokens);
// Returns true on success.
return true;
}
/// @dev See {Bozy - transfer}
function transfer(address _to, uint256 _tokens) public override returns (bool success) {
/// @dev Requires the ICO has started.
require(block.timestamp > saleStart, "ICO is not running.");
/// @dev Requires the raisedAmount amount is greater than the goal.
require(block.timestamp > TokenTransferStart, "Transfer starts after ICO has ended.");
// Get the contract from ERC20.
Bozy.transfer(_to, _tokens);
// Returns true on success.
return true;
}
/// @dev See {Bozy - transferFrom}
function transferFrom(
address _from,
address _to,
uint256 _tokens
) public override returns (bool success) {
/// @dev Requires the ICO has started.
require(block.timestamp > saleStart, "ICO is not running.");
/// @dev Requires the raisedAmount amount is greater than the goal.
require(block.timestamp > TokenTransferStart, "Transfer starts after ICO has ended.");
// Get the contract one level higher in the inheritance hierarchy.
Bozy.transferFrom(_from, _to, _tokens);
// Returns true on success.
return true;
}
/// @notice Returns current ico states. Check {enum State}
function getICOState() public view returns(State) {
if(icoState == State.halted) {
return State.halted; // returns 3
} else
if(block.timestamp < saleStart) {
return State.beforeStart; // returns 0
} else if(block.timestamp >= saleStart && block.timestamp <= saleEnd) {
return State.running; // returns 1
} else {
return State.afterEnd; // returns 2
}
}
}
| 4,877 |
35 | // compute bonus tokens | uint256 bonusTokenAmount = communityTokenAmount.mul(15);
bonusTokenAmount = bonusTokenAmount.div(100);
| uint256 bonusTokenAmount = communityTokenAmount.mul(15);
bonusTokenAmount = bonusTokenAmount.div(100);
| 4,367 |
141 | // `p` contains real length of the buffer now, allocate the resulting buffer of that size | bytes memory result = new bytes(p);
| bytes memory result = new bytes(p);
| 66,848 |
15 | // fixing lockup in safe | bool internal lockupIsSet;
| bool internal lockupIsSet;
| 37,994 |
342 | // VaultLib Contract/Enzyme Council <[email protected]>/The per-release proxiable library contract for VaultProxy/The difference in terminology between "asset" and "trackedAsset" is intentional./ A fund might actually have asset balances of un-tracked assets,/ but only tracked assets are used in gav calculations./ Note that this contract inherits VaultLibSafeMath (a verbatim Open Zeppelin SafeMath copy)/ from SharesTokenBase via VaultLibBase1 | contract VaultLib is VaultLibBase1, IVault {
using SafeERC20 for ERC20;
| contract VaultLib is VaultLibBase1, IVault {
using SafeERC20 for ERC20;
| 63,341 |
7 | // Initialises contract to non-paused / | function EmergencySafe() public {
paused = false;
}
| function EmergencySafe() public {
paused = false;
}
| 25,188 |
51 | // Globally enable or disable admin access. / | bool allowAdmins = true;
| bool allowAdmins = true;
| 11,616 |
71 | // Adds Liquidity directly to the contract where LP are locked | function _addLiquidity(uint tokenamount, uint ethamount) private {
_approve(address(this), address(_uniswapRouter), tokenamount);
_uniswapRouter.addLiquidityETH{value: ethamount}(
address(this),
tokenamount,
0,
0,
address(this),
block.timestamp
);
}
| function _addLiquidity(uint tokenamount, uint ethamount) private {
_approve(address(this), address(_uniswapRouter), tokenamount);
_uniswapRouter.addLiquidityETH{value: ethamount}(
address(this),
tokenamount,
0,
0,
address(this),
block.timestamp
);
}
| 7,949 |
156 | // Spend `amount` form the allowance of `owner` toward `spender`. Does not update the allowance amount in case of infinite allowance.Revert if not enough allowance is available. | * Might emit an {Approval} event.
*/
function _spendAllowance(
address owner,
address spender,
uint256 amount
) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
| * Might emit an {Approval} event.
*/
function _spendAllowance(
address owner,
address spender,
uint256 amount
) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
| 1,700 |
43 | // In each step, the numerator is multiplied by z^2 | num = (num * z_squared) / ONE_20;
seriesSum += num / 3;
num = (num * z_squared) / ONE_20;
seriesSum += num / 5;
num = (num * z_squared) / ONE_20;
seriesSum += num / 7;
num = (num * z_squared) / ONE_20;
| num = (num * z_squared) / ONE_20;
seriesSum += num / 3;
num = (num * z_squared) / ONE_20;
seriesSum += num / 5;
num = (num * z_squared) / ONE_20;
seriesSum += num / 7;
num = (num * z_squared) / ONE_20;
| 38,840 |
48 | // queue is released by distributeRewards() / | function _addIntoQueue(address staker, address recipient, uint256 amount) internal {
require(
amount != 0 && recipient != address(0),
"GlobalPool: zero input values"
);
_pendingTotalUnstakes = _pendingTotalUnstakes.add(amount);
_pendingUnstakeClaimers.push(recipient);
_pendingUnstakeRequests.push(amount);
_pendingClaimerUnstakes[recipient] = _pendingClaimerUnstakes[recipient].add(amount);
}
| function _addIntoQueue(address staker, address recipient, uint256 amount) internal {
require(
amount != 0 && recipient != address(0),
"GlobalPool: zero input values"
);
_pendingTotalUnstakes = _pendingTotalUnstakes.add(amount);
_pendingUnstakeClaimers.push(recipient);
_pendingUnstakeRequests.push(amount);
_pendingClaimerUnstakes[recipient] = _pendingClaimerUnstakes[recipient].add(amount);
}
| 8,231 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.