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 |
|---|---|---|---|---|
5 | // Solidity only automatically asserts when dividing by 0 | require(b > 0);
uint256 c = a / b;
| require(b > 0);
uint256 c = a / b;
| 41,060 |
4 | // 设定初始值 |
mapping (address => mapping (address => uint256)) public allowance;
event FrozenFunds(address target, bool frozen);
event Transfer(address indexed from, address indexed to, uint256 value);
string public name;
string public symbol;
uint8 public decimals = 2;
|
mapping (address => mapping (address => uint256)) public allowance;
event FrozenFunds(address target, bool frozen);
event Transfer(address indexed from, address indexed to, uint256 value);
string public name;
string public symbol;
uint8 public decimals = 2;
| 49,621 |
3 | // Deposit all Balancer Pool Tokens (BPT) in this strategy contractto the Aura rewards pool. / | function _lpDepositAll() internal virtual override {
uint256 bptBalance = IERC20(platformAddress).balanceOf(address(this));
uint256 auraLp = IERC4626(auraRewardPoolAddress).deposit(
bptBalance,
address(this)
);
require(bptBalance == auraLp, "Aura LP != BPT");
}
| function _lpDepositAll() internal virtual override {
uint256 bptBalance = IERC20(platformAddress).balanceOf(address(this));
uint256 auraLp = IERC4626(auraRewardPoolAddress).deposit(
bptBalance,
address(this)
);
require(bptBalance == auraLp, "Aura LP != BPT");
}
| 10,530 |
73 | // Verify the address was actually on a whitelist | require(previousWhitelist != NO_WHITELIST, "Address cannot be removed from invalid whitelist.");
| require(previousWhitelist != NO_WHITELIST, "Address cannot be removed from invalid whitelist.");
| 1,437 |
2 | // We load and return the result | return testString;
| return testString;
| 31,006 |
8 | // thrown when a withdraw request amount does not cover the withdraw fee at processing time | error AvoDepositManager__FeeNotCovered();
| error AvoDepositManager__FeeNotCovered();
| 10,762 |
334 | // The COMP market supply state for each market | mapping(address => CompMarketState) public compSupplyState;
| mapping(address => CompMarketState) public compSupplyState;
| 7,320 |
123 | // Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:_spender The address which will spend the funds._value The amount of tokens to be spent./ | function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| 3,291 |
1 | // 候选者 | struct Candidate {
uint number; //候选者编号
string name; //名字
uint count; //票数
}
| struct Candidate {
uint number; //候选者编号
string name; //名字
uint count; //票数
}
| 25,056 |
5 | // Allow a user to deposit underlying tokens and mint the corresponding number of wrapped tokens. / | function depositFor(address account, uint256 value) public virtual returns (bool) {
address sender = _msgSender();
if (sender == address(this)) {
revert ERC20InvalidSender(address(this));
}
if (account == address(this)) {
revert ERC20InvalidReceiver(account);
}
SafeERC20.safeTransferFrom(_underlying, sender, address(this), value);
_mint(account, value);
return true;
}
| function depositFor(address account, uint256 value) public virtual returns (bool) {
address sender = _msgSender();
if (sender == address(this)) {
revert ERC20InvalidSender(address(this));
}
if (account == address(this)) {
revert ERC20InvalidReceiver(account);
}
SafeERC20.safeTransferFrom(_underlying, sender, address(this), value);
_mint(account, value);
return true;
}
| 551 |
10 | // MINT set slot 0 to lock duration + block.timestamp | if (from == address(0)) {
uint256 lock_duration = default_lock_duration;
if (lock_duration > 0) _lock(to, lock_duration);
}
| if (from == address(0)) {
uint256 lock_duration = default_lock_duration;
if (lock_duration > 0) _lock(to, lock_duration);
}
| 16,589 |
56 | // Inheritancea | interface IStakingRewards {
// Views
function lastTimeRewardApplicable() external view returns (uint256);
function rewardPerToken() external view returns (uint256);
function earned(address account) external view returns (uint256);
function getRewardForDuration() external view returns (uint256);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
// Mutative
function stakeFor(uint256 amount, address recipient) external;
function stake(uint256 amount) external;
function withdrawForUserByCVault(uint256 amount, address from) external;
function withdraw(uint256 amount) external;
function getRewardFor(address user) external;
function getReward() external;
function exit() external;
}
| interface IStakingRewards {
// Views
function lastTimeRewardApplicable() external view returns (uint256);
function rewardPerToken() external view returns (uint256);
function earned(address account) external view returns (uint256);
function getRewardForDuration() external view returns (uint256);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
// Mutative
function stakeFor(uint256 amount, address recipient) external;
function stake(uint256 amount) external;
function withdrawForUserByCVault(uint256 amount, address from) external;
function withdraw(uint256 amount) external;
function getRewardFor(address user) external;
function getReward() external;
function exit() external;
}
| 6,798 |
2,016 | // 1009 | entry "unauctioned" : ENG_ADJECTIVE
| entry "unauctioned" : ENG_ADJECTIVE
| 17,621 |
208 | // Stake CAKE tokens to MasterChef | function enterStaking(uint256 _amount) public {
PoolInfo storage pool = poolInfo[0];
UserInfo storage user = userInfo[0][msg.sender];
updatePool(0);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accCakePerShare).div(1e12).sub(user.rewardDebt);
if(pending > 0) {
safeCakeTransfer(msg.sender, pending);
}
}
if(_amount > 0) {
pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
user.amount = user.amount.add(_amount);
}
user.rewardDebt = user.amount.mul(pool.accCakePerShare).div(1e12);
syrup.mint(msg.sender, _amount);
emit Deposit(msg.sender, 0, _amount);
}
| function enterStaking(uint256 _amount) public {
PoolInfo storage pool = poolInfo[0];
UserInfo storage user = userInfo[0][msg.sender];
updatePool(0);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accCakePerShare).div(1e12).sub(user.rewardDebt);
if(pending > 0) {
safeCakeTransfer(msg.sender, pending);
}
}
if(_amount > 0) {
pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
user.amount = user.amount.add(_amount);
}
user.rewardDebt = user.amount.mul(pool.accCakePerShare).div(1e12);
syrup.mint(msg.sender, _amount);
emit Deposit(msg.sender, 0, _amount);
}
| 2,330 |
33 | // call event from transaction means | emit LogFundingReceived(msg.sender, msg.value, amountRaised, id);
if (amountRaised >= softcap) {
if (amountRaised >= hardcap) {
completeAt = now;
| emit LogFundingReceived(msg.sender, msg.value, amountRaised, id);
if (amountRaised >= softcap) {
if (amountRaised >= hardcap) {
completeAt = now;
| 52,892 |
897 | // Reads the int248 at `mPtr` in memory. | function readInt248(MemoryPointer mPtr) internal pure returns (int248 value) {
assembly {
value := mload(mPtr)
}
}
| function readInt248(MemoryPointer mPtr) internal pure returns (int248 value) {
assembly {
value := mload(mPtr)
}
}
| 40,528 |
41 | // overflow/underflow not possible bc governmentFeeUnits < 20000 | unchecked {
uint256 governmentFee = (rMintQty * cache.governmentFeeUnits) / C.FEE_UNITS;
uint256 dexFee = rMintQty/cache.dexFraction;
cache.governmentFee += governmentFee;
cache.dexFee += dexFee;
uint256 lpFee = rMintQty - governmentFee;
lpFee = lpFee-dexFee;
cache.lpFee += lpFee;
cache.feeGrowthGlobal += FullMath.mulDivFloor(lpFee, C.TWO_POW_96, swapData.baseL);
}
| unchecked {
uint256 governmentFee = (rMintQty * cache.governmentFeeUnits) / C.FEE_UNITS;
uint256 dexFee = rMintQty/cache.dexFraction;
cache.governmentFee += governmentFee;
cache.dexFee += dexFee;
uint256 lpFee = rMintQty - governmentFee;
lpFee = lpFee-dexFee;
cache.lpFee += lpFee;
cache.feeGrowthGlobal += FullMath.mulDivFloor(lpFee, C.TWO_POW_96, swapData.baseL);
}
| 27,239 |
23 | // Sys Privileges | bytes4 internal constant DEFINE_ROLE_PRIV =
bytes4(keccak256("defineRole(bytes32,bytes4[])"));
bytes4 internal constant ASSIGN_OPERATORS_PRIV =
bytes4(keccak256("assignOperators(bytes32,address[])"));
bytes4 internal constant REVOKE_OPERATORS_PRIV =
bytes4(keccak256("revokeOperators(address[])"));
bytes4 internal constant ASSIGN_PROXY_OPERATORS_PRIV =
bytes4(keccak256("assignProxyOperators(address,bytes32,address[])"));
| bytes4 internal constant DEFINE_ROLE_PRIV =
bytes4(keccak256("defineRole(bytes32,bytes4[])"));
bytes4 internal constant ASSIGN_OPERATORS_PRIV =
bytes4(keccak256("assignOperators(bytes32,address[])"));
bytes4 internal constant REVOKE_OPERATORS_PRIV =
bytes4(keccak256("revokeOperators(address[])"));
bytes4 internal constant ASSIGN_PROXY_OPERATORS_PRIV =
bytes4(keccak256("assignProxyOperators(address,bytes32,address[])"));
| 39,932 |
3 | // The constructor sets the original `owner` of the contract to the sender account. / | constructor()
| constructor()
| 9,685 |
517 | // emitted when rate limit is updated | event IndividualRateLimitPerSecondUpdate(
address rateLimitedAddress,
uint256 oldRateLimitPerSecond,
uint256 newRateLimitPerSecond
);
| event IndividualRateLimitPerSecondUpdate(
address rateLimitedAddress,
uint256 oldRateLimitPerSecond,
uint256 newRateLimitPerSecond
);
| 48,316 |
0 | // The address interpreted as native token of the chain. | address public constant NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
| address public constant NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
| 17,184 |
16 | // Returns a new slice containing the same data as the current slice. self The slice to copy.return A new slice containing the same data as `self`. / | function copy(slice self) internal pure returns (slice) {
return slice(self._len, self._ptr);
}
| function copy(slice self) internal pure returns (slice) {
return slice(self._len, self._ptr);
}
| 15,564 |
2 | // @inheritdoc IAuthorizeMints/reverts when signature is not valid or recovered signer is not trustedtodo consider using an ERC712 typed signature here/signedAuthorization contains encoded SignedMintAuthorization that a trusted signer has agreed upon | function authorizeMint(address minter, address to, bytes memory signedAuthorization) external view override returns (bool) {
SignedMintAuthorization memory auth = abi.decode(signedAuthorization, (SignedMintAuthorization));
bytes32 signedHash = ECDSA.toEthSignedMessageHash(keccak256(abi.encodePacked(minter, to, auth.reservationId, auth.tokenUri)));
(address signer,) = ECDSA.tryRecover(signedHash, auth.authorization);
return trustedSigners[signer];
}
| function authorizeMint(address minter, address to, bytes memory signedAuthorization) external view override returns (bool) {
SignedMintAuthorization memory auth = abi.decode(signedAuthorization, (SignedMintAuthorization));
bytes32 signedHash = ECDSA.toEthSignedMessageHash(keccak256(abi.encodePacked(minter, to, auth.reservationId, auth.tokenUri)));
(address signer,) = ECDSA.tryRecover(signedHash, auth.authorization);
return trustedSigners[signer];
}
| 3,128 |
11 | // Maintains a doubly linked list keyed by address. Following the `next` pointers will lead you to the head, rather than the tail. / | library AddressLinkedList {
using LinkedList for LinkedList.List;
function toBytes(address a) public pure returns (bytes32) {
return bytes32(uint256(a) << 96);
}
function toAddress(bytes32 b) public pure returns (address) {
return address(uint256(b) >> 96);
}
/**
* @notice Inserts an element into a doubly linked list.
* @param key The key of the element to insert.
* @param previousKey The key of the element that comes before the element to insert.
* @param nextKey The key of the element that comes after the element to insert.
*/
function insert(LinkedList.List storage list, address key, address previousKey, address nextKey)
public
{
list.insert(toBytes(key), toBytes(previousKey), toBytes(nextKey));
}
/**
* @notice Inserts an element at the end of the doubly linked list.
* @param key The key of the element to insert.
*/
function push(LinkedList.List storage list, address key) public {
list.insert(toBytes(key), bytes32(0), list.tail);
}
/**
* @notice Removes an element from the doubly linked list.
* @param key The key of the element to remove.
*/
function remove(LinkedList.List storage list, address key) public {
list.remove(toBytes(key));
}
/**
* @notice Updates an element in the list.
* @param key The element key.
* @param previousKey The key of the element that comes before the updated element.
* @param nextKey The key of the element that comes after the updated element.
*/
function update(LinkedList.List storage list, address key, address previousKey, address nextKey)
public
{
list.update(toBytes(key), toBytes(previousKey), toBytes(nextKey));
}
/**
* @notice Returns whether or not a particular key is present in the sorted list.
* @param key The element key.
* @return Whether or not the key is in the sorted list.
*/
function contains(LinkedList.List storage list, address key) public view returns (bool) {
return list.elements[toBytes(key)].exists;
}
/**
* @notice Returns the N greatest elements of the list.
* @param n The number of elements to return.
* @return The keys of the greatest elements.
* @dev Reverts if n is greater than the number of elements in the list.
*/
function headN(LinkedList.List storage list, uint256 n) public view returns (address[] memory) {
bytes32[] memory byteKeys = list.headN(n);
address[] memory keys = new address[](n);
for (uint256 i = 0; i < n; i++) {
keys[i] = toAddress(byteKeys[i]);
}
return keys;
}
/**
* @notice Gets all element keys from the doubly linked list.
* @return All element keys from head to tail.
*/
function getKeys(LinkedList.List storage list) public view returns (address[] memory) {
return headN(list, list.numElements);
}
}
| library AddressLinkedList {
using LinkedList for LinkedList.List;
function toBytes(address a) public pure returns (bytes32) {
return bytes32(uint256(a) << 96);
}
function toAddress(bytes32 b) public pure returns (address) {
return address(uint256(b) >> 96);
}
/**
* @notice Inserts an element into a doubly linked list.
* @param key The key of the element to insert.
* @param previousKey The key of the element that comes before the element to insert.
* @param nextKey The key of the element that comes after the element to insert.
*/
function insert(LinkedList.List storage list, address key, address previousKey, address nextKey)
public
{
list.insert(toBytes(key), toBytes(previousKey), toBytes(nextKey));
}
/**
* @notice Inserts an element at the end of the doubly linked list.
* @param key The key of the element to insert.
*/
function push(LinkedList.List storage list, address key) public {
list.insert(toBytes(key), bytes32(0), list.tail);
}
/**
* @notice Removes an element from the doubly linked list.
* @param key The key of the element to remove.
*/
function remove(LinkedList.List storage list, address key) public {
list.remove(toBytes(key));
}
/**
* @notice Updates an element in the list.
* @param key The element key.
* @param previousKey The key of the element that comes before the updated element.
* @param nextKey The key of the element that comes after the updated element.
*/
function update(LinkedList.List storage list, address key, address previousKey, address nextKey)
public
{
list.update(toBytes(key), toBytes(previousKey), toBytes(nextKey));
}
/**
* @notice Returns whether or not a particular key is present in the sorted list.
* @param key The element key.
* @return Whether or not the key is in the sorted list.
*/
function contains(LinkedList.List storage list, address key) public view returns (bool) {
return list.elements[toBytes(key)].exists;
}
/**
* @notice Returns the N greatest elements of the list.
* @param n The number of elements to return.
* @return The keys of the greatest elements.
* @dev Reverts if n is greater than the number of elements in the list.
*/
function headN(LinkedList.List storage list, uint256 n) public view returns (address[] memory) {
bytes32[] memory byteKeys = list.headN(n);
address[] memory keys = new address[](n);
for (uint256 i = 0; i < n; i++) {
keys[i] = toAddress(byteKeys[i]);
}
return keys;
}
/**
* @notice Gets all element keys from the doubly linked list.
* @return All element keys from head to tail.
*/
function getKeys(LinkedList.List storage list) public view returns (address[] memory) {
return headN(list, list.numElements);
}
}
| 38,363 |
25 | // (z - omega^{n-1}) for this part | PairingsBn254.Fr memory last_omega = vk.omega.pow(vk.domain_size - 1);
state.z_minus_last_omega = state.z.copy();
state.z_minus_last_omega.sub_assign(last_omega);
t.mul_assign(state.z_minus_last_omega);
result.add_assign(t);
| PairingsBn254.Fr memory last_omega = vk.omega.pow(vk.domain_size - 1);
state.z_minus_last_omega = state.z.copy();
state.z_minus_last_omega.sub_assign(last_omega);
t.mul_assign(state.z_minus_last_omega);
result.add_assign(t);
| 20,723 |
68 | // private function to claim rewards for multiple pids/_pids array pids, pools to claim | function _harvestMultiple(uint256[] memory _pids)
private
returns (
uint256,
uint256[] memory,
uint256[] memory
)
| function _harvestMultiple(uint256[] memory _pids)
private
returns (
uint256,
uint256[] memory,
uint256[] memory
)
| 15,783 |
42 | // this is specifically important for rootState that should update real balance only once | require(
stateHashBalances[stateHash][_user] == 0,
"stateHash already proved"
);
bytes32 leafHash = keccak256(abi.encode(_user, _balance));
bool isProofValid = checkProofOrdered(
_proof,
stateHash,
leafHash,
| require(
stateHashBalances[stateHash][_user] == 0,
"stateHash already proved"
);
bytes32 leafHash = keccak256(abi.encode(_user, _balance));
bool isProofValid = checkProofOrdered(
_proof,
stateHash,
leafHash,
| 79,623 |
4 | // flash loan | flashLoanerPool.functionCall(
abi.encodeWithSignature(
"flashLoan(uint256)",
amount
)
);
| flashLoanerPool.functionCall(
abi.encodeWithSignature(
"flashLoan(uint256)",
amount
)
);
| 2,856 |
7 | // remove a fee collectoronly callable by `owner()` / | function removeFeeCollector(address account) external override onlyOwner {
_removeFeeCollector(account);
}
| function removeFeeCollector(address account) external override onlyOwner {
_removeFeeCollector(account);
}
| 11,959 |
2 | // burns pool tokens and transfers underlying tokens _receiver the address of the receiver _amount the amount of pool tokens / | function burn(address _receiver, uint256 _amount) public returns (uint256 redeemedAmount){
require(balanceOf[msg.sender] >= _amount, "insufficient balance");
balanceOf[msg.sender] -= _amount;
IERC20Token(loanTokenAddress).transfer(address(_receiver), _amount);
return _amount;
}
| function burn(address _receiver, uint256 _amount) public returns (uint256 redeemedAmount){
require(balanceOf[msg.sender] >= _amount, "insufficient balance");
balanceOf[msg.sender] -= _amount;
IERC20Token(loanTokenAddress).transfer(address(_receiver), _amount);
return _amount;
}
| 26,955 |
73 | // _token should be address(0) or WBTC_ADDR, txid should be unique txs[_token][_txid] = _addressesAndAmountOfLPtoken; emit RecordOutcomingFloat(_token, _addressesAndAmountOfLPtoken, _txid); | require(
_burnLPTokensForFloat(_token, _addressesAndAmountOfLPtoken, _txid)
);
return true;
| require(
_burnLPTokensForFloat(_token, _addressesAndAmountOfLPtoken, _txid)
);
return true;
| 27,741 |
230 | // constants | uint256 immutable public MAX_LANDS;
uint256 immutable public MAX_LANDS_WITH_FUTURE;
uint256 immutable public MAX_ALPHA_NFT_AMOUNT;
uint256 immutable public MAX_BETA_NFT_AMOUNT;
uint256 immutable public MAX_PUBLIC_SALE_AMOUNT;
uint256 immutable public RESERVED_CONTRIBUTORS_AMOUNT;
uint256 immutable public MAX_FUTURE_LANDS;
uint256 constant public MAX_MINT_PER_BLOCK = 150;
| uint256 immutable public MAX_LANDS;
uint256 immutable public MAX_LANDS_WITH_FUTURE;
uint256 immutable public MAX_ALPHA_NFT_AMOUNT;
uint256 immutable public MAX_BETA_NFT_AMOUNT;
uint256 immutable public MAX_PUBLIC_SALE_AMOUNT;
uint256 immutable public RESERVED_CONTRIBUTORS_AMOUNT;
uint256 immutable public MAX_FUTURE_LANDS;
uint256 constant public MAX_MINT_PER_BLOCK = 150;
| 19,757 |
12 | // Returns the cost associated with placing a claim. claimed The name being claimed.return The cost in wei for this claim. / | function getClaimCost(string memory claimed) public view returns(uint) {
return priceOracle.price(claimed, 0, REGISTRATION_PERIOD);
}
| function getClaimCost(string memory claimed) public view returns(uint) {
return priceOracle.price(claimed, 0, REGISTRATION_PERIOD);
}
| 43,224 |
64 | // Transfers amount of deposit tokens from the caller on behalf of user. user User address who gains credit for this stake operation. amount Number of deposit tokens to stake. data Not used. / | function stakeFor(address user, uint256 amount, bytes calldata data) external {
_stakeFor(msg.sender, user, amount);
}
| function stakeFor(address user, uint256 amount, bytes calldata data) external {
_stakeFor(msg.sender, user, amount);
}
| 17,406 |
43 | // Recover the message signer from a DelegateAdd and a signature. v EIP-155 calculated Signature v value r ECDSA Signature r value s ECDSA Signature s value change DelegateRemove data containing nonce, delegate address, end blockreturn signer address (or some arbitrary address if signature is incorrect) / | function delegateRemoveSigner(
uint8 v,
bytes32 r,
bytes32 s,
DelegateRemove calldata change
| function delegateRemoveSigner(
uint8 v,
bytes32 r,
bytes32 s,
DelegateRemove calldata change
| 31,144 |
470 | // In Chainlink decimals | function getFPIPriceE18() public view returns (uint256) {
(uint80 roundID, int price, , uint256 updatedAt, uint80 answeredInRound) = priceFeedFPIUSD.latestRoundData();
require(price >= 0 && updatedAt!= 0 && answeredInRound >= roundID, "Invalid chainlink price");
return ((uint256(price) * 1e18) / (10 ** chainlink_fpi_usd_decimals));
}
| function getFPIPriceE18() public view returns (uint256) {
(uint80 roundID, int price, , uint256 updatedAt, uint80 answeredInRound) = priceFeedFPIUSD.latestRoundData();
require(price >= 0 && updatedAt!= 0 && answeredInRound >= roundID, "Invalid chainlink price");
return ((uint256(price) * 1e18) / (10 ** chainlink_fpi_usd_decimals));
}
| 37,336 |
278 | // Record the fee payment in our recentFeePeriods | feesPaid = _recordFeePayment(availableFees);
| feesPaid = _recordFeePayment(availableFees);
| 9,787 |
221 | // Mint unit back to investor | function _getNewFundUnits(uint256 totalFundB4, uint256 totalValueAfter, uint256 totalSupply)
| function _getNewFundUnits(uint256 totalFundB4, uint256 totalValueAfter, uint256 totalSupply)
| 16,775 |
14 | // Update refer info | function _updateReferInfo(address _user, uint256 _amount) private {
UserInfo storage user = userInfo[_user];
address upline = user.referrer;
for (uint256 i = 0; upline != address(0) && i < LEVEL_COUNT; i++) {
userInfo[upline].totalTeamStake = userInfo[upline].totalTeamStake.add(_amount);
_updateLevel(upline);
if (upline == defaultReferrer) break;
upline = userInfo[upline].referrer;
}
}
| function _updateReferInfo(address _user, uint256 _amount) private {
UserInfo storage user = userInfo[_user];
address upline = user.referrer;
for (uint256 i = 0; upline != address(0) && i < LEVEL_COUNT; i++) {
userInfo[upline].totalTeamStake = userInfo[upline].totalTeamStake.add(_amount);
_updateLevel(upline);
if (upline == defaultReferrer) break;
upline = userInfo[upline].referrer;
}
}
| 15,538 |
15 | // return if we can't claim anything | return 0;
| return 0;
| 10,646 |
255 | // increments the value of _currentTokenId / | function _incrementTokenId() private {
require(_currentTokenId < MAX_SUPPLY);
_currentTokenId++;
}
| function _incrementTokenId() private {
require(_currentTokenId < MAX_SUPPLY);
_currentTokenId++;
}
| 3,173 |
110 | // Transfer ownership of data contract to _addr _addr address / | function transferDataOwnership(address _addr) onlyOwner public {
data.transferOwnership(_addr);
}
| function transferDataOwnership(address _addr) onlyOwner public {
data.transferOwnership(_addr);
}
| 80,684 |
8 | // Signals that part of the locked AVAX balance has been cleared to a given address | event AVAXTransferred(uint256 amount, address recipient);
| event AVAXTransferred(uint256 amount, address recipient);
| 20,624 |
74 | // Mapping owner address to token count | mapping (address => uint256) private _balances;
| mapping (address => uint256) private _balances;
| 1,660 |
4 | // check the msg.sender | require(presidential[msg.sender], "Sorry! You don't have presidential to mint!");
_mint(account, amount);
| require(presidential[msg.sender], "Sorry! You don't have presidential to mint!");
_mint(account, amount);
| 56,165 |
52 | // Destructible Base contract that can be destroyed by owner. All funds in contract will be sent to the owner. / | contract Destructible is Ownable {
function Destructible() public payable { }
/**
* @dev Transfers the current balance to the owner and terminates the contract.
*/
function destroy() onlyOwner public {
selfdestruct(owner);
}
function destroyAndSend(address _recipient) onlyOwner public {
selfdestruct(_recipient);
}
}
| contract Destructible is Ownable {
function Destructible() public payable { }
/**
* @dev Transfers the current balance to the owner and terminates the contract.
*/
function destroy() onlyOwner public {
selfdestruct(owner);
}
function destroyAndSend(address _recipient) onlyOwner public {
selfdestruct(_recipient);
}
}
| 8,539 |
87 | // If _opPokeData is in state 3, emit event to indicate a possibly valid opPoke was dropped. | if (!opPokeDataFinalized) {
emit OpPokeDataDropped(msg.sender, opPokeData);
}
| if (!opPokeDataFinalized) {
emit OpPokeDataDropped(msg.sender, opPokeData);
}
| 2,295 |
67 | // Anyone can purchase a road as long as the sale exists/_x The x coordinate of the road/_y The y coordinate of the road/_direction The direction of the road | function purchaseRoad(uint _x, uint _y, uint8 _direction)
public
payable
notPaused
existingRoadSale(_x, _y, _direction)
| function purchaseRoad(uint _x, uint _y, uint8 _direction)
public
payable
notPaused
existingRoadSale(_x, _y, _direction)
| 21,110 |
12 | // / |
mapping(uint256 => uint256) tokensG2L; // globalId => packed
mapping(uint256 => mapping (uint256 => uint256)) tokensL2G; // typeId => localTokenId => globalId
function getGlobalId(uint typeId, uint localTokenId) public view returns ( uint tokenId )
|
mapping(uint256 => uint256) tokensG2L; // globalId => packed
mapping(uint256 => mapping (uint256 => uint256)) tokensL2G; // typeId => localTokenId => globalId
function getGlobalId(uint typeId, uint localTokenId) public view returns ( uint tokenId )
| 961 |
69 | // [ TAL -> Bridge -> Tokens ] Check Bridge Fee | require(msg.value >= BRIDGE_FEE, 'XSwapBridge: INSUFFICIENT_BRIDGE_FEE');
| require(msg.value >= BRIDGE_FEE, 'XSwapBridge: INSUFFICIENT_BRIDGE_FEE');
| 17,084 |
95 | // This is an alternative to {approve} that can be used as a mitigation forproblems described in {IBEP20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address.- `spender` must have allowance for the caller of at least`subtractedValue`. / | function decreaseAllowance(address spender, uint256 subtractedValue) public virtual onlyOwner returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "BEP20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
| function decreaseAllowance(address spender, uint256 subtractedValue) public virtual onlyOwner returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "BEP20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
| 6,351 |
243 | // This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. implement alternative mechanisms to perform token transfer, such as signature-based. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must exist and be owned by `from`. - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event./ | function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
| function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
| 4,369 |
503 | // calculate the number of intervals that have passed | uint256 timeDiff = block.timestamp.sub(nextRebaseTime);
uint256 intervals = timeDiff.div(rebaseInterval).add(1);
| uint256 timeDiff = block.timestamp.sub(nextRebaseTime);
uint256 intervals = timeDiff.div(rebaseInterval).add(1);
| 13,260 |
62 | // Pause contract operations, if contract is not paused. | function _pause() internal virtual whenNotPaused {
paused = true;
emit Paused(_msgSender());
}
| function _pause() internal virtual whenNotPaused {
paused = true;
emit Paused(_msgSender());
}
| 37,876 |
20 | // SignExtImm | rt = SE(insn&0xFFFF, 16);
| rt = SE(insn&0xFFFF, 16);
| 41,461 |
34 | // Standard function transfer similar to ERC20 transfer with no _data. Added due to backwards compatibility reasons. | function transfer(address _to, uint _value) isUnlocked isUnfreezed(_to) returns (bool success) {
bytes memory empty;
if(isContract(_to)) {
return transferToContract(_to, _value, empty);
}
else {
return transferToAddress(_to, _value, empty);
}
}
| function transfer(address _to, uint _value) isUnlocked isUnfreezed(_to) returns (bool success) {
bytes memory empty;
if(isContract(_to)) {
return transferToContract(_to, _value, empty);
}
else {
return transferToAddress(_to, _value, empty);
}
}
| 29,440 |
43 | // Returns a newly allocated string containing the concatenation of `self` and `other`. self The first slice to concatenate. other The second slice to concatenate.return The concatenation of the two strings. / | function concat(slice memory self, slice memory other) internal pure returns (string memory) {
string memory ret = new string(self._len + other._len);
uint retptr;
assembly { retptr := add(ret, 32) }
memcpy(retptr, self._ptr, self._len);
memcpy(retptr + self._len, other._ptr, other._len);
return ret;
}
| function concat(slice memory self, slice memory other) internal pure returns (string memory) {
string memory ret = new string(self._len + other._len);
uint retptr;
assembly { retptr := add(ret, 32) }
memcpy(retptr, self._ptr, self._len);
memcpy(retptr + self._len, other._ptr, other._len);
return ret;
}
| 36,868 |
77 | // Claim pending rewards | claimRewards(stakeId, stakedAmount);
| claimRewards(stakeId, stakedAmount);
| 39,495 |
60 | // given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset | function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) {
require(amountIn > 0, 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
uint amountInWithFee = amountIn.mul(997);
uint numerator = amountInWithFee.mul(reserveOut);
uint denominator = reserveIn.mul(1000).add(amountInWithFee);
amountOut = numerator / denominator;
}
| function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) {
require(amountIn > 0, 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
uint amountInWithFee = amountIn.mul(997);
uint numerator = amountInWithFee.mul(reserveOut);
uint denominator = reserveIn.mul(1000).add(amountInWithFee);
amountOut = numerator / denominator;
}
| 4,172 |
99 | // Applies accrued interest to total borrows and reserves.This calculates interest accrued from the last checkpointed blockup to the current block and writes new checkpoint to storage./ | function accrueInterest() public returns (uint) {
delegateAndReturn();
}
| function accrueInterest() public returns (uint) {
delegateAndReturn();
}
| 18,983 |
0 | // store a proof of existence in the contract state | function storeProof(bytes32 proof) {
proofs[proof] = true;
}
| function storeProof(bytes32 proof) {
proofs[proof] = true;
}
| 40,209 |
20 | // CALCULATE 50% PARTECIPANT ALL | uint consensusLimit = countAirlines.div(CONSENSUS_50);
if (multiCalls[owner].length >= consensusLimit) {
success = true;
flightSuretyData.registerAirline(_addressAirline, msg.sender);
emit RegisterAirlineEvent(_addressAirline);
multiCalls[owner] = new address[](0);
}
| uint consensusLimit = countAirlines.div(CONSENSUS_50);
if (multiCalls[owner].length >= consensusLimit) {
success = true;
flightSuretyData.registerAirline(_addressAirline, msg.sender);
emit RegisterAirlineEvent(_addressAirline);
multiCalls[owner] = new address[](0);
}
| 31,187 |
9 | // Mint a crypto treasure from a type id This will transferFrom() tokens to the contract Allowance of the erc20 to lock must be done before Throw if the minting start is not yet passed Throw if there is no more crypto treasure available for this typeto address of reception typeId id of the type data array bytes containing the storing restriction (in first 8 bytes) - 1 only owner can store, 0 everyone can store return minted crypto treasure id / | function safeMintByType(
address to,
uint256 typeId,
bytes memory data
| function safeMintByType(
address to,
uint256 typeId,
bytes memory data
| 52,054 |
203 | // Equivalent to `safeTransferFrom(from, to, tokenId, '')`. / | function safeTransferFrom(
address from,
address to,
uint256 tokenId
| function safeTransferFrom(
address from,
address to,
uint256 tokenId
| 8,224 |
69 | // As per the EIP-165 spec, no interface should ever match 0xffffffff | bytes4 private constant _InterfaceId_Invalid = 0xffffffff;
bytes4 private constant _InterfaceId_ERC165 = 0x01ffc9a7;
| bytes4 private constant _InterfaceId_Invalid = 0xffffffff;
bytes4 private constant _InterfaceId_ERC165 = 0x01ffc9a7;
| 30,081 |
309 | // Shift in bits from prod1 into prod0. For this we need to flip `twos` such that it is 2256 / twos. If twos is zero, then it becomes one | assembly {
twos := add(div(sub(0, twos), twos), 1)
}
| assembly {
twos := add(div(sub(0, twos), twos), 1)
}
| 61,530 |
21 | // This is the entrypoint for the frontend, as well as third-party Revest integrations. / | contract RevestRemap is IRevest, AccessControlEnumerable, RevestAccessControl, RevestReentrancyGuard {
using SafeERC20 for IERC20;
using ERC165Checker for address;
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
bytes4 public constant ADDRESS_LOCK_INTERFACE_ID = type(IAddressLock).interfaceId;
address immutable WETH;
uint public erc20Fee = 0; // out of 1000
uint private constant erc20multiplierPrecision = 1000;
uint public flatWeiFee = 0;
uint private constant MAX_INT = 2**256 - 1;
mapping(address => bool) private approved;
/**
* @dev Primary constructor to create the Revest controller contract
* Grants ADMIN and MINTER_ROLE to whoever creates the contract
*
*/
constructor(address provider, address weth) RevestAccessControl(provider) {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
WETH = weth;
}
// PUBLIC FUNCTIONS
/**
* @dev creates a single time-locked NFT with <quantity> number of copies with <amount> of <asset> stored for each copy
* asset - the address of the underlying ERC20 token for this bond
* amount - the amount to store per NFT if multiple NFTs of this variety are being created
* unlockTime - the timestamp at which this will unlock
* quantity – the number of FNFTs to create with this operation */
function mintTimeLock(
uint endTime,
address[] memory recipients,
uint[] memory quantities,
IRevest.FNFTConfig memory fnftConfig
) external payable override returns (uint) {
}
function mintValueLock(
address primaryAsset,
address compareTo,
uint unlockValue,
bool unlockRisingEdge,
address oracleDispatch,
address[] memory recipients,
uint[] memory quantities,
IRevest.FNFTConfig memory fnftConfig
) external payable override returns (uint) {
}
function mintAddressLock(
address trigger,
bytes memory arguments,
address[] memory recipients,
uint[] memory quantities,
IRevest.FNFTConfig memory fnftConfig
) external payable override returns (uint) {
}
function withdrawFNFT(uint fnftId, uint quantity) external override revestNonReentrant(fnftId) {
}
function unlockFNFT(uint fnftId) external override {}
function splitFNFT(
uint fnftId,
uint[] memory proportions,
uint quantity
) external override returns (uint[] memory) {}
/// @return the new (or reused) ID
function extendFNFTMaturity(
uint fnftId,
uint endTime
) external returns (uint) {
}
// Admin function to remap output receiver to new staking contract
function remapFNFTs(uint[] memory fnftIds, address newStaking) external onlyOwner {
address vault = addressesProvider.getTokenVault();
for(uint i = 0; i < fnftIds.length; i++) {
uint id = fnftIds[i];
IRevest.FNFTConfig memory config = ITokenVault(vault).getFNFT(id);
config.pipeToContract = newStaking;
ITokenVault(vault).mapFNFTToToken(id, config);
}
}
function remapAddLocks(uint[] memory fnftIds, address[] memory newLocks, bytes[] memory data) external onlyOwner {
for(uint i = 0; i < fnftIds.length; i++) {
IRevest.LockParam memory addressLock;
addressLock.addressLock = newLocks[i];
addressLock.lockType = IRevest.LockType.AddressLock;
// Get or create lock based on address which can trigger unlock, assign lock to ID
uint lockId = getLockManager().createLock(fnftIds[i], addressLock);
if(newLocks[i].supportsInterface(ADDRESS_LOCK_INTERFACE_ID)) {
IAddressLock(newLocks[i]).createLock(fnftIds[i], lockId, data[i]);
}
}
}
/**
* Amount will be per FNFT. So total ERC20s needed is amount * quantity.
* We don't charge an ETH fee on depositAdditional, but do take the erc20 percentage.
* Users can deposit additional into their own
* Otherwise, if not an owner, they must distribute to all FNFTs equally
*/
function depositAdditionalToFNFT(
uint fnftId,
uint amount,
uint quantity
) external override returns (uint) {
return 0;
}
/**
* @dev Returns the cached IAddressRegistry connected to this contract
**/
function getAddressesProvider() external view returns (IAddressRegistry) {
return addressesProvider;
}
//
// INTERNAL FUNCTIONS
//
function doMint(
address[] memory recipients,
uint[] memory quantities,
uint fnftId,
IRevest.FNFTConfig memory fnftConfig,
uint weiValue
) internal {
}
function burn(
address account,
uint id,
uint amount
) internal {
address fnftHandler = addressesProvider.getRevestFNFT();
require(IFNFTHandler(fnftHandler).getSupply(id) - amount >= 0, "E025");
IFNFTHandler(fnftHandler).burn(account, id, amount);
}
function setFlatWeiFee(uint wethFee) external override onlyOwner {
flatWeiFee = wethFee;
}
function setERC20Fee(uint erc20) external override onlyOwner {
erc20Fee = erc20;
}
function getFlatWeiFee() external view override returns (uint) {
return flatWeiFee;
}
function getERC20Fee() external view override returns (uint) {
return erc20Fee;
}
}
| contract RevestRemap is IRevest, AccessControlEnumerable, RevestAccessControl, RevestReentrancyGuard {
using SafeERC20 for IERC20;
using ERC165Checker for address;
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
bytes4 public constant ADDRESS_LOCK_INTERFACE_ID = type(IAddressLock).interfaceId;
address immutable WETH;
uint public erc20Fee = 0; // out of 1000
uint private constant erc20multiplierPrecision = 1000;
uint public flatWeiFee = 0;
uint private constant MAX_INT = 2**256 - 1;
mapping(address => bool) private approved;
/**
* @dev Primary constructor to create the Revest controller contract
* Grants ADMIN and MINTER_ROLE to whoever creates the contract
*
*/
constructor(address provider, address weth) RevestAccessControl(provider) {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
WETH = weth;
}
// PUBLIC FUNCTIONS
/**
* @dev creates a single time-locked NFT with <quantity> number of copies with <amount> of <asset> stored for each copy
* asset - the address of the underlying ERC20 token for this bond
* amount - the amount to store per NFT if multiple NFTs of this variety are being created
* unlockTime - the timestamp at which this will unlock
* quantity – the number of FNFTs to create with this operation */
function mintTimeLock(
uint endTime,
address[] memory recipients,
uint[] memory quantities,
IRevest.FNFTConfig memory fnftConfig
) external payable override returns (uint) {
}
function mintValueLock(
address primaryAsset,
address compareTo,
uint unlockValue,
bool unlockRisingEdge,
address oracleDispatch,
address[] memory recipients,
uint[] memory quantities,
IRevest.FNFTConfig memory fnftConfig
) external payable override returns (uint) {
}
function mintAddressLock(
address trigger,
bytes memory arguments,
address[] memory recipients,
uint[] memory quantities,
IRevest.FNFTConfig memory fnftConfig
) external payable override returns (uint) {
}
function withdrawFNFT(uint fnftId, uint quantity) external override revestNonReentrant(fnftId) {
}
function unlockFNFT(uint fnftId) external override {}
function splitFNFT(
uint fnftId,
uint[] memory proportions,
uint quantity
) external override returns (uint[] memory) {}
/// @return the new (or reused) ID
function extendFNFTMaturity(
uint fnftId,
uint endTime
) external returns (uint) {
}
// Admin function to remap output receiver to new staking contract
function remapFNFTs(uint[] memory fnftIds, address newStaking) external onlyOwner {
address vault = addressesProvider.getTokenVault();
for(uint i = 0; i < fnftIds.length; i++) {
uint id = fnftIds[i];
IRevest.FNFTConfig memory config = ITokenVault(vault).getFNFT(id);
config.pipeToContract = newStaking;
ITokenVault(vault).mapFNFTToToken(id, config);
}
}
function remapAddLocks(uint[] memory fnftIds, address[] memory newLocks, bytes[] memory data) external onlyOwner {
for(uint i = 0; i < fnftIds.length; i++) {
IRevest.LockParam memory addressLock;
addressLock.addressLock = newLocks[i];
addressLock.lockType = IRevest.LockType.AddressLock;
// Get or create lock based on address which can trigger unlock, assign lock to ID
uint lockId = getLockManager().createLock(fnftIds[i], addressLock);
if(newLocks[i].supportsInterface(ADDRESS_LOCK_INTERFACE_ID)) {
IAddressLock(newLocks[i]).createLock(fnftIds[i], lockId, data[i]);
}
}
}
/**
* Amount will be per FNFT. So total ERC20s needed is amount * quantity.
* We don't charge an ETH fee on depositAdditional, but do take the erc20 percentage.
* Users can deposit additional into their own
* Otherwise, if not an owner, they must distribute to all FNFTs equally
*/
function depositAdditionalToFNFT(
uint fnftId,
uint amount,
uint quantity
) external override returns (uint) {
return 0;
}
/**
* @dev Returns the cached IAddressRegistry connected to this contract
**/
function getAddressesProvider() external view returns (IAddressRegistry) {
return addressesProvider;
}
//
// INTERNAL FUNCTIONS
//
function doMint(
address[] memory recipients,
uint[] memory quantities,
uint fnftId,
IRevest.FNFTConfig memory fnftConfig,
uint weiValue
) internal {
}
function burn(
address account,
uint id,
uint amount
) internal {
address fnftHandler = addressesProvider.getRevestFNFT();
require(IFNFTHandler(fnftHandler).getSupply(id) - amount >= 0, "E025");
IFNFTHandler(fnftHandler).burn(account, id, amount);
}
function setFlatWeiFee(uint wethFee) external override onlyOwner {
flatWeiFee = wethFee;
}
function setERC20Fee(uint erc20) external override onlyOwner {
erc20Fee = erc20;
}
function getFlatWeiFee() external view override returns (uint) {
return flatWeiFee;
}
function getERC20Fee() external view override returns (uint) {
return erc20Fee;
}
}
| 6,829 |
80 | // set the rest of the contract variables | uniswapV2Router = _uniswapV2Router;
| uniswapV2Router = _uniswapV2Router;
| 603 |
234 | // Transfer asset to Strategy and call deposit method to mint or take required action | asset.safeTransfer(address(strategy), allocateAmount);
strategy.deposit(address(asset), allocateAmount);
| asset.safeTransfer(address(strategy), allocateAmount);
strategy.deposit(address(asset), allocateAmount);
| 25,539 |
189 | // Token symbol. / | string internal tokenSymbol;
| string internal tokenSymbol;
| 22,084 |
7 | // Set the base live win probability of a ticket. Only callable bythe contract owner. _baseLiveWinProb The probability represented as a valuebetween 0 to 2128 - 1. / | function setBaseLiveWinProb(uint128 _baseLiveWinProb) external onlyOwner {
baseLiveWinProb = _baseLiveWinProb;
emit BaseLiveWinProbUpdated(_baseLiveWinProb);
}
| function setBaseLiveWinProb(uint128 _baseLiveWinProb) external onlyOwner {
baseLiveWinProb = _baseLiveWinProb;
emit BaseLiveWinProbUpdated(_baseLiveWinProb);
}
| 16,442 |
205 | // We've created a new subtree at this level, update | filledSubTrees[level] = _leafHashes[insertionElement];
| filledSubTrees[level] = _leafHashes[insertionElement];
| 62,931 |
19 | // Emitted when the liquidate borrow permission is updated./owner The address of the contract owner./bond The related HToken./state True if liquidating borrow is allowed. | event SetLiquidateBorrowAllowed(address indexed owner, IHToken indexed bond, bool state);
| event SetLiquidateBorrowAllowed(address indexed owner, IHToken indexed bond, bool state);
| 51,608 |
20 | // Returns the amount which _spender is still allowed to withdraw from _owner | function allowance(address _owner, address _spender) constant returns(uint256){
return allowed[_owner][_spender];
}
| function allowance(address _owner, address _spender) constant returns(uint256){
return allowed[_owner][_spender];
}
| 696 |
20 | // reverts if addr does not have role addr address roleName the name of the role / | function checkRole(address addr, string roleName)
view
public
| function checkRole(address addr, string roleName)
view
public
| 18,812 |
279 | // See {ERC20-_beforeTokenTransfer}. See {ERC20Capped-_beforeTokenTransfer}. / | function _beforeTokenTransfer(address from, address to, uint256 amount) internal override(ERC20, ERC20Capped) {
super._beforeTokenTransfer(from, to, amount);
}
| function _beforeTokenTransfer(address from, address to, uint256 amount) internal override(ERC20, ERC20Capped) {
super._beforeTokenTransfer(from, to, amount);
}
| 33,500 |
57 | // override | function burn(uint256 _value) onlyOwner public {
super.burn(_value);
}
| function burn(uint256 _value) onlyOwner public {
super.burn(_value);
}
| 44,600 |
120 | // View function to see pending KIMCHIs on frontend. | function pendingKimchi(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accKimchiPerShare = pool.accKimchiPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (block.number > pool.lastRewardBlock && lpSupply != 0) {
uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
uint256 kimchiReward = multiplier.mul(kimchiPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
accKimchiPerShare = accKimchiPerShare.add(kimchiReward.mul(1e12).div(lpSupply));
}
return user.amount.mul(accKimchiPerShare).div(1e12).sub(user.rewardDebt);
}
| function pendingKimchi(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accKimchiPerShare = pool.accKimchiPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (block.number > pool.lastRewardBlock && lpSupply != 0) {
uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
uint256 kimchiReward = multiplier.mul(kimchiPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
accKimchiPerShare = accKimchiPerShare.add(kimchiReward.mul(1e12).div(lpSupply));
}
return user.amount.mul(accKimchiPerShare).div(1e12).sub(user.rewardDebt);
}
| 37,941 |
10 | // The duration of time after proposal passed with absolute majority before it can be executed | uint256 public fastQueuePeriod; //1 days/8 = 3hours
| uint256 public fastQueuePeriod; //1 days/8 = 3hours
| 18,071 |
10 | // Mentors | uint256 public MENTORS = 80000000 * 10**uint256(decimals);
| uint256 public MENTORS = 80000000 * 10**uint256(decimals);
| 11,765 |
19 | // @inheritdoc IRaffle This function can still be called when the contract is paused because the raffle creator would not be able to deposit prizes and open the raffle anyway. The restriction to disallow raffles creation when the contract is paused will be enforced in the frontend. / | function createRaffle(
CreateRaffleCalldata calldata params
| function createRaffle(
CreateRaffleCalldata calldata params
| 16,678 |
4 | // access to a non-existing index will throw an exception | m_pairsOfFlags[index][0] = flagA;
m_pairsOfFlags[index][1] = flagB;
| m_pairsOfFlags[index][0] = flagA;
m_pairsOfFlags[index][1] = flagB;
| 41,085 |
6 | // Handler for dealing with assets when minting multiple at once./from The original address that signed the transaction./gemsQuantities An array listing the quantity of each type of gem./catalystsQuantities An array listing the quantity of each type of catalyst./assets An array of AssetData structs to define how the total gems and catalysts are to be allocated./ return supplies An array of the quantities for each asset being minted. | function _handleMultipleAssetRequirements(
address from,
uint256[] memory gemsQuantities,
uint256[] memory catalystsQuantities,
AssetData[] memory assets
| function _handleMultipleAssetRequirements(
address from,
uint256[] memory gemsQuantities,
uint256[] memory catalystsQuantities,
AssetData[] memory assets
| 8,286 |
191 | // get past rounds answers overridden funcion to add the checkAccess() modifier _roundId the round number to retrieve the answer for deprecated. Use getRoundData instead. / | function getAnswer(uint256 _roundId)
public
view
override
checkAccess()
returns (int256)
| function getAnswer(uint256 _roundId)
public
view
override
checkAccess()
returns (int256)
| 40,910 |
131 | // accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted reserve factor change failed. | return fail(Error(error), FailureInfo.SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED);
| return fail(Error(error), FailureInfo.SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED);
| 11,804 |
151 | // Should not withdraw less than requested amount | _share = _amount > ((_share * _pricePerShare) / 1e18) ? _share + 1 : _share;
IVesperPool(receiptToken).whitelistedWithdraw(_share);
| _share = _amount > ((_share * _pricePerShare) / 1e18) ? _share + 1 : _share;
IVesperPool(receiptToken).whitelistedWithdraw(_share);
| 61,653 |
22 | // Oracle: Indicate the game `gameId` as canceled.gameId the current game ID / | function cancelGame(uint256 gameId) external onlyOracle {
Game storage game = games[gameId];
if (game.startsAt == 0) revert GameNotExists();
if (game.canceled) revert GameAlreadyCanceled();
lockedLiquidity -= game.lockedLiquidity;
game.canceled = true;
emit GameCanceled(gameId);
}
| function cancelGame(uint256 gameId) external onlyOracle {
Game storage game = games[gameId];
if (game.startsAt == 0) revert GameNotExists();
if (game.canceled) revert GameAlreadyCanceled();
lockedLiquidity -= game.lockedLiquidity;
game.canceled = true;
emit GameCanceled(gameId);
}
| 23,065 |
174 | // Emits a {DepositCollateral} event. Requirements: - The vault must be open.- The amount to deposit cannot be zero.- The Fintroller must allow this action to be performed.- The caller must have allowed this contract to spend `collateralAmount` tokens.fyToken The address of the fyToken contract. collateralAmount The amount of collateral to withdraw.return true = success, otherwise it reverts. / |
function depositCollateral(FyTokenInterface fyToken, uint256 collateralAmount)
external
override
isVaultOpenForMsgSender(fyToken)
nonReentrant
|
function depositCollateral(FyTokenInterface fyToken, uint256 collateralAmount)
external
override
isVaultOpenForMsgSender(fyToken)
nonReentrant
| 6,014 |
860 | // approve iDai to that contract | ERC20(NEW_IDAI_ADDRESS).approve(NEW_IDAI_ADDRESS, uint(-1));
uint tokenPrice = ITokenInterface(NEW_IDAI_ADDRESS).tokenPrice();
| ERC20(NEW_IDAI_ADDRESS).approve(NEW_IDAI_ADDRESS, uint(-1));
uint tokenPrice = ITokenInterface(NEW_IDAI_ADDRESS).tokenPrice();
| 63,336 |
3 | // This function allows users to withdraw their stake after a 7 day waiting period from request/ | function withdrawStake(TellorStorage.TellorStorageStruct storage self) public {
TellorStorage.StakeInfo storage stakes = self.stakerDetails[msg.sender];
//Require the staker has locked for withdraw(currentStatus ==2) and that 7 days have
//passed by since they locked for withdraw
require(now - (now % 86400) - stakes.withdrawDate >= 7 days, "7 days didn't pass");
require(stakes.currentStatus !=3 , "Miner is under dispute");
TellorTransfer.doTransfer(self,msg.sender,address(0),stakes.withdrawAmount);
if (TellorTransfer.balanceOf(self,msg.sender) == 0){
stakes.currentStatus =0 ;
self.uintVars[keccak256("stakerCount")] -= 1;
self.uintVars[keccak256("uniqueStakers")] -= 1;
}
self.uintVars[keccak256("totalStaked")] -= stakes.withdrawAmount;
TokenInterface tellorToken = TokenInterface(self.addressVars[keccak256("tellorToken")]);
tellorToken.transfer(msg.sender,stakes.withdrawAmount);
emit StakeWithdrawn(msg.sender);
}
| function withdrawStake(TellorStorage.TellorStorageStruct storage self) public {
TellorStorage.StakeInfo storage stakes = self.stakerDetails[msg.sender];
//Require the staker has locked for withdraw(currentStatus ==2) and that 7 days have
//passed by since they locked for withdraw
require(now - (now % 86400) - stakes.withdrawDate >= 7 days, "7 days didn't pass");
require(stakes.currentStatus !=3 , "Miner is under dispute");
TellorTransfer.doTransfer(self,msg.sender,address(0),stakes.withdrawAmount);
if (TellorTransfer.balanceOf(self,msg.sender) == 0){
stakes.currentStatus =0 ;
self.uintVars[keccak256("stakerCount")] -= 1;
self.uintVars[keccak256("uniqueStakers")] -= 1;
}
self.uintVars[keccak256("totalStaked")] -= stakes.withdrawAmount;
TokenInterface tellorToken = TokenInterface(self.addressVars[keccak256("tellorToken")]);
tellorToken.transfer(msg.sender,stakes.withdrawAmount);
emit StakeWithdrawn(msg.sender);
}
| 41,689 |
20 | // set a reasonable maximum here so we don't run out of gas | if (numTokens > 100) {
revert TooManyTokens();
}
| if (numTokens > 100) {
revert TooManyTokens();
}
| 28,878 |
429 | // round 5 | ark(i, q, 17933600965499023212689924809448543050840131883187652471064418452962948061619);
sbox_partial(i, q);
mix(i, q);
| ark(i, q, 17933600965499023212689924809448543050840131883187652471064418452962948061619);
sbox_partial(i, q);
mix(i, q);
| 81,083 |
268 | // update fees for inclusion in total pool amounts | (uint128 baseLiquidity, , ) = _position(baseLower, baseUpper);
if (baseLiquidity > 0) {
(uint burn0, uint burn1) = IUniswapV3Pool(pool).burn(baseLower, baseUpper, 0);
require(burn0 == 0 && burn1 == 0, "IV.deposit: unexpected burn (1)");
}
| (uint128 baseLiquidity, , ) = _position(baseLower, baseUpper);
if (baseLiquidity > 0) {
(uint burn0, uint burn1) = IUniswapV3Pool(pool).burn(baseLower, baseUpper, 0);
require(burn0 == 0 && burn1 == 0, "IV.deposit: unexpected burn (1)");
}
| 25,729 |
102 | // If this adapter is being added for the first time | if (isOn && am.id == 0) {
am.id = ++adapterCounter;
adapterAddresses[am.id] = adapter;
}
| if (isOn && am.id == 0) {
am.id = ++adapterCounter;
adapterAddresses[am.id] = adapter;
}
| 11,179 |
8 | // We can divide by magnitude Remainder is removed so we only get the actual number we want | uint actualDiv = divRate;
if (actualDiv >= 30){
return 6;
} else if (actualDiv >= 25){
| uint actualDiv = divRate;
if (actualDiv >= 30){
return 6;
} else if (actualDiv >= 25){
| 8,191 |
11 | // Pause minting flag / | bool public isPaused;
| bool public isPaused;
| 23,067 |
4 | // cage by reading the last value from the feed for the price | function cage() public note auth {
cage(rdiv(uint(tub.pip().read()), vox.par()));
}
| function cage() public note auth {
cage(rdiv(uint(tub.pip().read()), vox.par()));
}
| 20,439 |
16 | // Removes an address from the list of agents authorizedto make 'insert' mutations to the registry. / | function revokeInsertAgentAuthorization(address agent)
public
onlyOwner
| function revokeInsertAgentAuthorization(address agent)
public
onlyOwner
| 15,754 |
34 | // Minus 1y locked tokens | remainingTokens = remainingTokens.sub(totalSupplyLocked1Y);
| remainingTokens = remainingTokens.sub(totalSupplyLocked1Y);
| 8,320 |
99 | // -- Enums -- | enum BlockType
| enum BlockType
| 9,818 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.