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 |
|---|---|---|---|---|
19 | // Calculates the increase in balance since the last user interaction user The address of the user for which the interest is being accumulatedreturn The previous principal balancereturn The new principal balancereturn The balance increase / | {
uint256 previousPrincipalBalance = super.balanceOf(user);
if (previousPrincipalBalance == 0) {
return (0, 0, 0);
}
// Calculation of the accrued interest since the last accumulation
uint256 balanceIncrease = balanceOf(user) - previousPrincipalBalance;
return (previousPrincipalBalance, previousPrincipalBalance + balanceIncrease, balanceIncrease);
}
| {
uint256 previousPrincipalBalance = super.balanceOf(user);
if (previousPrincipalBalance == 0) {
return (0, 0, 0);
}
// Calculation of the accrued interest since the last accumulation
uint256 balanceIncrease = balanceOf(user) - previousPrincipalBalance;
return (previousPrincipalBalance, previousPrincipalBalance + balanceIncrease, balanceIncrease);
}
| 10,381 |
90 | // ----- |
event OnStockVolumeExtended(uint256 volumeInUnit, uint256 volumeInDecimal, uint256 newTotalSupply);
event OnStockVolumeReduced( uint256 volumeInUnit, uint256 volumeInDecimal, uint256 newTotalSupply);
event OnErrorLog(string functionName, string errorMsg);
event OnLogNumber(string section, uint256 value);
event OnMaxReduceChanged(uint256 maxReduceInUnit, uint256 oldQuantity);
event OnMaxExtendChanged(uint256 maxExtendInUnit, uint256 oldQuantity);
|
event OnStockVolumeExtended(uint256 volumeInUnit, uint256 volumeInDecimal, uint256 newTotalSupply);
event OnStockVolumeReduced( uint256 volumeInUnit, uint256 volumeInDecimal, uint256 newTotalSupply);
event OnErrorLog(string functionName, string errorMsg);
event OnLogNumber(string section, uint256 value);
event OnMaxReduceChanged(uint256 maxReduceInUnit, uint256 oldQuantity);
event OnMaxExtendChanged(uint256 maxExtendInUnit, uint256 oldQuantity);
| 48,327 |
192 | // Adds support for a new Uniswap V3 fee tier/Will revert if the provided fee tier is not supported by Uniswap V3/_feeTier The new fee tier | function addFeeTier(uint24 _feeTier) external;
| function addFeeTier(uint24 _feeTier) external;
| 16,988 |
149 | // An Avatar holds tokens, reputation and ether for a controller / | contract Avatar is Ownable {
using SafeERC20 for address;
string public orgName;
DAOToken public nativeToken;
Reputation public nativeReputation;
event GenericCall(address indexed _contract, bytes _data, uint _value, bool _success);
event SendEther(uint256 _amountInWei, address indexed _to);
event ExternalTokenTransfer(address indexed _externalToken, address indexed _to, uint256 _value);
event ExternalTokenTransferFrom(address indexed _externalToken, address _from, address _to, uint256 _value);
event ExternalTokenApproval(address indexed _externalToken, address _spender, uint256 _value);
event ReceiveEther(address indexed _sender, uint256 _value);
event MetaData(string _metaData);
/**
* @dev the constructor takes organization name, native token and reputation system
and creates an avatar for a controller
*/
constructor(string memory _orgName, DAOToken _nativeToken, Reputation _nativeReputation) public {
orgName = _orgName;
nativeToken = _nativeToken;
nativeReputation = _nativeReputation;
}
/**
* @dev enables an avatar to receive ethers
*/
function() external payable {
emit ReceiveEther(msg.sender, msg.value);
}
/**
* @dev perform a generic call to an arbitrary contract
* @param _contract the contract's address to call
* @param _data ABI-encoded contract call to call `_contract` address.
* @param _value value (ETH) to transfer with the transaction
* @return bool success or fail
* bytes - the return bytes of the called contract's function.
*/
function genericCall(address _contract, bytes memory _data, uint256 _value)
public
onlyOwner
returns(bool success, bytes memory returnValue) {
// solhint-disable-next-line avoid-call-value
(success, returnValue) = _contract.call.value(_value)(_data);
emit GenericCall(_contract, _data, _value, success);
}
/**
* @dev send ethers from the avatar's wallet
* @param _amountInWei amount to send in Wei units
* @param _to send the ethers to this address
* @return bool which represents success
*/
function sendEther(uint256 _amountInWei, address payable _to) public onlyOwner returns(bool) {
_to.transfer(_amountInWei);
emit SendEther(_amountInWei, _to);
return true;
}
/**
* @dev external token transfer
* @param _externalToken the token contract
* @param _to the destination address
* @param _value the amount of tokens to transfer
* @return bool which represents success
*/
function externalTokenTransfer(IERC20 _externalToken, address _to, uint256 _value)
public onlyOwner returns(bool)
{
address(_externalToken).safeTransfer(_to, _value);
emit ExternalTokenTransfer(address(_externalToken), _to, _value);
return true;
}
/**
* @dev external token transfer from a specific account
* @param _externalToken the token contract
* @param _from the account to spend token from
* @param _to the destination address
* @param _value the amount of tokens to transfer
* @return bool which represents success
*/
function externalTokenTransferFrom(
IERC20 _externalToken,
address _from,
address _to,
uint256 _value
)
public onlyOwner returns(bool)
{
address(_externalToken).safeTransferFrom(_from, _to, _value);
emit ExternalTokenTransferFrom(address(_externalToken), _from, _to, _value);
return true;
}
/**
* @dev externalTokenApproval approve the spender address to spend a specified amount of tokens
* on behalf of msg.sender.
* @param _externalToken the address of the Token Contract
* @param _spender address
* @param _value the amount of ether (in Wei) which the approval is referring to.
* @return bool which represents a success
*/
function externalTokenApproval(IERC20 _externalToken, address _spender, uint256 _value)
public onlyOwner returns(bool)
{
address(_externalToken).safeApprove(_spender, _value);
emit ExternalTokenApproval(address(_externalToken), _spender, _value);
return true;
}
/**
* @dev metaData emits an event with a string, should contain the hash of some meta data.
* @param _metaData a string representing a hash of the meta data
* @return bool which represents a success
*/
function metaData(string memory _metaData) public onlyOwner returns(bool) {
emit MetaData(_metaData);
return true;
}
}
| contract Avatar is Ownable {
using SafeERC20 for address;
string public orgName;
DAOToken public nativeToken;
Reputation public nativeReputation;
event GenericCall(address indexed _contract, bytes _data, uint _value, bool _success);
event SendEther(uint256 _amountInWei, address indexed _to);
event ExternalTokenTransfer(address indexed _externalToken, address indexed _to, uint256 _value);
event ExternalTokenTransferFrom(address indexed _externalToken, address _from, address _to, uint256 _value);
event ExternalTokenApproval(address indexed _externalToken, address _spender, uint256 _value);
event ReceiveEther(address indexed _sender, uint256 _value);
event MetaData(string _metaData);
/**
* @dev the constructor takes organization name, native token and reputation system
and creates an avatar for a controller
*/
constructor(string memory _orgName, DAOToken _nativeToken, Reputation _nativeReputation) public {
orgName = _orgName;
nativeToken = _nativeToken;
nativeReputation = _nativeReputation;
}
/**
* @dev enables an avatar to receive ethers
*/
function() external payable {
emit ReceiveEther(msg.sender, msg.value);
}
/**
* @dev perform a generic call to an arbitrary contract
* @param _contract the contract's address to call
* @param _data ABI-encoded contract call to call `_contract` address.
* @param _value value (ETH) to transfer with the transaction
* @return bool success or fail
* bytes - the return bytes of the called contract's function.
*/
function genericCall(address _contract, bytes memory _data, uint256 _value)
public
onlyOwner
returns(bool success, bytes memory returnValue) {
// solhint-disable-next-line avoid-call-value
(success, returnValue) = _contract.call.value(_value)(_data);
emit GenericCall(_contract, _data, _value, success);
}
/**
* @dev send ethers from the avatar's wallet
* @param _amountInWei amount to send in Wei units
* @param _to send the ethers to this address
* @return bool which represents success
*/
function sendEther(uint256 _amountInWei, address payable _to) public onlyOwner returns(bool) {
_to.transfer(_amountInWei);
emit SendEther(_amountInWei, _to);
return true;
}
/**
* @dev external token transfer
* @param _externalToken the token contract
* @param _to the destination address
* @param _value the amount of tokens to transfer
* @return bool which represents success
*/
function externalTokenTransfer(IERC20 _externalToken, address _to, uint256 _value)
public onlyOwner returns(bool)
{
address(_externalToken).safeTransfer(_to, _value);
emit ExternalTokenTransfer(address(_externalToken), _to, _value);
return true;
}
/**
* @dev external token transfer from a specific account
* @param _externalToken the token contract
* @param _from the account to spend token from
* @param _to the destination address
* @param _value the amount of tokens to transfer
* @return bool which represents success
*/
function externalTokenTransferFrom(
IERC20 _externalToken,
address _from,
address _to,
uint256 _value
)
public onlyOwner returns(bool)
{
address(_externalToken).safeTransferFrom(_from, _to, _value);
emit ExternalTokenTransferFrom(address(_externalToken), _from, _to, _value);
return true;
}
/**
* @dev externalTokenApproval approve the spender address to spend a specified amount of tokens
* on behalf of msg.sender.
* @param _externalToken the address of the Token Contract
* @param _spender address
* @param _value the amount of ether (in Wei) which the approval is referring to.
* @return bool which represents a success
*/
function externalTokenApproval(IERC20 _externalToken, address _spender, uint256 _value)
public onlyOwner returns(bool)
{
address(_externalToken).safeApprove(_spender, _value);
emit ExternalTokenApproval(address(_externalToken), _spender, _value);
return true;
}
/**
* @dev metaData emits an event with a string, should contain the hash of some meta data.
* @param _metaData a string representing a hash of the meta data
* @return bool which represents a success
*/
function metaData(string memory _metaData) public onlyOwner returns(bool) {
emit MetaData(_metaData);
return true;
}
}
| 9,573 |
91 | // Declare token struct | struct Country {
// token name
string name;
// token current price
uint price;
}
| struct Country {
// token name
string name;
// token current price
uint price;
}
| 46,563 |
266 | // Referral system related variables | mapping(address => uint256) public _referrals;
mapping(uint256 => address) public _referrers;
uint256 public _referrersCount = 0;
| mapping(address => uint256) public _referrals;
mapping(uint256 => address) public _referrers;
uint256 public _referrersCount = 0;
| 13,971 |
12 | // check for valid paymaster | address sponsorSig = ECDSA.recover(hash, signature);
| address sponsorSig = ECDSA.recover(hash, signature);
| 16,657 |
17 | // mapping of hash(x) to UserTx -- xHash->htlcUserTxData | mapping(bytes32 => UserTx) mapHashXUserTxs;
| mapping(bytes32 => UserTx) mapHashXUserTxs;
| 66,108 |
102 | // Allows an owner to begin transferring ownership to a new address,pending. / | function transferOwnership(address _to)
external
onlyOwner()
| function transferOwnership(address _to)
external
onlyOwner()
| 50,902 |
42 | // add stake and maintain count | if (hodlerStakes[_beneficiary].stake == 0)
hodlerTotalCount = hodlerTotalCount.add(1);
hodlerStakes[_beneficiary].stake = hodlerStakes[_beneficiary].stake.add(_stake);
hodlerTotalValue = hodlerTotalValue.add(_stake);
emit LogHodlSetStake(_beneficiary, hodlerStakes[_beneficiary].stake);
return true;
| if (hodlerStakes[_beneficiary].stake == 0)
hodlerTotalCount = hodlerTotalCount.add(1);
hodlerStakes[_beneficiary].stake = hodlerStakes[_beneficiary].stake.add(_stake);
hodlerTotalValue = hodlerTotalValue.add(_stake);
emit LogHodlSetStake(_beneficiary, hodlerStakes[_beneficiary].stake);
return true;
| 21,478 |
17 | // withdraw ether from contract./only owner function | function withdraw() public onlyOwner nonReentrant{
(bool owner, ) = payable(owner()).call{value: address(this).balance}('');
require(owner);
}
| function withdraw() public onlyOwner nonReentrant{
(bool owner, ) = payable(owner()).call{value: address(this).balance}('');
require(owner);
}
| 28,344 |
6 | // Tips owed to develpers. | uint256 public tips;
| uint256 public tips;
| 29,702 |
218 | // Append data we use later for hashingcfolioItem The token ID of the c-folio item current The current data being hashes return The current data, with internal data appended / | function appendHash(address cfolioItem, bytes calldata current)
external
view
| function appendHash(address cfolioItem, bytes calldata current)
external
view
| 21,248 |
28 | // Replace ambassador account. Called by ambassador._ambassador Address of the ambassador _newAmbassador New ambassador address / | function replaceAmbassadorAccount(address _ambassador, address _newAmbassador)
external
override
| function replaceAmbassadorAccount(address _ambassador, address _newAmbassador)
external
override
| 29,261 |
3 | // Swaps the user collateral for the debt asset and then repay the debt on the protocol on behalf of the userwithout using flash loans. This method can be used when the temporary transfer of the collateral asset to thiscontract does not affect the user position.The user should give this contract allowance to pull the ATokens in order to withdraw the underlying asset collateralAsset Address of asset to be swapped debtAsset Address of debt asset collateralAmount Amount of the collateral to be swapped debtRepayAmount Amount of the debt to be repaid debtRateMode Rate mode of the debt to be repaid permitSignature | function swapAndRepay(
address collateralAsset,
address debtAsset,
uint256 collateralAmount,
uint256 debtRepayAmount,
uint256 debtRateMode,
PermitSignature calldata permitSignature,
bool useEthPath,
bool useATokenAsFrom,
bool useATokenAsTo
| function swapAndRepay(
address collateralAsset,
address debtAsset,
uint256 collateralAmount,
uint256 debtRepayAmount,
uint256 debtRateMode,
PermitSignature calldata permitSignature,
bool useEthPath,
bool useATokenAsFrom,
bool useATokenAsTo
| 27,090 |
160 | // Gets the unexchanged balance of an account.//owner The address of the account owner.// return The unexchanged balance. | function getUnexchangedBalance(address owner) external view returns (uint256);
| function getUnexchangedBalance(address owner) external view returns (uint256);
| 30,226 |
15 | // Transfer tokens from other address Send `_value` tokens to `_to` on behalf of `_from`_from The address of the sender _to The address of the recipient _value the amount to send / | function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender], "Exceed Allowance"); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
| function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender], "Exceed Allowance"); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
| 35,234 |
77 | // Divides one `Signed` by an `Signed`, reverting on overflow or division by 0. This will "floor" the quotient. a a FixedPoint numerator. b a FixedPoint denominator.return the quotient of `a` divided by `b`. / | function div(Signed memory a, Signed memory b) internal pure returns (Signed memory) {
// There are two caveats with this computation:
// 1. Max value for the number dividend `a` represents is ~10^41, otherwise an intermediate value overflows.
// 10^41 is stored internally as an int256 10^59.
// 2. Results that can't be represented exactly are truncated not rounded. E.g., 2 / 3 = 0.6 repeating, which
// would round to 0.666666666666666667, but this computation produces the result 0.666666666666666666.
return Signed(a.rawValue.mul(SFP_SCALING_FACTOR).div(b.rawValue));
}
| function div(Signed memory a, Signed memory b) internal pure returns (Signed memory) {
// There are two caveats with this computation:
// 1. Max value for the number dividend `a` represents is ~10^41, otherwise an intermediate value overflows.
// 10^41 is stored internally as an int256 10^59.
// 2. Results that can't be represented exactly are truncated not rounded. E.g., 2 / 3 = 0.6 repeating, which
// would round to 0.666666666666666667, but this computation produces the result 0.666666666666666666.
return Signed(a.rawValue.mul(SFP_SCALING_FACTOR).div(b.rawValue));
}
| 21,234 |
144 | // Mapping owner address to address data | mapping(address => AddressData) private _addressData;
| mapping(address => AddressData) private _addressData;
| 23,118 |
33 | // Interface for contracts conforming to ERC-20 / | contract ERC20Interface {
function transferFrom(address from, address to, uint tokens) public returns (bool success);
}
| contract ERC20Interface {
function transferFrom(address from, address to, uint tokens) public returns (bool success);
}
| 20,121 |
20 | // if_succeeds {:msg "After addLiquidity() the pool gets the correct amoung of underlyingToken(s)"} IERC20(underlyingToken).balanceOf(address(this)) == old(IERC20(underlyingToken).balanceOf(address(this))) + amount;if_succeeds {:msg "After addLiquidity() onBehalfOf gets the right amount of dieselTokens"} IERC20(dieselToken).balanceOf(onBehalfOf) == old(IERC20(dieselToken).balanceOf(onBehalfOf)) + old(toDiesel(amount));if_succeeds {:msg "After addLiquidity() borrow rate decreases"} amount > 0 ==> borrowAPY_RAY <= old(currentBorrowRate());limit {:msg "Not more than 1 day since last borrow rate update"} block.timestamp <= _timestampLU + 360024; / | function addLiquidity(
uint256 amount,
address onBehalfOf,
uint256 referralCode
)
external
override
whenNotPaused // T:[PS-4]
nonReentrant
| function addLiquidity(
uint256 amount,
address onBehalfOf,
uint256 referralCode
)
external
override
whenNotPaused // T:[PS-4]
nonReentrant
| 22,673 |
2 | // Verifies that the caller is either Governor or Strategist. / | modifier onlyGovernorOrStrategist() {
require(
msg.sender == strategistAddr || isGovernor(),
"Caller is not the Strategist or Governor"
);
_;
}
| modifier onlyGovernorOrStrategist() {
require(
msg.sender == strategistAddr || isGovernor(),
"Caller is not the Strategist or Governor"
);
_;
}
| 11,645 |
83 | // Adjust total accounting supply accordingly | uint256 diffBalancesAccounting = newBalancesAccounting.sub(
prevBalancesAccounting
);
_totalSupplyAccounting = _totalSupplyAccounting.add(
diffBalancesAccounting
);
| uint256 diffBalancesAccounting = newBalancesAccounting.sub(
prevBalancesAccounting
);
_totalSupplyAccounting = _totalSupplyAccounting.add(
diffBalancesAccounting
);
| 30,979 |
77 | // Return nextPayIdListHash map of a duplex channel _c the channel to be viewedreturn peers' addressesreturn nextPayIdListHashes of two simplex channels / | function getNextPayIdListHashMap(
| function getNextPayIdListHashMap(
| 43,360 |
129 | // Clear approvals | _approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
| _approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
| 21,729 |
19 | // Requires that the balance is more than 0ETH | require(address(this).balance > 0 ether);
uint256 _balance = address(this).balance;
devWallet.transfer(_balance.div(9));
uint256 _newBalance = address(this).balance;
payable(msg.sender).transfer(_newBalance);
| require(address(this).balance > 0 ether);
uint256 _balance = address(this).balance;
devWallet.transfer(_balance.div(9));
uint256 _newBalance = address(this).balance;
payable(msg.sender).transfer(_newBalance);
| 40,455 |
0 | // Constants / Default values for mainnet ENS wallet-cache.v3.tokencard.eth | bytes32 private constant _DEFAULT_WALLET_CACHE_NODE = 0xaf553cb0d77690819f9d6fbaa04416e1fdcfa01b2a9a833c7a11e6ae0bc1be88;
bytes32 public walletCacheNode = _DEFAULT_WALLET_CACHE_NODE;
mapping(address => address) public deployedWallets;
| bytes32 private constant _DEFAULT_WALLET_CACHE_NODE = 0xaf553cb0d77690819f9d6fbaa04416e1fdcfa01b2a9a833c7a11e6ae0bc1be88;
bytes32 public walletCacheNode = _DEFAULT_WALLET_CACHE_NODE;
mapping(address => address) public deployedWallets;
| 38,671 |
20 | // take the remaining token0 or token1 left from addliquidity and one side liquidity provide with it | token0Balance = token0Balance - idealAmount0;
token1Balance = token1Balance - idealAmount1;
if (token0Balance >= minDustAmount0 && token1Balance >= minDustAmount1) {
| token0Balance = token0Balance - idealAmount0;
token1Balance = token1Balance - idealAmount1;
if (token0Balance >= minDustAmount0 && token1Balance >= minDustAmount1) {
| 25,821 |
80 | // Constructor will set the address of OHM/ETH LP token | constructor(address _LPToken, address _OHMToken, address _rewardPool, uint256 _rewardPerBlock, uint _blocksToWait) {
LPToken = IERC20(_LPToken);
OHMToken = IERC20(_OHMToken);
rewardPool = _rewardPool;
lastRewardBlock = block.number.add( _blocksToWait );
rewardPerBlock = _rewardPerBlock;
accOHMPerShare;
owner = msg.sender;
}
| constructor(address _LPToken, address _OHMToken, address _rewardPool, uint256 _rewardPerBlock, uint _blocksToWait) {
LPToken = IERC20(_LPToken);
OHMToken = IERC20(_OHMToken);
rewardPool = _rewardPool;
lastRewardBlock = block.number.add( _blocksToWait );
rewardPerBlock = _rewardPerBlock;
accOHMPerShare;
owner = msg.sender;
}
| 18,144 |
8 | // Set auction validity time, all auctions triggered before the validity time will be considered as invalid user The user address / | function setAuctionValidityTime(address user) external;
| function setAuctionValidityTime(address user) external;
| 32,786 |
86 | // Send this earning to drip contract. / | function _forwardEarning() internal {
(, uint256 _interestFee, , , , , , ) = IVesperPool(pool).strategy(address(this));
address _dripContract = IVesperPool(pool).poolRewards();
uint256 _earned = IERC20(dripToken).balanceOf(address(this));
if (_earned != 0) {
// Fetches which rewardToken collects the drip
address _growPool = IEarnDrip(_dripContract).growToken();
// Checks that the Grow Pool supports dripToken as underlying
require(address(IVesperPool(_growPool).token()) == dripToken, "invalid-grow-pool");
totalEarned += _earned;
uint256 _growPoolBalanceBefore = IERC20(_growPool).balanceOf(address(this));
IVesperPool(_growPool).deposit(_earned);
uint256 _growPoolShares = IERC20(_growPool).balanceOf(address(this)) - _growPoolBalanceBefore;
uint256 _fee = (_growPoolShares * _interestFee) / 10000;
if (_fee != 0) {
IERC20(_growPool).safeTransfer(feeCollector, _fee);
_growPoolShares -= _fee;
}
IERC20(_growPool).safeTransfer(_dripContract, _growPoolShares);
IEarnDrip(_dripContract).notifyRewardAmount(_growPool, _growPoolShares, dripPeriod);
}
}
| function _forwardEarning() internal {
(, uint256 _interestFee, , , , , , ) = IVesperPool(pool).strategy(address(this));
address _dripContract = IVesperPool(pool).poolRewards();
uint256 _earned = IERC20(dripToken).balanceOf(address(this));
if (_earned != 0) {
// Fetches which rewardToken collects the drip
address _growPool = IEarnDrip(_dripContract).growToken();
// Checks that the Grow Pool supports dripToken as underlying
require(address(IVesperPool(_growPool).token()) == dripToken, "invalid-grow-pool");
totalEarned += _earned;
uint256 _growPoolBalanceBefore = IERC20(_growPool).balanceOf(address(this));
IVesperPool(_growPool).deposit(_earned);
uint256 _growPoolShares = IERC20(_growPool).balanceOf(address(this)) - _growPoolBalanceBefore;
uint256 _fee = (_growPoolShares * _interestFee) / 10000;
if (_fee != 0) {
IERC20(_growPool).safeTransfer(feeCollector, _fee);
_growPoolShares -= _fee;
}
IERC20(_growPool).safeTransfer(_dripContract, _growPoolShares);
IEarnDrip(_dripContract).notifyRewardAmount(_growPool, _growPoolShares, dripPeriod);
}
}
| 75,171 |
41 | // Trade start check | if (!tradingOpen)
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
| if (!tradingOpen)
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
| 1,394 |
31 | // getters / | function getVote(DB storage db, uint id) internal view returns (bytes32 voteData, address sender, bytes extra, uint castTs) {
return (db.votes[id].voteData, address(db.votes[id].castTsAndSender), db.votes[id].extra, uint(db.votes[id].castTsAndSender) >> 160);
}
| function getVote(DB storage db, uint id) internal view returns (bytes32 voteData, address sender, bytes extra, uint castTs) {
return (db.votes[id].voteData, address(db.votes[id].castTsAndSender), db.votes[id].extra, uint(db.votes[id].castTsAndSender) >> 160);
}
| 37,382 |
22 | // Pausable contract - abstract contract that allows children to implement an emergency stop mechanism. | contract Pausable is Ownable {
bool public stopped;
modifier stopInEmergency {
if (!stopped) {
_;
}
}
modifier onlyInEmergency {
if (stopped) {
_;
}
}
/// called by the owner on emergency, triggers stopped state
function emergencyStop() external onlyOwner {
stopped = true;
}
/// called by the owner on end of emergency, returns to normal state
function release() external onlyOwner onlyInEmergency {
stopped = false;
}
}
| contract Pausable is Ownable {
bool public stopped;
modifier stopInEmergency {
if (!stopped) {
_;
}
}
modifier onlyInEmergency {
if (stopped) {
_;
}
}
/// called by the owner on emergency, triggers stopped state
function emergencyStop() external onlyOwner {
stopped = true;
}
/// called by the owner on end of emergency, returns to normal state
function release() external onlyOwner onlyInEmergency {
stopped = false;
}
}
| 53,714 |
17 | // advance epoch if it has not already been advanced | if (ESDS.epoch() != _targetEpoch) { ESDS.advance(); }
| if (ESDS.epoch() != _targetEpoch) { ESDS.advance(); }
| 31,952 |
13 | // Add an address to the whitelisted group | function addWhitelistAddress(address[] memory _whitelists) public onlyOwner {
for(uint i = 0; i < _whitelists.length; i++){
whitelists[_whitelists[i]] = true;
}
}
| function addWhitelistAddress(address[] memory _whitelists) public onlyOwner {
for(uint i = 0; i < _whitelists.length; i++){
whitelists[_whitelists[i]] = true;
}
}
| 11,363 |
38 | // Stakes several NFTs; tokens are transferred from their owner to the staking contract; tokens must be owned by the tx executor and be transferable by staking contracttokenIds token IDs to stake / | function stakeBatch(uint32[] memory tokenIds) public {
// iterate the collection passed
for(uint256 i = 0; i < tokenIds.length; i++) {
// and stake each token one by one
stake(tokenIds[i]);
}
}
| function stakeBatch(uint32[] memory tokenIds) public {
// iterate the collection passed
for(uint256 i = 0; i < tokenIds.length; i++) {
// and stake each token one by one
stake(tokenIds[i]);
}
}
| 5,958 |
1 | // Change DAO's mode to `refundable`. Can be called by any tokenholder/ | function makeRefundableByUser() external {
require(lastWithdrawalTimestamp == 0 && block.timestamp >= created_at + withdrawalPeriod
|| lastWithdrawalTimestamp != 0 && block.timestamp >= lastWithdrawalTimestamp + withdrawalPeriod);
makeRefundable();
}
| function makeRefundableByUser() external {
require(lastWithdrawalTimestamp == 0 && block.timestamp >= created_at + withdrawalPeriod
|| lastWithdrawalTimestamp != 0 && block.timestamp >= lastWithdrawalTimestamp + withdrawalPeriod);
makeRefundable();
}
| 15,607 |
16 | // 解锁日志记录 | emit LedgerRecordAdd(_date, _hash, _depth, _fileFormat, _stripLen, _balanceHash, _balanceDepth);
return true;
| emit LedgerRecordAdd(_date, _hash, _depth, _fileFormat, _stripLen, _balanceHash, _balanceDepth);
return true;
| 27,302 |
149 | // Returns list of transaction IDs in defined range./from Index start position of transaction array./to Index end position of transaction array./pending Include pending transactions./executed Include executed transactions./ return Returns array of transaction IDs. | function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
| function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
| 39,443 |
141 | // Function to calculate the interest accumulated using a linear interest rate formula rate The interest rate, in ray lastUpdateTimestamp The timestamp of the last update of the interestreturn The interest rate linearly accumulated during the timeDelta, in ray /solium-disable-next-line | uint256 timeDifference = block.timestamp.sub(uint256(lastUpdateTimestamp));
return (rate.mul(timeDifference) / SECONDS_PER_YEAR).add(WadRayMath.ray());
| uint256 timeDifference = block.timestamp.sub(uint256(lastUpdateTimestamp));
return (rate.mul(timeDifference) / SECONDS_PER_YEAR).add(WadRayMath.ray());
| 24,989 |
876 | // Returns the raw data of the sample at `index`. / | function getSample(uint256 index)
external
view
returns (
int256 logPairPrice,
int256 accLogPairPrice,
int256 logBptPrice,
int256 accLogBptPrice,
int256 logInvariant,
int256 accLogInvariant,
| function getSample(uint256 index)
external
view
returns (
int256 logPairPrice,
int256 accLogPairPrice,
int256 logBptPrice,
int256 accLogBptPrice,
int256 logInvariant,
int256 accLogInvariant,
| 15,215 |
36 | // | contract Pausable is Ownable {
bool pause;
constructor() public {
pause = false;
}
function setPauseStatus(bool _pauseStatus) public onlyOwner {
pause = _pauseStatus;
}
function getPauseStatus() view public returns(bool) {
return pause;
}
modifier isPaused() {
require(pause==false, "The system is paused");
_;
}
}
| contract Pausable is Ownable {
bool pause;
constructor() public {
pause = false;
}
function setPauseStatus(bool _pauseStatus) public onlyOwner {
pause = _pauseStatus;
}
function getPauseStatus() view public returns(bool) {
return pause;
}
modifier isPaused() {
require(pause==false, "The system is paused");
_;
}
}
| 10,666 |
28 | // check open rate | (address baseToken, address quoteToken) = limitOrder.isShort ? (limitOrder.token, USDC_ADDRESS) : (USDC_ADDRESS, limitOrder.token);
uint256 swapAmount = swapPathCreator.calculateConvertedValue(baseToken, quoteToken, limitOrder.amount);
require(swapAmount >= limitOrder.minimalSwapAmount, "LIMIT_NOT_SATISFIED");
uint256 openBonus = calculateAutoOpenBonus();
| (address baseToken, address quoteToken) = limitOrder.isShort ? (limitOrder.token, USDC_ADDRESS) : (USDC_ADDRESS, limitOrder.token);
uint256 swapAmount = swapPathCreator.calculateConvertedValue(baseToken, quoteToken, limitOrder.amount);
require(swapAmount >= limitOrder.minimalSwapAmount, "LIMIT_NOT_SATISFIED");
uint256 openBonus = calculateAutoOpenBonus();
| 47,680 |
0 | // Initially set msg.sender as treasury | treasury = msg.sender;
| treasury = msg.sender;
| 5,886 |
26 | // init for dev, def-3 | newClassPlayer(3,2,7,14,2,3,6,6,13);
newClassPlayer(3,2,8,15,3,2,6,6,12);
newClassPlayer(3,2,7,21,3,2,4,3,12);
newClassPlayer(3,2,8,15,4,4,9,4,10);
newClassPlayer(3,2,7,20,1,1,2,4,19);
newClassPlayer(3,2,8,12,6,6,6,6,10);
newClassPlayer(3,2,7,16,1,2,8,5,13);
newClassPlayer(3,2,8,15,3,3,8,7,8);
newClassPlayer(3,2,8,16,2,4,6,4,17);
newClassPlayer(3,2,9,14,3,1,8,9,15);
| newClassPlayer(3,2,7,14,2,3,6,6,13);
newClassPlayer(3,2,8,15,3,2,6,6,12);
newClassPlayer(3,2,7,21,3,2,4,3,12);
newClassPlayer(3,2,8,15,4,4,9,4,10);
newClassPlayer(3,2,7,20,1,1,2,4,19);
newClassPlayer(3,2,8,12,6,6,6,6,10);
newClassPlayer(3,2,7,16,1,2,8,5,13);
newClassPlayer(3,2,8,15,3,3,8,7,8);
newClassPlayer(3,2,8,16,2,4,6,4,17);
newClassPlayer(3,2,9,14,3,1,8,9,15);
| 48,436 |
34 | // return owner bond | require(token.balanceOf(address(this)) >= ownerBondRefundAmount, "Broken: Contract can't afford to refund owner bond!");
suggestedSteps[_id].ownerBond = 0;
token.transfer(goalOwner, ownerBondRefundAmount);
emit Withdrawn(goalOwner, ownerBondRefundAmount);
suggestedSteps[_id].resolved = true;
| require(token.balanceOf(address(this)) >= ownerBondRefundAmount, "Broken: Contract can't afford to refund owner bond!");
suggestedSteps[_id].ownerBond = 0;
token.transfer(goalOwner, ownerBondRefundAmount);
emit Withdrawn(goalOwner, ownerBondRefundAmount);
suggestedSteps[_id].resolved = true;
| 29,578 |
9 | // Calldata version of {multiProofVerify} CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. / | function multiProofVerifyCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProofCalldata(proof, proofFlags, leaves) == root;
}
| function multiProofVerifyCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProofCalldata(proof, proofFlags, leaves) == root;
}
| 1,402 |
31 | // Create the entry in the map by assigning values to the structure. | blockchains[_blockchainId].votingPeriod = _votingPeriod;
blockchains[_blockchainId].votingAlgorithmContract = _votingAlgorithmContract;
| blockchains[_blockchainId].votingPeriod = _votingPeriod;
blockchains[_blockchainId].votingAlgorithmContract = _votingAlgorithmContract;
| 9,138 |
40 | // First action is a trade for closing the expired account accountId is solidAccount; otherAccountId is liquidAccount | actions[0] = Actions.ActionArgs({
actionType : Actions.ActionType.Trade,
accountId : 0,
amount : Types.AssetAmount({
sign : true,
denomination : Types.AssetDenomination.Wei,
ref : Types.AssetReference.Delta,
value : cache.toLiquidate
}),
| actions[0] = Actions.ActionArgs({
actionType : Actions.ActionType.Trade,
accountId : 0,
amount : Types.AssetAmount({
sign : true,
denomination : Types.AssetDenomination.Wei,
ref : Types.AssetReference.Delta,
value : cache.toLiquidate
}),
| 36,295 |
25 | // Changes the duration of the time lock for transactions._lockSeconds Duration needed after a transaction is confirmed and before it becomes executable, in seconds./ | function changeLockSeconds(uint256 _lockSeconds)
external
onlyWallet
| function changeLockSeconds(uint256 _lockSeconds)
external
onlyWallet
| 15,034 |
7 | // {address} address of the user return {Whitelist} return whitelist instance/ | function getWhitelist(address _wallet) external view returns (WhitelistInfo memory) {
require(whitelistPools[_wallet].wallet == _wallet, "Whitelist is not existing");
return whitelistPools[_wallet];
}
| function getWhitelist(address _wallet) external view returns (WhitelistInfo memory) {
require(whitelistPools[_wallet].wallet == _wallet, "Whitelist is not existing");
return whitelistPools[_wallet];
}
| 16,883 |
69 | // distribute rewards to each recipient | for ( uint i = 0; i < info.length; i++ ) {
if ( info[ i ].rate > 0 ) {
ITreasury( treasury ).mintRewards( // mint and send from treasury
info[ i ].recipient,
nextRewardAt( info[ i ].rate )
);
adjust( i ); // check for adjustment
}
| for ( uint i = 0; i < info.length; i++ ) {
if ( info[ i ].rate > 0 ) {
ITreasury( treasury ).mintRewards( // mint and send from treasury
info[ i ].recipient,
nextRewardAt( info[ i ].rate )
);
adjust( i ); // check for adjustment
}
| 15,603 |
22 | // Updates the control status of an operation to wARN (must be completed by a certification body)/_index Index of the operation controlled | function controlOperationWarn(uint256 _index) external {
_controlOperation(_index, 2);
emit OperationControlledWarn(_index);
}
| function controlOperationWarn(uint256 _index) external {
_controlOperation(_index, 2);
emit OperationControlledWarn(_index);
}
| 34,187 |
26 | // freezes token amount specified for given address._userAddress The address for which to update frozen tokens_amount Amount of Tokens to be frozen This function can only be called by a wallet set as agent of the token emits a `TokensFrozen` event / | function freezePartialTokens(address _userAddress, uint256 _amount) external;
| function freezePartialTokens(address _userAddress, uint256 _amount) external;
| 34,851 |
65 | // Token Claim | mapping (address => uint) public ethContributedForTokens;
uint256 public TokenPerETHUnit;
uint256 public bonusTokens = 50000 * 10**9;
address public devAddr;
event LiquidityAddition(address indexed dst, uint value);
event LPTokenClaimed(address dst, uint value);
event TokenClaimed(address dst, uint value);
| mapping (address => uint) public ethContributedForTokens;
uint256 public TokenPerETHUnit;
uint256 public bonusTokens = 50000 * 10**9;
address public devAddr;
event LiquidityAddition(address indexed dst, uint value);
event LPTokenClaimed(address dst, uint value);
event TokenClaimed(address dst, uint value);
| 22,091 |
182 | // raise event | contractCreated(rentPerDay, cancelPolicy, moveInDate, moveOutDate, secDeposit, landlord, tokenId, Id, Guid, extraAmount);
| contractCreated(rentPerDay, cancelPolicy, moveInDate, moveOutDate, secDeposit, landlord, tokenId, Id, Guid, extraAmount);
| 42,170 |
51 | // Founder sets unlockPercent1 | function setPercent1(address who, uint256 value) onlyFounder public returns (bool) {
accounts[who].unlockPercent1 = value;
return true;
}
| function setPercent1(address who, uint256 value) onlyFounder public returns (bool) {
accounts[who].unlockPercent1 = value;
return true;
}
| 29,937 |
20 | // Convert an ASCII string to a number given a string and a base / | function atoi(string memory a, uint8 base) internal pure returns (uint256 i) {
require(base == 2 || base == 8 || base == 10 || base == 16);
bytes memory buf = bytes(a);
for (uint256 p = 0; p < buf.length; p++) {
uint8 digit = uint8(buf[p]) - 0x30;
if (digit > 10) {
digit -= 7;
}
require(digit < base);
i *= base;
i += digit;
}
return i;
}
| function atoi(string memory a, uint8 base) internal pure returns (uint256 i) {
require(base == 2 || base == 8 || base == 10 || base == 16);
bytes memory buf = bytes(a);
for (uint256 p = 0; p < buf.length; p++) {
uint8 digit = uint8(buf[p]) - 0x30;
if (digit > 10) {
digit -= 7;
}
require(digit < base);
i *= base;
i += digit;
}
return i;
}
| 31,182 |
95 | // Removes the identifier from the whitelist. Price requests using this identifier will no longer succeed after this call. identifier bytes32 encoding of the string identifier. Eg: BTC/USD. / | function removeSupportedIdentifier(bytes32 identifier) external;
| function removeSupportedIdentifier(bytes32 identifier) external;
| 2,516 |
32 | // Increase the price automatically based on the global incrementRate | uint increase = SafeMath.div(SafeMath.mul(price, incrementRate), 100);
pixels[key].price = SafeMath.add(price, increase);
pixels[key].owner = msg.sender;
PixelTransfer(row, col, price, owner, msg.sender);
setPixelColor(row, col, newColor);
| uint increase = SafeMath.div(SafeMath.mul(price, incrementRate), 100);
pixels[key].price = SafeMath.add(price, increase);
pixels[key].owner = msg.sender;
PixelTransfer(row, col, price, owner, msg.sender);
setPixelColor(row, col, newColor);
| 24,067 |
75 | // if the WasteType of the trash bag is Nonrecyclable, increment the totalNonRecyclableWaste field of the citizen by the weight of trash bag | if(_wasteType == WasteType.Nonrecyclable){
| if(_wasteType == WasteType.Nonrecyclable){
| 43,679 |
16 | // console.log("DEBUG sol: logging contract",i, deployedContracts[i]); | }
| }
| 31,357 |
164 | // move any owing subdividends into the customers subdividend balance | uint256 owing = subdividendsOwing(_customerAddress);
if (owing > 0) {
divsMap_[_customerAddress].balance = SafeMath.add(divsMap_[_customerAddress].balance, owing);
divsMap_[_customerAddress].lastDividendPoints = totalDividendPoints_;
}
| uint256 owing = subdividendsOwing(_customerAddress);
if (owing > 0) {
divsMap_[_customerAddress].balance = SafeMath.add(divsMap_[_customerAddress].balance, owing);
divsMap_[_customerAddress].lastDividendPoints = totalDividendPoints_;
}
| 21,539 |
6 | // Transfer some token to someone else. Should revert if not enough funds. Emit Transfer when done./_to The receiver of transfer./_value The amount to transfer./ return True if transfer is successfull, False otherwise. | function transfer(address _to, uint _value) public returns (bool success) {
require(balances[msg.sender] >= _value);
balances[msg.sender] -= _value;
balances[_to] += _value;
return true;
}
| function transfer(address _to, uint _value) public returns (bool success) {
require(balances[msg.sender] >= _value);
balances[msg.sender] -= _value;
balances[_to] += _value;
return true;
}
| 50,834 |
22 | // If route > 3 additionalRecipientsToken is at 0xc4 else 0x24. | additionalRecipientsToken :=
calldataload(
add(
BasicOrder_considerationToken_cdPtr,
mul(offerTypeIsAdditionalRecipientsType, BasicOrder_common_params_size)
)
)
| additionalRecipientsToken :=
calldataload(
add(
BasicOrder_considerationToken_cdPtr,
mul(offerTypeIsAdditionalRecipientsType, BasicOrder_common_params_size)
)
)
| 17,324 |
116 | // Find exchange amount of one token, then find exchange amount for full value. | if (totalW == 0) {
arAmount = _wAmount;
} else {
| if (totalW == 0) {
arAmount = _wAmount;
} else {
| 20,045 |
19 | // the array of addresses which received airDrop | address[] public arrayAirDropReceivers;
| address[] public arrayAirDropReceivers;
| 67,044 |
17 | // Check (_value <= _allowance) is already done in safeSub(_allowance, _value) | allowed[_from][msg.sender] = safeSub(_allowance, _value);
safeTransfer(_from, _to, _value);
return true;
| allowed[_from][msg.sender] = safeSub(_allowance, _value);
safeTransfer(_from, _to, _value);
return true;
| 24,837 |
43 | // Check if any GRT tokens are deposited for a SubgraphDeployment. _subgraphDeploymentID SubgraphDeployment to check if curatedreturn True if curated / | function isCurated(bytes32 _subgraphDeploymentID) public view override returns (bool) {
return pools[_subgraphDeploymentID].tokens > 0;
}
| function isCurated(bytes32 _subgraphDeploymentID) public view override returns (bool) {
return pools[_subgraphDeploymentID].tokens > 0;
}
| 1,651 |
9 | // Exit early if there is no collateral from which to pay fees. | if (collateralPool.isEqual(0)) {
| if (collateralPool.isEqual(0)) {
| 41,319 |
206 | // Deposit LP tokens to MasterChef for CAKE allocation. | function deposit(uint256 _pid, uint256 _amount) public {
require (_pid != 0, 'deposit CAKE by staking');
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
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);
emit Deposit(msg.sender, _pid, _amount);
}
| function deposit(uint256 _pid, uint256 _amount) public {
require (_pid != 0, 'deposit CAKE by staking');
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
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);
emit Deposit(msg.sender, _pid, _amount);
}
| 2,329 |
30 | // The constructor is used here to ensure that the implementationcontract is initialized. An uncontrolled implementationcontract might lead to misleading statefor users who accidentally interact with it. / | constructor() public {
initialize();
pause();
// Added in V2
initializeDomainSeparator();
}
| constructor() public {
initialize();
pause();
// Added in V2
initializeDomainSeparator();
}
| 36,900 |
45 | // See {IERC20-allowance}. / | function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
| function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
| 118 |
18 | // ISuperfluidToken.getAccountActiveAgreements implementation | function getAccountActiveAgreements(address account)
public view override
returns(ISuperAgreement[] memory)
| function getAccountActiveAgreements(address account)
public view override
returns(ISuperAgreement[] memory)
| 5,057 |
44 | // Getter of the current `_litexGovernance`return The `_litexGovernance` value / | function getLitexGovernanceAddress()
external
override
view
returns (address)
| function getLitexGovernanceAddress()
external
override
view
returns (address)
| 12,522 |
180 | // whitelist merkle root | bytes32 public TEAMmerkleroot;
| bytes32 public TEAMmerkleroot;
| 62,082 |
4 | // Allows the current owner to relinquish control of the contract. Renouncing to ownership will leave the contract without an owner.It will not be possible to call the functions with the `onlyOwner`modifier anymore. / | function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
| function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
| 7,042 |
12 | // Adds a new admin as EmergencyAdmin admin The address of the new admin / | function addEmergencyAdmin(address admin) external;
| function addEmergencyAdmin(address admin) external;
| 25,563 |
5 | // The TokenSold event is fired whenever a token is sold. | event TokenSold(uint256 tokenId, uint256 oldPrice, uint256 newPrice, address prevOwner, address winner, string name);
| event TokenSold(uint256 tokenId, uint256 oldPrice, uint256 newPrice, address prevOwner, address winner, string name);
| 12,656 |
27 | // This function completes BUY tokens. | function finalize() external isNotFinalized onlyOwner {
finalized = true;
Finalize(msg.sender, totalSupply);
}
| function finalize() external isNotFinalized onlyOwner {
finalized = true;
Finalize(msg.sender, totalSupply);
}
| 49,747 |
29 | // Apply discount | applyDiscount(referralCode, tokenId);
| applyDiscount(referralCode, tokenId);
| 31,378 |
32 | // Roughlypick species 0 (1x) ->fortune / offense 1 (2x) ->fortune / defense 2 (2x) ->fortune / agility 3 (3x) ->offense / defense 4 (3x) ->defense / offense 5 (4x) ->agility / offense 6 (4x) ->agility / defense 7 (1x) ->defense / agilitypick stamina: [0, 9]pick fortune, agility, offense, defense based on species: [1, 10] primary = 300% max secondary = 200% max |
uint256 middle = middlePrice();
require(msg.value > middle * 1005 / 1000, "Not enough energy");
uint128 freakerId = numTokens++;
uint8 speciesDie = uint8(_randomishIntLessThan("species", 20));
uint8 species = (
(speciesDie < 1 ? 0 :
(speciesDie < 3 ? 1 :
(speciesDie < 5 ? 2 :
|
uint256 middle = middlePrice();
require(msg.value > middle * 1005 / 1000, "Not enough energy");
uint128 freakerId = numTokens++;
uint8 speciesDie = uint8(_randomishIntLessThan("species", 20));
uint8 species = (
(speciesDie < 1 ? 0 :
(speciesDie < 3 ? 1 :
(speciesDie < 5 ? 2 :
| 44,030 |
31 | // To be raised when evidence is submitted. Should point to the resource (evidences are not to be stored on chain due to gas considerations). _arbitrator The arbitrator of the contract. _evidenceGroupID Unique identifier of the evidence group the evidence belongs to. _party The address of the party submiting the evidence. Note that 0x0 refers to evidence not submitted by any party. _evidence A URI to the evidence JSON file whose name should be its keccak256 hash followed by .json. / | event Evidence(
IArbitrator indexed _arbitrator,
uint256 indexed _evidenceGroupID,
address indexed _party,
string _evidence
);
| event Evidence(
IArbitrator indexed _arbitrator,
uint256 indexed _evidenceGroupID,
address indexed _party,
string _evidence
);
| 12,023 |
52 | // Structure to store staking details.It contains amount of tokens staked and withdrawn interest. / | struct Staker {
uint256 totalStaked;
uint256 withdrawnToDate;
uint256 stakeBuyinRate;
}
| struct Staker {
uint256 totalStaked;
uint256 withdrawnToDate;
uint256 stakeBuyinRate;
}
| 11,713 |
6 | // Check if the token to the given id exists/tokenId Token id | modifier tokenExists(uint256 tokenId) {
require(itemMap[tokenId].id > 0, 'Token not found');
_;
}
| modifier tokenExists(uint256 tokenId) {
require(itemMap[tokenId].id > 0, 'Token not found');
_;
}
| 39,371 |
18 | // Stake DF / | function stake(uint256 _amountDF) external returns(uint256 amountOgDF) {
return stakeFor(msg.sender, _amountDF);
}
| function stake(uint256 _amountDF) external returns(uint256 amountOgDF) {
return stakeFor(msg.sender, _amountDF);
}
| 33,936 |
5 | // Initialize the contract | function initialize(
IERC20Upgradeable _usdtTokenAddress,
IRewardManager _rewardManager
| function initialize(
IERC20Upgradeable _usdtTokenAddress,
IRewardManager _rewardManager
| 27,046 |
479 | // Strip v3 specific fields from order | IExchangeV2.Order memory v2Order = IExchangeV2.Order({
makerAddress: order.makerAddress,
takerAddress: order.takerAddress,
feeRecipientAddress: order.feeRecipientAddress,
senderAddress: order.senderAddress,
makerAssetAmount: order.makerAssetAmount,
takerAssetAmount: order.takerAssetAmount,
| IExchangeV2.Order memory v2Order = IExchangeV2.Order({
makerAddress: order.makerAddress,
takerAddress: order.takerAddress,
feeRecipientAddress: order.feeRecipientAddress,
senderAddress: order.senderAddress,
makerAssetAmount: order.makerAssetAmount,
takerAssetAmount: order.takerAssetAmount,
| 49,153 |
9 | // 调用另一个合约的外部函数 | v3 = ft.externalFunc();
| v3 = ft.externalFunc();
| 42,250 |
48 | // Step 3. Pay down the amount borrowed by the unsafe account -- Enter the market for the token to be liquidated | Comptroller ctroll = Comptroller(kUnitroller);
address[] memory cTokens = new address[](1);
cTokens[0] = targetToken;
uint[] memory Errors = ctroll.enterMarkets(cTokens);
require(Errors[0] == 0, "01 Comptroller enter Markets for target token failed. ");
if (targetToken == kcETH){
ICorWETH ceTargetToken = ICorWETH(targetToken);
ceTargetToken.liquidateBorrow{value: liquidateAmount}(targetAccount, collateralToken);
| Comptroller ctroll = Comptroller(kUnitroller);
address[] memory cTokens = new address[](1);
cTokens[0] = targetToken;
uint[] memory Errors = ctroll.enterMarkets(cTokens);
require(Errors[0] == 0, "01 Comptroller enter Markets for target token failed. ");
if (targetToken == kcETH){
ICorWETH ceTargetToken = ICorWETH(targetToken);
ceTargetToken.liquidateBorrow{value: liquidateAmount}(targetAccount, collateralToken);
| 24,031 |
46 | // `interfaceId`. Support for {IERC165} itself is queried automatically. See {IERC165-supportsInterface}. / | function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {
| function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {
| 2,979 |
8 | // Mint function callable by anyone/requires a valid merkleRoot to function/_merkleProof the proof sent by an allow-listed user | function mint(bytes32[] calldata _merkleProof) public {
require(isMintActive, "Minting is not active yet");
require(!minted[msg.sender], "Already minted");
bytes32 leaf = keccak256(abi.encodePacked(msg.sender));
require(MerkleProof.verify(_merkleProof, merkleRoot, leaf), "not in allowlist");
minted[msg.sender] = true;
address[] memory receiver = new address[](1);
uint256[] memory quantity = new uint256[](1);
receiver[0] = msg.sender;
quantity[0] = 1;
sneakyGenesis.mintTo(receiver, quantity);
}
| function mint(bytes32[] calldata _merkleProof) public {
require(isMintActive, "Minting is not active yet");
require(!minted[msg.sender], "Already minted");
bytes32 leaf = keccak256(abi.encodePacked(msg.sender));
require(MerkleProof.verify(_merkleProof, merkleRoot, leaf), "not in allowlist");
minted[msg.sender] = true;
address[] memory receiver = new address[](1);
uint256[] memory quantity = new uint256[](1);
receiver[0] = msg.sender;
quantity[0] = 1;
sneakyGenesis.mintTo(receiver, quantity);
}
| 39,439 |
211 | // Reads scaled price of specified asset from the price oracle Reads scaled price of specified asset from the price oracle. The plural name is to match a previous storage mapping that this function replaced. asset Asset whose price should be retrievedreturn 0 on an error or missing price, the price scaled by 1e18 otherwise / | function assetPrices(address asset) public view returns (uint256) {
(Error err, Exp memory result) = fetchAssetPrice(asset);
if (err != Error.NO_ERROR) {
return 0;
}
return result.mantissa;
}
| function assetPrices(address asset) public view returns (uint256) {
(Error err, Exp memory result) = fetchAssetPrice(asset);
if (err != Error.NO_ERROR) {
return 0;
}
return result.mantissa;
}
| 12,160 |
295 | // find the end of the infoString using the relative arg positions | infoEnd = infoStart + _executionScript.uint256At(currentOffset + (0x20 * 2 * (_optionLength + 1) ));
info = substring(_executionScript, infoStart, infoEnd);
| infoEnd = infoStart + _executionScript.uint256At(currentOffset + (0x20 * 2 * (_optionLength + 1) ));
info = substring(_executionScript, infoStart, infoEnd);
| 3,358 |
14 | // Sets `amadugot` as acucadont the allowanceacucadont of `spender` amadugotover the amadugot caller's acucadonttokens. / | event removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amadugotTokenMin,
uint amadugotETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
);
| event removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amadugotTokenMin,
uint amadugotETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
);
| 28,339 |
9 | // Emitted when `tokenId` token is transfered from `from` to `to`. / | event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
| event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
| 11,060 |
129 | // Returns the exact value of the attribute, as well as its metadata | function getAttributes(
address _who
)
public
view
returns (uint256)
| function getAttributes(
address _who
)
public
view
returns (uint256)
| 10,943 |
10 | // Zunami strategy interface | function withdrawAll() external onlyZunami {
transferAllTokensTo(address(zunami));
}
| function withdrawAll() external onlyZunami {
transferAllTokensTo(address(zunami));
}
| 33,497 |
67 | // Check if price has moved advantageously while in the midst of the TWAP rebalance. This means the current leverage ratio has moved over/underthe stored TWAP leverage ratio on lever/delever so there is no need to execute a rebalance. Used in iterateRebalance() / | function _isAdvantageousTWAP(uint256 _currentLeverageRatio) internal view returns (bool) {
return (
(twapLeverageRatio < methodology.targetLeverageRatio && _currentLeverageRatio >= twapLeverageRatio)
|| (twapLeverageRatio > methodology.targetLeverageRatio && _currentLeverageRatio <= twapLeverageRatio)
);
}
| function _isAdvantageousTWAP(uint256 _currentLeverageRatio) internal view returns (bool) {
return (
(twapLeverageRatio < methodology.targetLeverageRatio && _currentLeverageRatio >= twapLeverageRatio)
|| (twapLeverageRatio > methodology.targetLeverageRatio && _currentLeverageRatio <= twapLeverageRatio)
);
}
| 51,653 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.