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 |
|---|---|---|---|---|
34 | // Kam Amini <kam@arteq.io> <kam@2b.team> <kam.cpp@gmail.com>// Reviewed and revised by: Masoud Khosravi <masoud_at_2b.team> <mkh_at_arteq.io>/Ali Jafari <ali_at_2b.team> <aj_at_arteq.io>//The admin contract managing all other artèQ contracts// We achieve the followings by using this contract as the admin/ account of a... | contract arteQAdmin is IarteQAdmin {
uint public MAX_NR_OF_ADMINS = 10;
uint public MIN_NR_OF_ADMINS = 5;
mapping (address => uint) private _admins;
mapping (address => uint) private _finalizers;
mapping (uint256 => uint) private _tasks;
mapping (uint256 => mapping(address => uint)) private _... | contract arteQAdmin is IarteQAdmin {
uint public MAX_NR_OF_ADMINS = 10;
uint public MIN_NR_OF_ADMINS = 5;
mapping (address => uint) private _admins;
mapping (address => uint) private _finalizers;
mapping (uint256 => uint) private _tasks;
mapping (uint256 => mapping(address => uint)) private _... | 47,525 |
24 | // Allows batched call to self (this contract)./calls An array of inputs for each call./revertOnFail If True, reverts after a failed call and stops further calls. | function batch(bytes[] calldata calls, bool revertOnFail) external {
for (uint256 i = 0; i < calls.length; i++) {
(bool success, bytes memory result) = address(this).delegatecall(calls[i]);
if (!success && revertOnFail) {
revert(_getRevertMsg(result));
}
... | function batch(bytes[] calldata calls, bool revertOnFail) external {
for (uint256 i = 0; i < calls.length; i++) {
(bool success, bytes memory result) = address(this).delegatecall(calls[i]);
if (!success && revertOnFail) {
revert(_getRevertMsg(result));
}
... | 71,568 |
2 | // Slice of methods of MasterChefV2 contract used in StakingRewardsSushi contract | interface IMasterChefV2 {
function lpToken(uint256 pid) external view returns (IERC20 _lpToken);
}
| interface IMasterChefV2 {
function lpToken(uint256 pid) external view returns (IERC20 _lpToken);
}
| 40,602 |
197 | // no votes, no rewards | if (numVotes == 0) {
return 0;
}
| if (numVotes == 0) {
return 0;
}
| 13,880 |
6,522 | // 3263 | entry "vandalically" : ENG_ADVERB
| entry "vandalically" : ENG_ADVERB
| 24,099 |
206 | // Wildcard bonus | if (maxIndex < 4) {
maxCount += _clanCounter[5];
}
| if (maxIndex < 4) {
maxCount += _clanCounter[5];
}
| 67,277 |
119 | // Changes the value of `performanceFee`./ Should set this value below the maximum strategist performance fee./ This may only be called by `governance`./fee The new performance fee to use. | function setPerformanceFee(
uint256 fee
| function setPerformanceFee(
uint256 fee
| 68,244 |
6 | // Increment product count | productCount ++;
| productCount ++;
| 51,146 |
20 | // change the funding end block | function changeEndBlock(uint256 _newFundingEndBlock) onlyOwner{
fundingEndBlock = _newFundingEndBlock;
}
| function changeEndBlock(uint256 _newFundingEndBlock) onlyOwner{
fundingEndBlock = _newFundingEndBlock;
}
| 26,235 |
85 | // Read the bytes4 from array memory | assembly {
result := mload(add(b, index))
// Solidity does not require us to clean the trailing bytes.
// We do it anyway
result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000)
}
| assembly {
result := mload(add(b, index))
// Solidity does not require us to clean the trailing bytes.
// We do it anyway
result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000)
}
| 23,761 |
223 | // Distribute any reward shares earned by the strategy on this report | distributeRewards();
| distributeRewards();
| 26,266 |
136 | // This function include a new blockchain in the list of allowed blockchains used in the bridge. Only owner can call it. Can not be called if the Bridge is paused. Parameters:- string name of blockchain to be added- minGasPrice- minTokenAmount- check address EVM compatible Returns: index of blockchain. Important:- inde... | function addBlockchain(
string memory name,
uint256 minGasPrice,
uint256 minTokenAmount,
bool checkAddress
| function addBlockchain(
string memory name,
uint256 minGasPrice,
uint256 minTokenAmount,
bool checkAddress
| 43,493 |
126 | // Calls {_authorizeUpgrade}. Emits an {Upgraded} event. @custom:oz-upgrades-unsafe-allow-reachable delegatecall / | function upgradeTo(address newImplementation) public virtual onlyProxy {
_authorizeUpgrade(newImplementation);
_upgradeToAndCallUUPS(newImplementation, new bytes(0), false);
}
| function upgradeTo(address newImplementation) public virtual onlyProxy {
_authorizeUpgrade(newImplementation);
_upgradeToAndCallUUPS(newImplementation, new bytes(0), false);
}
| 28,090 |
50 | // Calculate the amount that is expected to be swapped | swapAmountIn = _calculateAmountToSwapForRebalancing(
_token0AmountIn,
_token1AmountIn,
reserveA,
reserveB,
sellToken0
);
| swapAmountIn = _calculateAmountToSwapForRebalancing(
_token0AmountIn,
_token1AmountIn,
reserveA,
reserveB,
sellToken0
);
| 11,818 |
207 | // Protected function that can only be called from`simulateActionWithAtomicBatchCalls` on this contract. It will attempt toperform each specified call, populating the array of results as it goes,unless a failure occurs, at which point it will revert and "return" thearray of results as revert data. Regardless, it will r... | function _simulateActionWithAtomicBatchCallsAtomic(
Call[] memory calls
| function _simulateActionWithAtomicBatchCallsAtomic(
Call[] memory calls
| 7,935 |
264 | // proposal.stakes[NO] cannot be zero as the dao downstake > 0 for each proposal. | return uint216(proposal.stakes[YES]).fraction(uint216(proposal.stakes[NO]));
| return uint216(proposal.stakes[YES]).fraction(uint216(proposal.stakes[NO]));
| 11,015 |
189 | // | contract OpticalIllusion is ERC721Enumerable, Ownable {
using Counters for Counters.Counter;
Counters.Counter private _tokenId;
uint256 public maxOPI = 1111;
uint256 public price = 150000000000000000; //0.15 Ether
string baseTokenURI;
bool public isSaleOpen = false;
event OpticalIllusionMi... | contract OpticalIllusion is ERC721Enumerable, Ownable {
using Counters for Counters.Counter;
Counters.Counter private _tokenId;
uint256 public maxOPI = 1111;
uint256 public price = 150000000000000000; //0.15 Ether
string baseTokenURI;
bool public isSaleOpen = false;
event OpticalIllusionMi... | 1,487 |
28 | // Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to `transfer`, and can be used toe.g. implement automatic token fees, slashing mechanisms, etc. Emits a `Transfer` event. Requirements: - `sender` cannot be the zero address.- `recipient` cannot be the zero address.- `sender`... | function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount);
_balan... | function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount);
_balan... | 2,636 |
1,396 | // Following variable set upon a resolution of a dispute: |
FixedPoint.Unsigned settlementPrice; // Final price as determined by an Oracle following a dispute
FixedPoint.Unsigned finalFee;
|
FixedPoint.Unsigned settlementPrice; // Final price as determined by an Oracle following a dispute
FixedPoint.Unsigned finalFee;
| 2,020 |
313 | // xy. If any of the operators is higher than maxFixedMul() it might overflow. Test multiply(0,0) returns 0Test multiply(maxFixedMul(),0) returns 0Test multiply(0,maxFixedMul()) returns 0Test multiply(maxFixedMul(),fixed1()) returns maxFixedMul()Test multiply(fixed1(),maxFixedMul()) returns maxFixedMul()Test all combin... | function multiply(int256 x, int256 y) public pure returns (int256) {
if (x == 0 || y == 0) return 0;
if (y == fixed1()) return x;
if (x == fixed1()) return y;
// Separate into integer and fractional parts
// x = x1 + x2, y = y1 + y2
int256 x1 = integer(x) / fixed1();... | function multiply(int256 x, int256 y) public pure returns (int256) {
if (x == 0 || y == 0) return 0;
if (y == fixed1()) return x;
if (x == fixed1()) return y;
// Separate into integer and fractional parts
// x = x1 + x2, y = y1 + y2
int256 x1 = integer(x) / fixed1();... | 9,637 |
11 | // mint _nbNft NFTs of each level for owner/_nbNft number of mint of each level | function mintOwner(uint256 _nbNft) public onlyOwner {
require(_nbNft > 0, "LeafNFT : must be greater than 0");
require(
_nbNft + firstLevelSupply <= 10000,
"LeafNFT : must be less than 10000"
);
for (uint256 i = 1; i <= _nbNft; i++) {
firstLevelSu... | function mintOwner(uint256 _nbNft) public onlyOwner {
require(_nbNft > 0, "LeafNFT : must be greater than 0");
require(
_nbNft + firstLevelSupply <= 10000,
"LeafNFT : must be less than 10000"
);
for (uint256 i = 1; i <= _nbNft; i++) {
firstLevelSu... | 15,047 |
2 | // Get reward manager address/_index index of instance/ return address of instance's RewardManager | function getRewardManagerAddress(uint256 _index)
external
view
returns (address);
| function getRewardManagerAddress(uint256 _index)
external
view
returns (address);
| 15,552 |
228 | // The total remaining vested balance, for verifying the actual havven balance of this contract against. | uint public totalVestedBalance;
| uint public totalVestedBalance;
| 35,834 |
33 | // Claim tokens that have been sent to contract mistakenly/_token Token address that we want to claim | function claimTokens(address _token) public onlyOwner {
if (_token == address(0)) {
owner.transfer(this.balance);
return;
}
ERC20 token = ERC20(_token);
uint balance = token.balanceOf(this);
token.transfer(owner, balance);
ClaimedTokens(_token, owner, balance);
}
| function claimTokens(address _token) public onlyOwner {
if (_token == address(0)) {
owner.transfer(this.balance);
return;
}
ERC20 token = ERC20(_token);
uint balance = token.balanceOf(this);
token.transfer(owner, balance);
ClaimedTokens(_token, owner, balance);
}
| 20,973 |
75 | // Revoke the attribute of the type with ID `attributeTypeID` from `account` if `message.caller.address()` is the issuing validator.account address The account to issue the attribute on.attributeTypeID uint256 The ID of the attribute type to issue.Validators may still revoke issued attributes even after they have been ... | function revokeAttribute(
address account,
uint256 attributeTypeID
| function revokeAttribute(
address account,
uint256 attributeTypeID
| 34,652 |
5 | // if time has elapsed since the last update on the pair, mock the accumulated price values | (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast) = IUniswapV2Pair(pair).getReserves();
priceCumulative += uint256(FixedPoint.fraction(reserve0, reserve1)._x) * (blockTimestamp - blockTimestampLast); // overflows ok
| (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast) = IUniswapV2Pair(pair).getReserves();
priceCumulative += uint256(FixedPoint.fraction(reserve0, reserve1)._x) * (blockTimestamp - blockTimestampLast); // overflows ok
| 31,210 |
44 | // ETH 750$ 13.12.2017 token price 1.5$ TODO: set actual price before deploy | uint256 public constant tokenPrice = uint256(15 * 1 ether).div(etherCost * 10);
RefundVault public refundVault;
KeeppetToken public keeppetToken;
| uint256 public constant tokenPrice = uint256(15 * 1 ether).div(etherCost * 10);
RefundVault public refundVault;
KeeppetToken public keeppetToken;
| 50,243 |
39 | // Get `Exchange` contract address/ return exchange The address of `Exchange` contract | function getExchange() external view returns (address exchange);
| function getExchange() external view returns (address exchange);
| 10,908 |
40 | // Check if a pair of nodes is a valid insertion point for a new node with the given NICR _NICR Node's NICR _prevId Id of previous node for the insert position _nextId Id of next node for the insert position / | function validInsertPosition(uint256 _NICR, address _prevId, address _nextId) external view override returns (bool) {
return _validInsertPosition(troveManager, _NICR, _prevId, _nextId);
}
| function validInsertPosition(uint256 _NICR, address _prevId, address _nextId) external view override returns (bool) {
return _validInsertPosition(troveManager, _NICR, _prevId, _nextId);
}
| 16,108 |
281 | // Query if an address is an authorized operator for another address/_owner The address that owns the NFTs/_operator The address that acts on behalf of the owner/ return True if `_operator` is an approved operator for `_owner`, false otherwise | function isApprovedForAll(address _owner, address _operator) external view returns (bool);
| function isApprovedForAll(address _owner, address _operator) external view returns (bool);
| 3,730 |
43 | // Withdraw _amount of stakeToken from pool _pid, also harvest reward for the sender / | function _withdraw(uint256 _pid, uint256 _amount) internal {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, 'withdraw: insufficient amount');
// update pool reward and harvest
updatePoolRewards(_pid);
_updateUserRewa... | function _withdraw(uint256 _pid, uint256 _amount) internal {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, 'withdraw: insufficient amount');
// update pool reward and harvest
updatePoolRewards(_pid);
_updateUserRewa... | 43,853 |
165 | // OPERATOR ONLY: Update the operator address_newOperator New operator address / | function updateOperator(address _newOperator) external onlyOperator {
operator = _newOperator;
}
| function updateOperator(address _newOperator) external onlyOperator {
operator = _newOperator;
}
| 41,433 |
48 | // See {IERC721CreatorCore-mintExtensionBatch}. / | function mintExtensionBatch(address to, uint16 count) public virtual override nonReentrant returns(uint256[] memory tokenIds) {
requireExtension();
tokenIds = new uint256[](count);
uint256 firstTokenId = _tokenCount+1;
_tokenCount += count;
for (uint i; i < count;) {
... | function mintExtensionBatch(address to, uint16 count) public virtual override nonReentrant returns(uint256[] memory tokenIds) {
requireExtension();
tokenIds = new uint256[](count);
uint256 firstTokenId = _tokenCount+1;
_tokenCount += count;
for (uint i; i < count;) {
... | 13,154 |
204 | // First option based on fraction of total veFXS supply, with an added scale factor | uint256 mult_optn_1 = (vefxs_bal_to_use * vefxs_max_multiplier * vefxs_boost_scale_factor)
/ (veFXS.totalSupply() * MULTIPLIER_PRECISION);
| uint256 mult_optn_1 = (vefxs_bal_to_use * vefxs_max_multiplier * vefxs_boost_scale_factor)
/ (veFXS.totalSupply() * MULTIPLIER_PRECISION);
| 50,406 |
111 | // Returns the address of the current Recovery owner. / | function recoveryOwner() public view returns (address) {
return _recoveryOwner;
}
| function recoveryOwner() public view returns (address) {
return _recoveryOwner;
}
| 33,596 |
0 | // ! "name": "main",! "input": [ | //! {
//! "entry": "main",
//! "calldata": [
//! "42"
//! ],
//! "storage": [
//! "20", "15", "10", "5"
//! ]
//! }
| //! {
//! "entry": "main",
//! "calldata": [
//! "42"
//! ],
//! "storage": [
//! "20", "15", "10", "5"
//! ]
//! }
| 13,097 |
197 | // oracle used for calculating the avgAPR with gov tokens | address public oracle;
| address public oracle;
| 35,187 |
453 | // round 44 | ark(i, q, 4945579503584457514844595640661884835097077318604083061152997449742124905548);
sbox_partial(i, q);
mix(i, q);
| ark(i, q, 4945579503584457514844595640661884835097077318604083061152997449742124905548);
sbox_partial(i, q);
mix(i, q);
| 44,116 |
212 | // return Total earnings for a user / | function getClaimedRewards(address user) public view returns (uint256) {
return userClaimedRewards[user];
}
| function getClaimedRewards(address user) public view returns (uint256) {
return userClaimedRewards[user];
}
| 13,416 |
7 | // deposit token to guard, waiting to claim, only allowed depositorid the id of the operation, should be siged later by guardstoken the erc20 token addressrecipient the recipient of the tokenamount the amount of the token/ | function deposit(uint256 id, address token, address recipient, uint256 amount) public onlyDepositor whenNotPaused {
require(depositors[id].amount == 0, "Guard: the asset exist");
uint256 balanceBefore = IERC20(token).balanceOf(address(this));
require(IERC20(token).transferFrom(msg.sender, ad... | function deposit(uint256 id, address token, address recipient, uint256 amount) public onlyDepositor whenNotPaused {
require(depositors[id].amount == 0, "Guard: the asset exist");
uint256 balanceBefore = IERC20(token).balanceOf(address(this));
require(IERC20(token).transferFrom(msg.sender, ad... | 47,514 |
275 | // Provenance hash of 8893 unique artworks | string public BAI_PROVENANCE;
| string public BAI_PROVENANCE;
| 51,408 |
251 | // To deactivate flash loan provider if needed | bool public DyDxActive = true;
bool public forceMigrate; // default is false
uint256 public dyDxMarketId;
| bool public DyDxActive = true;
bool public forceMigrate; // default is false
uint256 public dyDxMarketId;
| 38,134 |
38 | // Disable authentication / | function disableAuthentication() public;
| function disableAuthentication() public;
| 32,873 |
21 | // Id definitions for bancor contract featuresCan be used to query the ContractFeatures contract to check whether a certain feature is supported by a contract/ | contract FeatureIds {
// converter features
uint256 public constant CONVERTER_CONVERSION_WHITELIST = 1 << 0;
}
| contract FeatureIds {
// converter features
uint256 public constant CONVERTER_CONVERSION_WHITELIST = 1 << 0;
}
| 23,689 |
37 | // Default standard vesting status: Active | standardVestingStatus public current_standard_vesting_status =
standardVestingStatus.standardVestingActive;
| standardVestingStatus public current_standard_vesting_status =
standardVestingStatus.standardVestingActive;
| 39,568 |
0 | // RSA public parameter N | uint240 public constant N = 0x19502e64b3deff07b8378ff53d5799d9843c63cb871640c11196b500001;
address[25] public jury;
string public caseDescription;
string public judgeArguments;
| uint240 public constant N = 0x19502e64b3deff07b8378ff53d5799d9843c63cb871640c11196b500001;
address[25] public jury;
string public caseDescription;
string public judgeArguments;
| 2,153 |
90 | // withdraw both tokens | _unstake(unstakeAmount0, unstakeAmount1);
| _unstake(unstakeAmount0, unstakeAmount1);
| 3,348 |
4 | // They are drought tolerant and slow-growing. | entry slow : ENG_COMPOUND_PREVERB {}
| entry slow : ENG_COMPOUND_PREVERB {}
| 12,843 |
3 | // operator-filter-registry |
function setApprovalForAll(address operator, bool approved)
public
override(ERC721A, IERC721A)
onlyAllowedOperatorApproval(operator)
|
function setApprovalForAll(address operator, bool approved)
public
override(ERC721A, IERC721A)
onlyAllowedOperatorApproval(operator)
| 27,349 |
11 | // Handles repayment of flashloaned assets + premium Will pull the amount + premium from the receiver, so must have approved pool reserve The state of the flashloaned reserve params The additional parameters needed to execute the repayment function / | function _handleFlashLoanRepayment(
DataTypes.ReserveData storage reserve,
DataTypes.FlashLoanRepaymentParams memory params
| function _handleFlashLoanRepayment(
DataTypes.ReserveData storage reserve,
DataTypes.FlashLoanRepaymentParams memory params
| 33,820 |
30 | // Increase the shares of a shareholder/_account The shareholder address/_shares The shares of the holder/_token The updated token | function _addShares(
address _account,
uint256 _shares,
address _token
| function _addShares(
address _account,
uint256 _shares,
address _token
| 56,288 |
8 | // Get votes | function getVotes() public view returns(uint256[20] memory) {
return _votes;
}
| function getVotes() public view returns(uint256[20] memory) {
return _votes;
}
| 434 |
17 | // Hashing the signed message | signedHash := keccak256(add(signedMessage, BYTES_ARR_LEN_VAR_BS), signedMessageBytesCount)
| signedHash := keccak256(add(signedMessage, BYTES_ARR_LEN_VAR_BS), signedMessageBytesCount)
| 29,175 |
97 | // Add an `address` to the black list.This `address` will no longer be able to transfer funds to anyone. Can only be called by the current owner. / | function addBlackList (address _evilUser) public onlyOwner {
_isBlackListed[_evilUser] = true;
emit AddedBlackList(_evilUser);
}
| function addBlackList (address _evilUser) public onlyOwner {
_isBlackListed[_evilUser] = true;
emit AddedBlackList(_evilUser);
}
| 79,245 |
39 | // Save bettor's bet | matchBets[_matchId][matchResultBetOn].push(smartAssetId);
emit BetPlacedEvent(bettor, _matchId, amountBet, block.timestamp);
return smartAssetId;
| matchBets[_matchId][matchResultBetOn].push(smartAssetId);
emit BetPlacedEvent(bettor, _matchId, amountBet, block.timestamp);
return smartAssetId;
| 7,508 |
137 | // Extension of ERC1155 that adds tracking of total supply per id. Useful for scenarios where Fungible and Non-fungible tokens have to beclearly identified. Note: While a totalSupply of 1 might mean thecorresponding is an NFT, there is no guarantees that no other token with thesame id are not going to be minted. / | abstract contract ERC1155Supply is ERC1155 {
mapping(uint256 => uint256) private _totalSupply;
/**
* @dev Total amount of tokens in with a given id.
*/
function totalSupply(uint256 id) public view virtual returns (uint256) {
return _totalSupply[id];
}
/**
* @dev Indicates wh... | abstract contract ERC1155Supply is ERC1155 {
mapping(uint256 => uint256) private _totalSupply;
/**
* @dev Total amount of tokens in with a given id.
*/
function totalSupply(uint256 id) public view virtual returns (uint256) {
return _totalSupply[id];
}
/**
* @dev Indicates wh... | 28,372 |
200 | // Migrate lp token to another lp contract. Can be called by anyone. We trust that migrator contract is good. | function migrate(uint256 _pid) public {
require(address(migrator) != address(0), "migrate: no migrator");
PoolInfo storage pool = poolInfo[_pid];
IBEP20 lpToken = pool.lpToken;
uint256 bal = lpToken.balanceOf(address(this));
lpToken.safeApprove(address(migrator), bal);
... | function migrate(uint256 _pid) public {
require(address(migrator) != address(0), "migrate: no migrator");
PoolInfo storage pool = poolInfo[_pid];
IBEP20 lpToken = pool.lpToken;
uint256 bal = lpToken.balanceOf(address(this));
lpToken.safeApprove(address(migrator), bal);
... | 4,155 |
27 | // Get the number of rewards used in the old contract | tme tmeContract=tme(0xEe22430595aE400a30FFBA37883363Fbf293e24e);
uint256 numRewardsUsed=tmeContract.numRewardsUsed(addressToSet);
numRewardsAvailable[addressToSet]=10-numRewardsUsed;
numRewardsAvailableSetForChildAddress[addressToSet]=true;
| tme tmeContract=tme(0xEe22430595aE400a30FFBA37883363Fbf293e24e);
uint256 numRewardsUsed=tmeContract.numRewardsUsed(addressToSet);
numRewardsAvailable[addressToSet]=10-numRewardsUsed;
numRewardsAvailableSetForChildAddress[addressToSet]=true;
| 55,569 |
27 | // create immutable split | split = Clones.cloneDeterministic(walletImplementation, splitHash);
| split = Clones.cloneDeterministic(walletImplementation, splitHash);
| 22,541 |
7 | // 2. Check signed msg integrety | bytes32 actualMsg = getMsgForSign(
msg.sender,
_pid,
_amount,
_type,
_rewardToken
);
require(actualMsg.toEthSignedMessageHash() == _msgForSign,"integrety check failed");
userPositions[msg.sender][_getPositionIndexByPid(msg.sende... | bytes32 actualMsg = getMsgForSign(
msg.sender,
_pid,
_amount,
_type,
_rewardToken
);
require(actualMsg.toEthSignedMessageHash() == _msgForSign,"integrety check failed");
userPositions[msg.sender][_getPositionIndexByPid(msg.sende... | 35,901 |
9 | // Reverts if the address doesn't have this role/ | modifier onlyRole(string _role) {
roleCheck(_role, msg.sender);
_;
}
| modifier onlyRole(string _role) {
roleCheck(_role, msg.sender);
_;
}
| 42,993 |
33 | // reduce eligible pools only if done by user actions | if (pool.totalStaked == 0 && pool.allocPoint > 0) {
totalEligiblePools = totalEligiblePools.sub(1);
}
| if (pool.totalStaked == 0 && pool.allocPoint > 0) {
totalEligiblePools = totalEligiblePools.sub(1);
}
| 44,884 |
15 | // Return the index of the given token address. Reverts if no matchingtoken is found. tokenAddress address of the tokenreturn the index of the given token address / | function getTokenIndex(address tokenAddress)
public
view
virtual
returns (uint8)
| function getTokenIndex(address tokenAddress)
public
view
virtual
returns (uint8)
| 6,474 |
155 | // https:docs.pynthetix.io/contracts/source/libraries/math | library Math {
using SafeMath for uint;
using SafeDecimalMath for uint;
/**
* @dev Uses "exponentiation by squaring" algorithm where cost is 0(logN)
* vs 0(N) for naive repeated multiplication.
* Calculates x^n with x as fixed-point and n as regular unsigned int.
* Calculates to 18 digi... | library Math {
using SafeMath for uint;
using SafeDecimalMath for uint;
/**
* @dev Uses "exponentiation by squaring" algorithm where cost is 0(logN)
* vs 0(N) for naive repeated multiplication.
* Calculates x^n with x as fixed-point and n as regular unsigned int.
* Calculates to 18 digi... | 32,396 |
103 | // Issues an {amount} new shares to {recipient}. / | function issue(address recipient, uint256 amount)
public
onlyOwner
returns (bool)
{
_mint(recipient, amount);
return true;
}
| function issue(address recipient, uint256 amount)
public
onlyOwner
returns (bool)
{
_mint(recipient, amount);
return true;
}
| 63,830 |
57 | // Allows token holders to vote_disputeId is the dispute id_supportsDispute is the vote (true=the dispute has basis false = vote against dispute)/ | function vote(TellorStorage.TellorStorageStruct storage self, uint256 _disputeId, bool _supportsDispute) public {
TellorStorage.Dispute storage disp = self.disputesById[_disputeId];
//Get the voteWeight or the balance of the user at the time/blockNumber the disupte began
uint256 voteWeight ... | function vote(TellorStorage.TellorStorageStruct storage self, uint256 _disputeId, bool _supportsDispute) public {
TellorStorage.Dispute storage disp = self.disputesById[_disputeId];
//Get the voteWeight or the balance of the user at the time/blockNumber the disupte began
uint256 voteWeight ... | 26,738 |
198 | // Make sure it does nothing if the new and old weights are the same (saves gas) It's a degenerate case if they're all the same, but you certainly could have a plan where you only change some of the weights in the set | if (gradualUpdate.startWeights[i] != gradualUpdate.endWeights[i]) {
if (
gradualUpdate.endWeights[i] < gradualUpdate.startWeights[i]
) {
| if (gradualUpdate.startWeights[i] != gradualUpdate.endWeights[i]) {
if (
gradualUpdate.endWeights[i] < gradualUpdate.startWeights[i]
) {
| 23,363 |
46 | // random number generation | uint256 public randomNumber; // for debugging
bytes32 public lastRequestId;
uint256 public lastRequestAt;
uint256 public launchCount = 0;
uint256 private maxBuybackAmount;
uint256 private buybackAmount;
uint256 private remainingSessionEth;
bool public rocketFueled;
bool private buyb... | uint256 public randomNumber; // for debugging
bytes32 public lastRequestId;
uint256 public lastRequestAt;
uint256 public launchCount = 0;
uint256 private maxBuybackAmount;
uint256 private buybackAmount;
uint256 private remainingSessionEth;
bool public rocketFueled;
bool private buyb... | 37,898 |
8 | // Investors get 45M tokens linearly over the first year | uint investorsProgress = _min(((block.timestamp - emissionsStart) * 1e12) / ONE_YEAR, 1e12);
uint investorsUnlocked = (investorsProgress * INVESTORS_EMISSIONS_HALF1) / 1e12;
uint investorsAmount = _min(investorsUnlocked - sentToInvestors, amount);
if (investorsAmount > 0)... | uint investorsProgress = _min(((block.timestamp - emissionsStart) * 1e12) / ONE_YEAR, 1e12);
uint investorsUnlocked = (investorsProgress * INVESTORS_EMISSIONS_HALF1) / 1e12;
uint investorsAmount = _min(investorsUnlocked - sentToInvestors, amount);
if (investorsAmount > 0)... | 6,141 |
329 | // if greater than zero, this is a percentage fee applied to exchange operations with HolyWing proxy | uint256 public exchangeFee;
| uint256 public exchangeFee;
| 14,552 |
343 | // Adds the staking amount of the protocol total. / | function addAllValue(uint256 _value) private {
uint256 value = getStorageAllValue();
value = value.add(_value);
setStorageAllValue(value);
}
| function addAllValue(uint256 _value) private {
uint256 value = getStorageAllValue();
value = value.add(_value);
setStorageAllValue(value);
}
| 30,175 |
46 | // STORAGE commit the genesis block hash header to storage as Zero block.. | blockCommitments[GenesisBlockHeight] = genesisBlockHash;
| blockCommitments[GenesisBlockHeight] = genesisBlockHash;
| 21,394 |
91 | // delete register | contract BAC002 is IssuerRole, Suspendable {
using SafeMath for uint256;
using Address for address;
using Counters for Counters.Counter;
// Equals to `bytes4(keccak256("onBAC002Received(address,address,uint256,bytes)"))`
bytes4 private constant _BAC002_RECEIVED = 0x31f6f50e;
// Mapping from a... | contract BAC002 is IssuerRole, Suspendable {
using SafeMath for uint256;
using Address for address;
using Counters for Counters.Counter;
// Equals to `bytes4(keccak256("onBAC002Received(address,address,uint256,bytes)"))`
bytes4 private constant _BAC002_RECEIVED = 0x31f6f50e;
// Mapping from a... | 33,253 |
31 | // Get the custom indicator for a Loan Fund fund The Id of a Loan Fundreturn The indicator of whether a Loan Fund is custom or not / | function custom(bytes32 fund) public view returns (bool) {
return bools[fund].custom;
}
| function custom(bytes32 fund) public view returns (bool) {
return bools[fund].custom;
}
| 45,199 |
11 | // triggered when the rate between two tokens in the converter changesnote that the event might be dispatched for rate updates between any two tokens in the converter _token1 address of the first token_token2 address of the second token_rateNrate of 1 unit of `_token1` in `_token2` (numerator)_rateDrate of 1 unit of `_... | event TokenRateUpdate(IERC20Token indexed _token1, IERC20Token indexed _token2, uint256 _rateN, uint256 _rateD);
| event TokenRateUpdate(IERC20Token indexed _token1, IERC20Token indexed _token2, uint256 _rateN, uint256 _rateD);
| 25,375 |
10 | // Cast a vote without revealing the vote by posting a commitment/commitment Commitment to A or B, by commit-reveal scheme | function castHiddenVote(bytes32 commitment) external payable {
| function castHiddenVote(bytes32 commitment) external payable {
| 53,433 |
99 | // Record the changed point into history | point_history[_epoch] = last_point;
if (_tokenId != 0) {
| point_history[_epoch] = last_point;
if (_tokenId != 0) {
| 25,759 |
79 | // optional booster module for calculating virtual balances on strategies | IFlywheelBooster public flywheelBooster;
constructor(
ERC20 _rewardToken,
IFlywheelRewards _flywheelRewards,
IFlywheelBooster _flywheelBooster,
address _owner,
Authority _authority
| IFlywheelBooster public flywheelBooster;
constructor(
ERC20 _rewardToken,
IFlywheelRewards _flywheelRewards,
IFlywheelBooster _flywheelBooster,
address _owner,
Authority _authority
| 46,375 |
43 | // removes a smart token from the registry _smartToken smart token/ | function removeSmartToken(IBancorConverterRegistryData _converterRegistryData, address _smartToken) internal {
_converterRegistryData.removeSmartToken(_smartToken);
emit SmartTokenRemoved(_smartToken);
}
| function removeSmartToken(IBancorConverterRegistryData _converterRegistryData, address _smartToken) internal {
_converterRegistryData.removeSmartToken(_smartToken);
emit SmartTokenRemoved(_smartToken);
}
| 2,207 |
68 | // Performs work on the contract. Executed by the keepers, via the registry. performData is the data which was passed back from the checkDatasimulation. / | function performUpkeep(bytes calldata performData) external;
| function performUpkeep(bytes calldata performData) external;
| 50,549 |
17 | // systemOnly/ | function mintUnwrappedResources(uint _resourceId, address _to, uint _value, bool _mintUnwrappedResources) override public systemOnly {
resource(_resourceId).mint(_to, _value, _mintUnwrappedResources);
}
| function mintUnwrappedResources(uint _resourceId, address _to, uint _value, bool _mintUnwrappedResources) override public systemOnly {
resource(_resourceId).mint(_to, _value, _mintUnwrappedResources);
}
| 11,320 |
16 | // if you don&39;t have approval, throw | if(_approvals[from][msg.sender] < value) revert();
if(!safeToAdd(_balances[to], value)) revert();
| if(_approvals[from][msg.sender] < value) revert();
if(!safeToAdd(_balances[to], value)) revert();
| 57,543 |
8 | // Mapping of pending Wei | mapping(address => uint256) public pending_wei;
| mapping(address => uint256) public pending_wei;
| 4,551 |
35 | // Retuns wallet role indexwallet Wallet address/ | function getWalletRoleIndex(address wallet) public view returns (uint8) {
return walletRolesIndex[wallet];
}
| function getWalletRoleIndex(address wallet) public view returns (uint8) {
return walletRolesIndex[wallet];
}
| 18,212 |
6,438 | // 3221 | entry "lockingly" : ENG_ADVERB
| entry "lockingly" : ENG_ADVERB
| 24,057 |
16 | // 更新聯絡人資訊 | _contact.name = _name;
_contact.phone = _phone;
| _contact.name = _name;
_contact.phone = _phone;
| 17,406 |
35 | // contract balances / | function cBalances() public view returns (uint, uint, uint, uint) {
return (address(this).balance, _balanceReflections, _balanceLotteryPot, _balanceTeam);
}
| function cBalances() public view returns (uint, uint, uint, uint) {
return (address(this).balance, _balanceReflections, _balanceLotteryPot, _balanceTeam);
}
| 5,014 |
147 | // send to arbitrator | address arb = IDeposit(operator).rewardArbitrator();
if(arb != address(0)){
IERC20(token).safeTransfer(arb, newbalance);
}
| address arb = IDeposit(operator).rewardArbitrator();
if(arb != address(0)){
IERC20(token).safeTransfer(arb, newbalance);
}
| 8,704 |
106 | // To change the starting tokenId, please override this function./ | function _startTokenId() internal view virtual returns (uint256) {
return 1;
}
| function _startTokenId() internal view virtual returns (uint256) {
return 1;
}
| 7,847 |
38 | // Interface declaration / | function isToken() public constant returns (bool weAre) {
return true;
}
| function isToken() public constant returns (bool weAre) {
return true;
}
| 3,619 |
312 | // add eth to pot | round_[_rID].pot = _pot.add(_dust).add(round_[_rID].pot);
| round_[_rID].pot = _pot.add(_dust).add(round_[_rID].pot);
| 59,111 |
266 | // user functions // getter functions // pure functions //Geyser/Reward distribution contract with time multiplier/Security contact: [email protected]/ Access Control/ - Power controller:/ Can power off / shutdown the geyser/ Can withdraw rewards from reward pool once shutdown/ - Proxy owner:/ Can change arbitrary logi... | contract Geyser is IGeyser, Powered, OwnableUpgradeable {
using SafeMath for uint256;
using EnumerableSet for EnumerableSet.AddressSet;
/* constants */
// An upper bound on the number of active stakes per vault is required to prevent
// calls to rageQuit() from reverting.
// With 30 stakes in ... | contract Geyser is IGeyser, Powered, OwnableUpgradeable {
using SafeMath for uint256;
using EnumerableSet for EnumerableSet.AddressSet;
/* constants */
// An upper bound on the number of active stakes per vault is required to prevent
// calls to rageQuit() from reverting.
// With 30 stakes in ... | 46,021 |
84 | // This function initializes the piecemeal function. If it is already initialized, it will continue and return the currentFunctionStep of the status. | function initializeOrContinue(bytes32 _category) external returns (uint _currentFunctionStep);
| function initializeOrContinue(bytes32 _category) external returns (uint _currentFunctionStep);
| 41,555 |
16 | // Ownable has an owner address and provides basic authorization control functions./ This contract is modified version of the MIT OpenZepplin Ownable contract/ This contract allows for the transferOwnership operation to be made impossible/ https:github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/owners... | contract Ownable {
event TransferredOwnership(address _from, address _to);
event LockedOwnership(address _locked);
address payable private _owner;
bool private _isTransferable;
/// @notice Constructor sets the original owner of the contract and whether or not it is one time transferable.
const... | contract Ownable {
event TransferredOwnership(address _from, address _to);
event LockedOwnership(address _locked);
address payable private _owner;
bool private _isTransferable;
/// @notice Constructor sets the original owner of the contract and whether or not it is one time transferable.
const... | 35,540 |
192 | // The block number when CAKE mining starts. | uint256 public startBlock;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
constructor(
SahiSwapToken _Sa... | uint256 public startBlock;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
constructor(
SahiSwapToken _Sa... | 2,323 |
9 | // Get the amount of tokens that an entity has for sale in the marketplace. _entityIdUnique platform ID of the entity. _tokenId The ID assigned to an external token.return amount of tokens that the entity has for sale in the marketplace. / | function getLockedBalance(bytes32 _entityId, bytes32 _tokenId) external view returns (uint256 amount);
| function getLockedBalance(bytes32 _entityId, bytes32 _tokenId) external view returns (uint256 amount);
| 20,314 |
269 | // Sets a new token price. / | function setTokenPrice(uint256 newPrice) external onlyOwner {
_tokenPrice = newPrice;
}
| function setTokenPrice(uint256 newPrice) external onlyOwner {
_tokenPrice = newPrice;
}
| 16,055 |
231 | // ERAContract/ | contract ERAContract is BaseContract {
/**
* Initializer function
*/
function initialize() public initializer {
init('ERA Equity Token', 'ERA', 0, 48425000, 0x1cCA38991Ff68BbE73e89973019ca28b2352A7ed, 0x1cCA38991Ff68BbE73e89973019ca28b2352A7ed);
}
/**
* Payable function
*/
... | contract ERAContract is BaseContract {
/**
* Initializer function
*/
function initialize() public initializer {
init('ERA Equity Token', 'ERA', 0, 48425000, 0x1cCA38991Ff68BbE73e89973019ca28b2352A7ed, 0x1cCA38991Ff68BbE73e89973019ca28b2352A7ed);
}
/**
* Payable function
*/
... | 21,135 |
2 | // the value `StakingRewards.accumulatedRewardsPerToken()` at the last checkpoint | uint256 accumulatedRewardsPerTokenAtLastCheckpoint;
| uint256 accumulatedRewardsPerTokenAtLastCheckpoint;
| 26,771 |
19 | // when farming was started with 1y and 12tokens and we want to finish after 4 months, we need to end up with situation like we were starting with 4mo and 4 tokens. | function finishFarming() external whenActive onlyOwner {
require(block.timestamp < periodFinish, "can't stop if not started or already finished");
stopped = true;
uint256 tokensToBurn;
if (_totalSupply == 0) {
tokensToBurn = rewardsToken.balanceOf(address(this));
... | function finishFarming() external whenActive onlyOwner {
require(block.timestamp < periodFinish, "can't stop if not started or already finished");
stopped = true;
uint256 tokensToBurn;
if (_totalSupply == 0) {
tokensToBurn = rewardsToken.balanceOf(address(this));
... | 5,666 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.