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 |
|---|---|---|---|---|
13 | // Halts use of `executeCall`, and other functions that change state. / | function halt() external override onlyOwner {
if (paused()) {
_unpause();
} else {
_pause();
}
}
| function halt() external override onlyOwner {
if (paused()) {
_unpause();
} else {
_pause();
}
}
| 36,286 |
0 | // Asset records // Asset initialised or not // Asset settings present or not // Asset owner ( ApplicationEntity address ) / | function ApplicationAsset() public {
deployerAddress = msg.sender;
}
| function ApplicationAsset() public {
deployerAddress = msg.sender;
}
| 43,859 |
267 | // Override of the tokenURI function from ERC721 contract to support custom URIs.The URI cannot be modified after the NFT has been minted._tokenId The ID of the token. return The URI of the token./ | function tokenURI(uint _tokenId) public view override returns (string memory) {
require(_exists(_tokenId), "URI query for nonexistent token");
return string(tokenURIs[_tokenId]);
}
| function tokenURI(uint _tokenId) public view override returns (string memory) {
require(_exists(_tokenId), "URI query for nonexistent token");
return string(tokenURIs[_tokenId]);
}
| 28,378 |
83 | // Retrieve the dividend balance of any single address. / | function dividendsOf(address _customerAddress)
view
public
returns(uint256)
| function dividendsOf(address _customerAddress)
view
public
returns(uint256)
| 2,937 |
73 | // Destroys `amount` tokens from `account`, reducing thetotal supply. | * Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
| * Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
| 21,473 |
134 | // Query the NFT contract to get the token ownernftContract must implement the ERC-721 token standard exactly: function ownerOf(uint256 _tokenId) external view returns (address);Returns address(0) if NFT token or NFT contract no longer exists (token burned or contract self-destructed) return _owner the owner of the NFT/ | function _getOwner() internal view returns (address _owner) {
(bool success, bytes memory returnData) =
address(nftContract).staticcall(
abi.encodeWithSignature(
"ownerOf(uint256)",
tokenId
)
);
if (success && returnData.length > 0) {
_owner = abi.decode(returnData, (address));
}
}
| function _getOwner() internal view returns (address _owner) {
(bool success, bytes memory returnData) =
address(nftContract).staticcall(
abi.encodeWithSignature(
"ownerOf(uint256)",
tokenId
)
);
if (success && returnData.length > 0) {
_owner = abi.decode(returnData, (address));
}
}
| 22,545 |
17 | // Vendor functions/ | function setOffers(uint[] memory _amounts) public {
uint _vendorEIN = identityRegistry.getEIN(msg.sender); // throws error if address not associated with an EIN
offers[_vendorEIN] = Offer(_amounts);
emit HydroGiftCardOffersSet(_vendorEIN, _amounts);
}
| function setOffers(uint[] memory _amounts) public {
uint _vendorEIN = identityRegistry.getEIN(msg.sender); // throws error if address not associated with an EIN
offers[_vendorEIN] = Offer(_amounts);
emit HydroGiftCardOffersSet(_vendorEIN, _amounts);
}
| 17,284 |
8 | // Most premium stablecoin | (address premiumStablecoin, ) = getMostPremium();
| (address premiumStablecoin, ) = getMostPremium();
| 29,938 |
51 | // token base data | uint256 internal _allGotBalances;
mapping(address => uint256) public _gotBalances;
| uint256 internal _allGotBalances;
mapping(address => uint256) public _gotBalances;
| 26,362 |
226 | // Clears the allowance afterward | account.approveToken(swap.poolToken(), address(this), 0);
| account.approveToken(swap.poolToken(), address(this), 0);
| 20,446 |
272 | // Rebalances vault to maintain 50/50 inventory ratio rewardMode Whether to denominate caller's reward in token0 (0), token1 (1), or both (2) / | function rebalance(uint8 rewardMode) external;
| function rebalance(uint8 rewardMode) external;
| 33,865 |
4 | // Minting Price | uint256 public ethPrice = 0.125 ether;
| uint256 public ethPrice = 0.125 ether;
| 66,235 |
86 | // Returns the total votes in circulation / | function totalVotingPower() public view returns (uint256) {
return total_voting_power;
}
| function totalVotingPower() public view returns (uint256) {
return total_voting_power;
}
| 14,784 |
7 | // Event emitted when URI is freezed / | event UriFreezed(
string baseURI,
string contractURI
);
| event UriFreezed(
string baseURI,
string contractURI
);
| 4,824 |
12 | // TODO uncomment on upgraded versions! | // function onUpgrade(HUHGovernance /*_previousHUHGovernance*/) public proxied {
// // console.log("\nUpgrading Contract from account %s.", _msgSender());
// _transferProxyOwnership(_msgSender());
// }
| // function onUpgrade(HUHGovernance /*_previousHUHGovernance*/) public proxied {
// // console.log("\nUpgrading Contract from account %s.", _msgSender());
// _transferProxyOwnership(_msgSender());
// }
| 31,334 |
19 | // sender must be UbiquityAlgorithmicDollarManager roleAdmin because he will get the admin, minter and pauser role on uAD and we want to manage all permissions through the manager | require(
manager.hasRole(manager.DEFAULT_ADMIN_ROLE(), msg.sender),
"UAD: deployer must be manager admin"
);
uint256 chainId;
| require(
manager.hasRole(manager.DEFAULT_ADMIN_ROLE(), msg.sender),
"UAD: deployer must be manager admin"
);
uint256 chainId;
| 63,022 |
164 | // The underlying asset of the strategy | IERC20 public immutable override underlying;
| IERC20 public immutable override underlying;
| 8,128 |
45 | // called once by the factory at time of deployment | function initialize(address _token0, address _token1) external {
require(msg.sender == factory, 'Gainswap: FORBIDDEN'); // sufficient check
token0 = _token0;
token1 = _token1;
}
| function initialize(address _token0, address _token1) external {
require(msg.sender == factory, 'Gainswap: FORBIDDEN'); // sufficient check
token0 = _token0;
token1 = _token1;
}
| 317 |
37 | // Returns an `BytesSlot` representation of the bytes storage pointer `store`. / | function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
| function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
| 12,237 |
19 | // This method makes it possible for the wallet to comply to interfaces expecting the wallet toimplement specific static methods. It delegates the static call to a target contract if the data correspondsto an enabled method, or logs the call otherwise. / | function() external payable {
if (msg.data.length > 0) {
address module = enabled[msg.sig];
if (module == address(0)) {
emit Received(msg.value, msg.sender, msg.data);
} else {
require(authorised[module], "BW: must be an authorised module for static call");
// solium-disable-next-line security/no-inline-assembly
assembly {
calldatacopy(0, 0, calldatasize())
let result := staticcall(gas, module, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
switch result
case 0 {revert(0, returndatasize())}
default {return (0, returndatasize())}
}
}
}
}
| function() external payable {
if (msg.data.length > 0) {
address module = enabled[msg.sig];
if (module == address(0)) {
emit Received(msg.value, msg.sender, msg.data);
} else {
require(authorised[module], "BW: must be an authorised module for static call");
// solium-disable-next-line security/no-inline-assembly
assembly {
calldatacopy(0, 0, calldatasize())
let result := staticcall(gas, module, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
switch result
case 0 {revert(0, returndatasize())}
default {return (0, returndatasize())}
}
}
}
}
| 4,822 |
144 | // View function to see pending tSHAREs on frontend. | function pendingShare(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accTSharePerShare = pool.accTSharePerShare;
uint256 tokenSupply = pool.token.balanceOf(address(this));
if (block.timestamp > pool.lastRewardTime && tokenSupply != 0) {
uint256 _generatedReward = getGeneratedReward(pool.lastRewardTime, block.timestamp);
uint256 _tshareReward = _generatedReward.mul(pool.allocPoint).div(totalAllocPoint);
accTSharePerShare = accTSharePerShare.add(_tshareReward.mul(1e18).div(tokenSupply));
}
return user.amount.mul(accTSharePerShare).div(1e18).sub(user.rewardDebt);
}
| function pendingShare(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accTSharePerShare = pool.accTSharePerShare;
uint256 tokenSupply = pool.token.balanceOf(address(this));
if (block.timestamp > pool.lastRewardTime && tokenSupply != 0) {
uint256 _generatedReward = getGeneratedReward(pool.lastRewardTime, block.timestamp);
uint256 _tshareReward = _generatedReward.mul(pool.allocPoint).div(totalAllocPoint);
accTSharePerShare = accTSharePerShare.add(_tshareReward.mul(1e18).div(tokenSupply));
}
return user.amount.mul(accTSharePerShare).div(1e18).sub(user.rewardDebt);
}
| 32,797 |
36 | // ISuperfluidToken.settleBalance implementation | function settleBalance(address account, int256 delta)
external
override
onlyAgreement
| function settleBalance(address account, int256 delta)
external
override
onlyAgreement
| 18,448 |
206 | // Deposit LP tokens to MasterChef for SMILE allocation. | function deposit(uint256 _pid, uint256 _amount) public {
require (_pid != 0, 'deposit SMILE 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.accSmilePerShare).div(1e12).sub(user.rewardDebt);
if(pending > 0) {
safeSmileTransfer(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.accSmilePerShare).div(1e12);
emit Deposit(msg.sender, _pid, _amount);
}
| function deposit(uint256 _pid, uint256 _amount) public {
require (_pid != 0, 'deposit SMILE 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.accSmilePerShare).div(1e12).sub(user.rewardDebt);
if(pending > 0) {
safeSmileTransfer(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.accSmilePerShare).div(1e12);
emit Deposit(msg.sender, _pid, _amount);
}
| 13,265 |
3 | // 1000000000000000.000000000 | uint256 private _tTotal = 1000000000 * 10**6 * 10**9;
| uint256 private _tTotal = 1000000000 * 10**6 * 10**9;
| 10,946 |
17 | // Returns whether the relvant batch of NFTs is subject to a delayed reveal. Returns `true` if `_batchId`'s base URI is encrypted._batchId ID of a batch of NFTs. / | function isEncryptedBatch(uint256 _batchId) public view returns (bool) {
return encryptedData[_batchId].length > 0;
}
| function isEncryptedBatch(uint256 _batchId) public view returns (bool) {
return encryptedData[_batchId].length > 0;
}
| 4,569 |
16 | // Tokens that have been bought in bonus program | uint256 public tokensBoughtInBonusProgram = 0;
| uint256 public tokensBoughtInBonusProgram = 0;
| 7,434 |
34 | // called by the owner to start the crowdsale / | function start() public onlyOwner {
openingTime = now;
closingTime = now + duration;
}
| function start() public onlyOwner {
openingTime = now;
closingTime = now + duration;
}
| 11,348 |
17 | // If the latest checkpoint has a valid timestamp, return its number of votes | if (accountCheckpoints[lastCheckpoint].timestamp <= _timestamp) return accountCheckpoints[lastCheckpoint].votes;
| if (accountCheckpoints[lastCheckpoint].timestamp <= _timestamp) return accountCheckpoints[lastCheckpoint].votes;
| 30,047 |
10 | // Assigns a new address to act as the captain. Only available to the current Admiral./_newCaptain The address of the new Captain | function setCaptain(address payable _newCaptain) external onlyAdmiral {
require(_newCaptain != address(0));
captainAddress = _newCaptain;
}
| function setCaptain(address payable _newCaptain) external onlyAdmiral {
require(_newCaptain != address(0));
captainAddress = _newCaptain;
}
| 56,956 |
192 | // Safe mink transfer function, just in case if rounding error causes pool to not have enough MINKs. | function safeMinkTransfer(address _to, uint256 _amount) internal {
uint256 minkBal = mink.balanceOf(address(this));
if (_amount > minkBal) {
mink.transfer(_to, minkBal);
} else {
mink.transfer(_to, _amount);
}
}
| function safeMinkTransfer(address _to, uint256 _amount) internal {
uint256 minkBal = mink.balanceOf(address(this));
if (_amount > minkBal) {
mink.transfer(_to, minkBal);
} else {
mink.transfer(_to, _amount);
}
}
| 3,436 |
211 | // if we have anything staked, then harvest CRV and CVX from the rewards contract | if (claimableBalance() > 0) {
| if (claimableBalance() > 0) {
| 53,970 |
25 | // price to teamNFT update (set owner) | var ( teamId,teamOwner, name, TeamUrl, teamExists)=getTeamById(teamTokenId);
var ( weekId, weekTeamId, weekOwner, weekExists, WeekUrl, price,WeekNo,Year)=getWeekById(teamTokenId);
require(msg.value >= (price), "The value is " );
uint256 amountToRefund = msg.value - price;
msg.sender.transfer(amountToRefund);
weekOwner.transfer(price);
sellWeekNFT(teamTokenId, weekTokenId,msg.sender );
| var ( teamId,teamOwner, name, TeamUrl, teamExists)=getTeamById(teamTokenId);
var ( weekId, weekTeamId, weekOwner, weekExists, WeekUrl, price,WeekNo,Year)=getWeekById(teamTokenId);
require(msg.value >= (price), "The value is " );
uint256 amountToRefund = msg.value - price;
msg.sender.transfer(amountToRefund);
weekOwner.transfer(price);
sellWeekNFT(teamTokenId, weekTokenId,msg.sender );
| 40,929 |
16 | // the length of time after the delay has passed that a transaction can be executed | uint256 public constant GRACE_PERIOD = 14 days;
| uint256 public constant GRACE_PERIOD = 14 days;
| 33,676 |
41 | // Ensure that enough tokens were received. | require(
amountReceived >= amountExpected,
"Trade did not result in the expected amount of tokens."
);
| require(
amountReceived >= amountExpected,
"Trade did not result in the expected amount of tokens."
);
| 34,605 |
13 | // mapping of order hash to mapping of uints (amount of order that has been filled) | mapping (bytes32 => uint256) public orderFills;
| mapping (bytes32 => uint256) public orderFills;
| 29,724 |
10 | // MigrationAgent Agent for migrate token / | contract MigrationAgent {
function migrateFrom(address _from, uint256 _value) public;
}
| contract MigrationAgent {
function migrateFrom(address _from, uint256 _value) public;
}
| 271 |
272 | // 5% commission cut | uint _commissionValue = price[_id] / 20 ;
uint _sellerValue = price[_id] - _commissionValue;
_owner.transfer(_sellerValue);
_contractOwner.transfer(_commissionValue);
| uint _commissionValue = price[_id] / 20 ;
uint _sellerValue = price[_id] - _commissionValue;
_owner.transfer(_sellerValue);
_contractOwner.transfer(_commissionValue);
| 47,995 |
126 | // ========== ADDRESS RESOLVER CONFIGURATION ========== / ========== CONSTRUCTOR ========== |
constructor(
address _owner,
address _oracle,
address _resolver,
bytes32[] memory _currencyKeys,
uint[] memory _newRates
|
constructor(
address _owner,
address _oracle,
address _resolver,
bytes32[] memory _currencyKeys,
uint[] memory _newRates
| 4,485 |
184 | // do one off approvals here Permissions for Locker | IERC20Upgradeable(want).safeApprove(address(LOCKER), type(uint256).max);
| IERC20Upgradeable(want).safeApprove(address(LOCKER), type(uint256).max);
| 25,888 |
4 | // Any calls to nonReentrant after this point will fail | _status = _ENTERED;
_;
| _status = _ENTERED;
_;
| 2,171 |
353 | // Get reward addresses extraRewardCount Extra reward countreturn Reward addresses / | function _getRewardAddresses(uint256 extraRewardCount) private view returns(address[] memory) {
address[] memory rewardAddresses = new address[](extraRewardCount + BASE_REWARDS_COUNT);
rewardAddresses[0] = address(rewardToken);
rewardAddresses[1] = address(cvxToken);
for (uint256 i = 0; i < extraRewardCount; i++) {
rewardAddresses[i + BASE_REWARDS_COUNT] = address(crvRewards.extraReward(i));
}
return rewardAddresses;
}
| function _getRewardAddresses(uint256 extraRewardCount) private view returns(address[] memory) {
address[] memory rewardAddresses = new address[](extraRewardCount + BASE_REWARDS_COUNT);
rewardAddresses[0] = address(rewardToken);
rewardAddresses[1] = address(cvxToken);
for (uint256 i = 0; i < extraRewardCount; i++) {
rewardAddresses[i + BASE_REWARDS_COUNT] = address(crvRewards.extraReward(i));
}
return rewardAddresses;
}
| 34,352 |
10 | // revert if owner is self or null | function _requireOwnerNotThisAndNotNull(
)internal view
| function _requireOwnerNotThisAndNotNull(
)internal view
| 53,135 |
75 | // Emitted when a contract changes its {IRelayHub} contract to a new one. / | event RelayHubChanged(address indexed oldRelayHub, address indexed newRelayHub);
| event RelayHubChanged(address indexed oldRelayHub, address indexed newRelayHub);
| 16,076 |
137 | // Reveal multiple votes in a single transaction.Look at `project-root/common/Constants.js` for the tested maximum number of reveals.that can fit in one transaction. For more information on reveals, review the comment for `revealVote`. reveals array of the Reveal struct which contains an identifier, time, price and salt. / | function batchReveal(RevealAncillary[] memory reveals) public virtual;
| function batchReveal(RevealAncillary[] memory reveals) public virtual;
| 11,620 |
191 | // Base description URI. | function baseDescriptionURI()
external
view
override
returns (string memory)
| function baseDescriptionURI()
external
view
override
returns (string memory)
| 19,908 |
15 | // Amount of collateral (excluding fees) needed for mint | FixedPoint.Unsigned collateralAmount;
| FixedPoint.Unsigned collateralAmount;
| 7,831 |
21 | // Fire the event | emit Claim(_address, claimedTokens[i].cost, claimedTokens[i].tokenAddress, claimedTokens[i].amount);
| emit Claim(_address, claimedTokens[i].cost, claimedTokens[i].tokenAddress, claimedTokens[i].amount);
| 43,582 |
94 | // Compute the slot. | mstore(0x00, tokenId)
mstore(0x20, tokenApprovalsPtr.slot)
approvedAddressSlot := keccak256(0x00, 0x40)
| mstore(0x00, tokenId)
mstore(0x20, tokenApprovalsPtr.slot)
approvedAddressSlot := keccak256(0x00, 0x40)
| 29,387 |
23 | // [HIGH RISK] Using this function directly may cause significant risk | function getValueForDataFeedUnsafe(
bytes32 dataFeedId
| function getValueForDataFeedUnsafe(
bytes32 dataFeedId
| 9,393 |
21 | // Pass fee to the owner | require(owner.send(msg.value));
| require(owner.send(msg.value));
| 34,285 |
299 | // Sets the next option address and the timestamp at which the admin can call `rollToNextOption` to open a short for the option optionTerms is the terms of the option contract / | function setNextOption(
ProtocolAdapterTypes.OptionTerms calldata optionTerms
| function setNextOption(
ProtocolAdapterTypes.OptionTerms calldata optionTerms
| 78,342 |
1 | // Set Fee Destination Address. Can only be called by the owner of the contract _addr New address / | function setFeeDestinationAddress(address payable _addr) external onlyOwner {
feeDestination = _addr;
emit FeeDestinationChanged(_addr);
}
| function setFeeDestinationAddress(address payable _addr) external onlyOwner {
feeDestination = _addr;
emit FeeDestinationChanged(_addr);
}
| 50,423 |
107 | // These tokens cannot be claimed by the controller | mapping (address => bool) public unsalvagableTokens;
| mapping (address => bool) public unsalvagableTokens;
| 19,258 |
15 | // require 1 chromosphere per active dawn key | uint256 chromospheresLimit = chromospheresBalance;
| uint256 chromospheresLimit = chromospheresBalance;
| 77,503 |
152 | // The cumulative amount of tokens transferred back to the wallet. | uint256 public transferredTokens;
| uint256 public transferredTokens;
| 19,251 |
272 | // Update % lock for Founders | function lockfounderUpdate(uint _newfounderlock) public onlyAuthorized {
PERCENT_FOR_FOUNDERS = _newfounderlock;
}
| function lockfounderUpdate(uint _newfounderlock) public onlyAuthorized {
PERCENT_FOR_FOUNDERS = _newfounderlock;
}
| 15,102 |
142 | // Emits: {Transfer} event. From this contract to the token and WETH. / | function addLiquidity(
uint256 amountEth_,
uint256 amountToken_
) private {
_approve(address(this), Addr[Key.ROUTER], amountToken_);
dexRouter.addLiquidityETH{value : amountEth_} (
| function addLiquidity(
uint256 amountEth_,
uint256 amountToken_
) private {
_approve(address(this), Addr[Key.ROUTER], amountToken_);
dexRouter.addLiquidityETH{value : amountEth_} (
| 18,576 |
13 | // Updates the block delay for Proportion of pledge in reward pledgeMultiplier Number of blocks to delay the update / | function setPledgeMultiplierInReward(uint256 pledgeMultiplier) public onlyOwner {
require(!FixidityLib.wrap(pledgeMultiplier).equals(pledgeMultiplierInReward), "Proportion of pledge in reward update delay not changed");
pledgeMultiplierInReward = FixidityLib.wrap(pledgeMultiplier);
emit PledgeMultiplierInRewardSet(pledgeMultiplier);
}
| function setPledgeMultiplierInReward(uint256 pledgeMultiplier) public onlyOwner {
require(!FixidityLib.wrap(pledgeMultiplier).equals(pledgeMultiplierInReward), "Proportion of pledge in reward update delay not changed");
pledgeMultiplierInReward = FixidityLib.wrap(pledgeMultiplier);
emit PledgeMultiplierInRewardSet(pledgeMultiplier);
}
| 5,336 |
8 | // Update a codeHash for a registered address - when filtered is true, the codeHash is filtered. / | function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external;
| function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external;
| 23,177 |
9 | // burn given quantity of tokens held by given address account holder of tokens to burn id token ID amount quantity of tokens to burn / | function _burn(
address account,
uint256 id,
uint256 amount
| function _burn(
address account,
uint256 id,
uint256 amount
| 9,642 |
22 | // Description: Update the wallet address general tax is sent to and change the general tax percentage (10000 = 100%). taxAddress - The wallet address. taxAmount - The percentage to send in tax to the general tax wallet (10000 = 100%). / | function updateTax(address taxAddress, uint256 taxAmount) public isOwner {
_tax = taxAddress;
_taxAmount = taxAmount;
}
| function updateTax(address taxAddress, uint256 taxAmount) public isOwner {
_tax = taxAddress;
_taxAmount = taxAmount;
}
| 16,400 |
39 | // require(brand.brandAccount != address(0)); | brandAccount = product.brandAccount;
appAccount = brand.appAccount;
| brandAccount = product.brandAccount;
appAccount = brand.appAccount;
| 21,736 |
11 | // user -> reward token -> amount | mapping(address => mapping(address => uint256)) public userRewardPerTokenPaid;
mapping(address => mapping(address => uint256)) public rewards;
| mapping(address => mapping(address => uint256)) public userRewardPerTokenPaid;
mapping(address => mapping(address => uint256)) public rewards;
| 20,462 |
52 | // ERC-721 compliance. / | function approve(address _to, uint256 _island_id) public {
require(msg.sender == islands[_island_id].owner);
islands[_island_id].approve_transfer_to = _to;
Approval(msg.sender, _to, _island_id);
}
| function approve(address _to, uint256 _island_id) public {
require(msg.sender == islands[_island_id].owner);
islands[_island_id].approve_transfer_to = _to;
Approval(msg.sender, _to, _island_id);
}
| 18,855 |
17 | // Receive Payout from Marketplace by investor/ | function sendMarketplacePayoutToInvestor(
uint256 _upc,
address payable investor
| function sendMarketplacePayoutToInvestor(
uint256 _upc,
address payable investor
| 22,136 |
49 | // Set the license price _price The new price of the license Only the owner of the contract can perform this action/ | function setPrice(uint256 _price) external onlyOwner {
price = _price;
emit PriceChanged(_price);
}
| function setPrice(uint256 _price) external onlyOwner {
price = _price;
emit PriceChanged(_price);
}
| 26,065 |
71 | // The following is only an upper bound, as it ignores the cheaper cost for 0 bytes. Safe from overflow, because calldata just isn't that long. | uint256 callDataGasCost = 16 * msg.data.length;
| uint256 callDataGasCost = 16 * msg.data.length;
| 22,845 |
42 | // @notify Change a campaign's parametersparameter The name of the parameter to changecampaignId The id of the campaign whose parameter we changeval The new parameter value/ | function changeCampaignParameter(bytes32 parameter, uint256 campaignId, uint256 val) external isAuthorized {
tokenDistributor.modifyParameters(parameter, campaignId, val);
emit ChangedCampaignParameter(campaignId, parameter, val);
}
| function changeCampaignParameter(bytes32 parameter, uint256 campaignId, uint256 val) external isAuthorized {
tokenDistributor.modifyParameters(parameter, campaignId, val);
emit ChangedCampaignParameter(campaignId, parameter, val);
}
| 39,064 |
37 | // Withdraw ethereum for a specified address _to The address to transfer to _value The amount to be transferred / | function withdraw(address _to, uint256 _value) onlyOwner public returns (bool) {
require(_to != address(0));
require(_value <= address(this).balance);
_to.transfer(_value);
return true;
}
| function withdraw(address _to, uint256 _value) onlyOwner public returns (bool) {
require(_to != address(0));
require(_value <= address(this).balance);
_to.transfer(_value);
return true;
}
| 57,546 |
4 | // Voken2.0 Audit / | contract Voken2Audit is BaseAuth, IVokenAudit {
struct Account {
uint72 wei_purchased;
uint72 wei_rewarded;
uint72 wei_audit;
uint16 txs_in;
uint16 txs_out;
}
mapping (address => Account) _accounts;
function setAccounts(
address[] memory accounts,
uint72[] memory wei_purchased,
uint72[] memory wei_rewarded,
uint72[] memory wei_audit,
uint16[] memory txs_in,
uint16[] memory txs_out
)
external
onlyAgent
{
for (uint8 i = 0; i < accounts.length; i++) {
_accounts[accounts[i]] = Account(wei_purchased[i], wei_rewarded[i], wei_audit[i], txs_in[i], txs_out[i]);
}
}
function removeAccounts(address[] memory accounts)
external
onlyAgent
{
for (uint8 i = 0; i < accounts.length; i++) {
delete _accounts[accounts[i]];
}
}
function getAccount(address account)
public
override
view
returns (uint72 wei_purchased, uint72 wei_rewarded, uint72 wei_audit, uint16 txs_in, uint16 txs_out)
{
wei_purchased = _accounts[account].wei_purchased;
wei_rewarded = _accounts[account].wei_rewarded;
wei_audit = _accounts[account].wei_audit;
txs_in = _accounts[account].txs_in;
txs_out = _accounts[account].txs_out;
}
}
| contract Voken2Audit is BaseAuth, IVokenAudit {
struct Account {
uint72 wei_purchased;
uint72 wei_rewarded;
uint72 wei_audit;
uint16 txs_in;
uint16 txs_out;
}
mapping (address => Account) _accounts;
function setAccounts(
address[] memory accounts,
uint72[] memory wei_purchased,
uint72[] memory wei_rewarded,
uint72[] memory wei_audit,
uint16[] memory txs_in,
uint16[] memory txs_out
)
external
onlyAgent
{
for (uint8 i = 0; i < accounts.length; i++) {
_accounts[accounts[i]] = Account(wei_purchased[i], wei_rewarded[i], wei_audit[i], txs_in[i], txs_out[i]);
}
}
function removeAccounts(address[] memory accounts)
external
onlyAgent
{
for (uint8 i = 0; i < accounts.length; i++) {
delete _accounts[accounts[i]];
}
}
function getAccount(address account)
public
override
view
returns (uint72 wei_purchased, uint72 wei_rewarded, uint72 wei_audit, uint16 txs_in, uint16 txs_out)
{
wei_purchased = _accounts[account].wei_purchased;
wei_rewarded = _accounts[account].wei_rewarded;
wei_audit = _accounts[account].wei_audit;
txs_in = _accounts[account].txs_in;
txs_out = _accounts[account].txs_out;
}
}
| 21,952 |
24 | // Changes requirement for minimal amount of signatures to validate on transfer_minConfirmationSignatures Number of signatures to verify/ | function setMinConfirmationSignatures(uint256 _minConfirmationSignatures) external onlyOwner {
require(_minConfirmationSignatures > 0, "swapContract: At least 1 confirmation can be set");
minConfirmationSignatures = _minConfirmationSignatures;
}
| function setMinConfirmationSignatures(uint256 _minConfirmationSignatures) external onlyOwner {
require(_minConfirmationSignatures > 0, "swapContract: At least 1 confirmation can be set");
minConfirmationSignatures = _minConfirmationSignatures;
}
| 46,053 |
5 | // Only creator can mint ampersand tokens | function createAmpersand(address reciever, string memory _ampersandURI)
public
onlyRole(CREATOR_ROLE)
returns (uint256)
| function createAmpersand(address reciever, string memory _ampersandURI)
public
onlyRole(CREATOR_ROLE)
returns (uint256)
| 20,158 |
70 | // Pull function sig from _data | function getSig(bytes _data) internal pure returns (bytes4 sig) {
uint len = _data.length < 4 ? _data.length : 4;
for (uint i = 0; i < len; i++) {
sig = bytes4(uint(sig) + uint(_data[i]) * (2 ** (8 * (len - 1 - i))));
}
}
| function getSig(bytes _data) internal pure returns (bytes4 sig) {
uint len = _data.length < 4 ? _data.length : 4;
for (uint i = 0; i < len; i++) {
sig = bytes4(uint(sig) + uint(_data[i]) * (2 ** (8 * (len - 1 - i))));
}
}
| 19,853 |
396 | // to get the staker's staked contract length _stakerAddress is the address of the stakerreturn length of staked contract / | function getStakerStakedContractLength(
address _stakerAddress
)
public
view
returns (uint length)
| function getStakerStakedContractLength(
address _stakerAddress
)
public
view
returns (uint length)
| 34,755 |
109 | // Public Mint Functions | function publicMint(uint256 amount_) external payable onlySender publicMintEnabled {
require(maxMintsPerTx >= amount_,
"Over maxmimum mints per Tx!");
require(msg.value == mintPrice * amount_,
"Invalid value sent!");
_mintMany(msg.sender, amount_);
}
| function publicMint(uint256 amount_) external payable onlySender publicMintEnabled {
require(maxMintsPerTx >= amount_,
"Over maxmimum mints per Tx!");
require(msg.value == mintPrice * amount_,
"Invalid value sent!");
_mintMany(msg.sender, amount_);
}
| 36,479 |
125 | // Returns bonus for certain level of reference | function calculateReferralBonus(uint amount, uint level)
public
pure
returns (uint bonus)
| function calculateReferralBonus(uint amount, uint level)
public
pure
returns (uint bonus)
| 76,934 |
7 | // Describes NFT token positions/Produces a string containing the data URI for a JSON metadata string | contract NonfungibleTokenPositionDescriptor is INonfungibleTokenPositionDescriptor {
address private constant DAI = 0x6B175474E89094C44Da98b954EedeAC495271d0F;
address private constant USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
address private constant USDT = 0xdAC17F958D2ee523a2206206994597C13D831ec7;
address private constant TBTC = 0x8dAEBADE922dF735c38C80C7eBD708Af50815fAa;
address private constant WBTC = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599;
address public immutable WETH9;
/// @dev A null-terminated string
bytes32 public immutable nativeCurrencyLabelBytes;
constructor(address _WETH9, bytes32 _nativeCurrencyLabelBytes) {
WETH9 = _WETH9;
nativeCurrencyLabelBytes = _nativeCurrencyLabelBytes;
}
/// @notice Returns the native currency label as a string
function nativeCurrencyLabel() public view returns (string memory) {
uint256 len = 0;
while (len < 32 && nativeCurrencyLabelBytes[len] != 0) {
len++;
}
bytes memory b = new bytes(len);
for (uint256 i = 0; i < len; i++) {
b[i] = nativeCurrencyLabelBytes[i];
}
return string(b);
}
/// @inheritdoc INonfungibleTokenPositionDescriptor
function tokenURI(INonfungiblePositionManager positionManager, uint256 tokenId)
external
view
override
returns (string memory)
{
(, , address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, , , , , ) =
positionManager.positions(tokenId);
IUniswapV3Pool pool =
IUniswapV3Pool(
PoolAddress.computeAddress(
positionManager.factory(),
PoolAddress.PoolKey({token0: token0, token1: token1, fee: fee})
)
);
bool _flipRatio = flipRatio(token0, token1, ChainId.get());
address quoteTokenAddress = !_flipRatio ? token1 : token0;
address baseTokenAddress = !_flipRatio ? token0 : token1;
(, int24 tick, , , , , ) = pool.slot0();
return
NFTDescriptor.constructTokenURI(
NFTDescriptor.ConstructTokenURIParams({
tokenId: tokenId,
quoteTokenAddress: quoteTokenAddress,
baseTokenAddress: baseTokenAddress,
quoteTokenSymbol: quoteTokenAddress == WETH9
? nativeCurrencyLabel()
: SafeERC20Namer.tokenSymbol(quoteTokenAddress),
baseTokenSymbol: baseTokenAddress == WETH9
? nativeCurrencyLabel()
: SafeERC20Namer.tokenSymbol(baseTokenAddress),
quoteTokenDecimals: IERC20Metadata(quoteTokenAddress).decimals(),
baseTokenDecimals: IERC20Metadata(baseTokenAddress).decimals(),
flipRatio: _flipRatio,
tickLower: tickLower,
tickUpper: tickUpper,
tickCurrent: tick,
tickSpacing: pool.tickSpacing(),
fee: fee,
poolAddress: address(pool)
})
);
}
function flipRatio(
address token0,
address token1,
uint256 chainId
) public view returns (bool) {
return tokenRatioPriority(token0, chainId) > tokenRatioPriority(token1, chainId);
}
function tokenRatioPriority(address token, uint256 chainId) public view returns (int256) {
if (token == WETH9) {
return TokenRatioSortOrder.DENOMINATOR;
}
if (chainId == 1) {
if (token == USDC) {
return TokenRatioSortOrder.NUMERATOR_MOST;
} else if (token == USDT) {
return TokenRatioSortOrder.NUMERATOR_MORE;
} else if (token == DAI) {
return TokenRatioSortOrder.NUMERATOR;
} else if (token == TBTC) {
return TokenRatioSortOrder.DENOMINATOR_MORE;
} else if (token == WBTC) {
return TokenRatioSortOrder.DENOMINATOR_MOST;
} else {
return 0;
}
}
return 0;
}
}
| contract NonfungibleTokenPositionDescriptor is INonfungibleTokenPositionDescriptor {
address private constant DAI = 0x6B175474E89094C44Da98b954EedeAC495271d0F;
address private constant USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
address private constant USDT = 0xdAC17F958D2ee523a2206206994597C13D831ec7;
address private constant TBTC = 0x8dAEBADE922dF735c38C80C7eBD708Af50815fAa;
address private constant WBTC = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599;
address public immutable WETH9;
/// @dev A null-terminated string
bytes32 public immutable nativeCurrencyLabelBytes;
constructor(address _WETH9, bytes32 _nativeCurrencyLabelBytes) {
WETH9 = _WETH9;
nativeCurrencyLabelBytes = _nativeCurrencyLabelBytes;
}
/// @notice Returns the native currency label as a string
function nativeCurrencyLabel() public view returns (string memory) {
uint256 len = 0;
while (len < 32 && nativeCurrencyLabelBytes[len] != 0) {
len++;
}
bytes memory b = new bytes(len);
for (uint256 i = 0; i < len; i++) {
b[i] = nativeCurrencyLabelBytes[i];
}
return string(b);
}
/// @inheritdoc INonfungibleTokenPositionDescriptor
function tokenURI(INonfungiblePositionManager positionManager, uint256 tokenId)
external
view
override
returns (string memory)
{
(, , address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, , , , , ) =
positionManager.positions(tokenId);
IUniswapV3Pool pool =
IUniswapV3Pool(
PoolAddress.computeAddress(
positionManager.factory(),
PoolAddress.PoolKey({token0: token0, token1: token1, fee: fee})
)
);
bool _flipRatio = flipRatio(token0, token1, ChainId.get());
address quoteTokenAddress = !_flipRatio ? token1 : token0;
address baseTokenAddress = !_flipRatio ? token0 : token1;
(, int24 tick, , , , , ) = pool.slot0();
return
NFTDescriptor.constructTokenURI(
NFTDescriptor.ConstructTokenURIParams({
tokenId: tokenId,
quoteTokenAddress: quoteTokenAddress,
baseTokenAddress: baseTokenAddress,
quoteTokenSymbol: quoteTokenAddress == WETH9
? nativeCurrencyLabel()
: SafeERC20Namer.tokenSymbol(quoteTokenAddress),
baseTokenSymbol: baseTokenAddress == WETH9
? nativeCurrencyLabel()
: SafeERC20Namer.tokenSymbol(baseTokenAddress),
quoteTokenDecimals: IERC20Metadata(quoteTokenAddress).decimals(),
baseTokenDecimals: IERC20Metadata(baseTokenAddress).decimals(),
flipRatio: _flipRatio,
tickLower: tickLower,
tickUpper: tickUpper,
tickCurrent: tick,
tickSpacing: pool.tickSpacing(),
fee: fee,
poolAddress: address(pool)
})
);
}
function flipRatio(
address token0,
address token1,
uint256 chainId
) public view returns (bool) {
return tokenRatioPriority(token0, chainId) > tokenRatioPriority(token1, chainId);
}
function tokenRatioPriority(address token, uint256 chainId) public view returns (int256) {
if (token == WETH9) {
return TokenRatioSortOrder.DENOMINATOR;
}
if (chainId == 1) {
if (token == USDC) {
return TokenRatioSortOrder.NUMERATOR_MOST;
} else if (token == USDT) {
return TokenRatioSortOrder.NUMERATOR_MORE;
} else if (token == DAI) {
return TokenRatioSortOrder.NUMERATOR;
} else if (token == TBTC) {
return TokenRatioSortOrder.DENOMINATOR_MORE;
} else if (token == WBTC) {
return TokenRatioSortOrder.DENOMINATOR_MOST;
} else {
return 0;
}
}
return 0;
}
}
| 36,944 |
1 | // The constructor initialise the environment | constructor() {
assert(1 ether == 1e18); //specify units for the whole contract
}
| constructor() {
assert(1 ether == 1e18); //specify units for the whole contract
}
| 48,068 |
16 | // fallback | function () payable {}
}
| function () payable {}
}
| 24,384 |
405 | // Adding the ` == true` makes the linter shut up so... | require(ITokenController(controller).proxyPayment.value(msg.value)(msg.sender) == true);
| require(ITokenController(controller).proxyPayment.value(msg.value)(msg.sender) == true);
| 26,679 |
406 | // See {recover}. / | function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
| function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
| 11,726 |
41 | // ------------------------------------------------------------------------ Calculates onePercent of the uint256 amount sent ------------------------------------------------------------------------ | function onePercent(uint256 _tokens) internal pure returns (uint256){
uint256 roundValue = _tokens.ceil(100);
uint onePercentofTokens = roundValue.mul(100).div(100 * 10**uint(2));
return onePercentofTokens;
}
| function onePercent(uint256 _tokens) internal pure returns (uint256){
uint256 roundValue = _tokens.ceil(100);
uint onePercentofTokens = roundValue.mul(100).div(100 * 10**uint(2));
return onePercentofTokens;
}
| 4,054 |
348 | // Transfer tokens into the contract from caller and mint the caller synthetic tokens. | collateralCurrency.safeTransferFrom(msg.sender, address(this), collateralAmount.rawValue);
require(tokenCurrency.mint(msg.sender, numTokens.rawValue), "Minting synthetic tokens failed");
emit PositionCreated(msg.sender, collateralAmount.rawValue, numTokens.rawValue);
| collateralCurrency.safeTransferFrom(msg.sender, address(this), collateralAmount.rawValue);
require(tokenCurrency.mint(msg.sender, numTokens.rawValue), "Minting synthetic tokens failed");
emit PositionCreated(msg.sender, collateralAmount.rawValue, numTokens.rawValue);
| 11,980 |
681 | // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 is no longer required. | result = prod0 * inverse;
return result;
| result = prod0 * inverse;
return result;
| 26,288 |
282 | // our borrow has been increased by no more than maxDeleverage | cToken.repayBorrow(deleveragedAmount);
| cToken.repayBorrow(deleveragedAmount);
| 1,577 |
15 | // run over the input, 3 bytes at a time | for {
} lt(dataPtr, endPtr) {
| for {
} lt(dataPtr, endPtr) {
| 46,743 |
16 | // Modifier to check if the caller is the gateway client contract / | modifier onlyClient() {
| modifier onlyClient() {
| 38,531 |
14 | // assume user has lost | int newBalance = _balance.sub(_betValue.castToInt());
| int newBalance = _balance.sub(_betValue.castToInt());
| 58,628 |
10 | // A submission is possible if this has become the active cycle (i.e. window opened) and... | require(reputationMiningWindowOpenTimestamp > 0, "colony-reputation-mining-cycle-not-open");
| require(reputationMiningWindowOpenTimestamp > 0, "colony-reputation-mining-cycle-not-open");
| 28,465 |
2 | // get latest timestamp | function getLatestTimestamp(bytes32 _priceFeedKey) external view returns (uint256);
| function getLatestTimestamp(bytes32 _priceFeedKey) external view returns (uint256);
| 16,265 |
55 | // Check rollback was effective | require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades");
| require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades");
| 1,694 |
79 | // Schedule an operation containing a batch of transactions. | * Emits one {CallScheduled} event per transaction in the batch.
*
* Requirements:
*
* - the caller must have the 'proposer' role.
*/
function scheduleBatch(
address[] calldata targets,
uint256[] calldata values,
bytes[] calldata datas,
bytes32 predecessor,
bytes32 salt,
uint256 delay
) public virtual onlyRole(PROPOSER_ROLE) {
require(targets.length == values.length, "TimelockController: length mismatch");
require(targets.length == datas.length, "TimelockController: length mismatch");
bytes32 id = hashOperationBatch(targets, values, datas, predecessor, salt);
_schedule(id, delay);
for (uint256 i = 0; i < targets.length; ++i) {
emit CallScheduled(id, i, targets[i], values[i], datas[i], predecessor, delay);
}
}
| * Emits one {CallScheduled} event per transaction in the batch.
*
* Requirements:
*
* - the caller must have the 'proposer' role.
*/
function scheduleBatch(
address[] calldata targets,
uint256[] calldata values,
bytes[] calldata datas,
bytes32 predecessor,
bytes32 salt,
uint256 delay
) public virtual onlyRole(PROPOSER_ROLE) {
require(targets.length == values.length, "TimelockController: length mismatch");
require(targets.length == datas.length, "TimelockController: length mismatch");
bytes32 id = hashOperationBatch(targets, values, datas, predecessor, salt);
_schedule(id, delay);
for (uint256 i = 0; i < targets.length; ++i) {
emit CallScheduled(id, i, targets[i], values[i], datas[i], predecessor, delay);
}
}
| 27,666 |
10 | // Namespace for the structs used in {SablierV2LockupDynamic}./Struct encapsulating the parameters for the {SablierV2LockupDynamic.createWithDeltas} function./sender The address streaming the assets, with the ability to cancel the stream. It doesn't have to be the/ same as `msg.sender`./recipient The address receiving the assets./totalAmount The total amount of ERC-20 assets to be paid, including the stream deposit and any potential/ fees, all denoted in units of the asset's decimals./asset The contract address of the ERC-20 asset used for streaming./cancelable Indicates if the stream is cancelable./broker Struct containing (i) the address of the broker assisting in creating the stream, and (ii) the/ percentage fee paid | struct CreateWithDeltas {
address sender;
bool cancelable;
address recipient;
uint128 totalAmount;
IERC20 asset;
Broker broker;
SegmentWithDelta[] segments;
}
| struct CreateWithDeltas {
address sender;
bool cancelable;
address recipient;
uint128 totalAmount;
IERC20 asset;
Broker broker;
SegmentWithDelta[] segments;
}
| 31,340 |
54 | // Clear decrease stake request | decreaseStakeRequests[_account] = DecreaseStakeRequest({
decreaseAmount: 0,
lockupExpiryBlock: 0
});
| decreaseStakeRequests[_account] = DecreaseStakeRequest({
decreaseAmount: 0,
lockupExpiryBlock: 0
});
| 9,783 |
52 | // return the start time of the ether vesting. / | function start() public view returns (uint256) {
return _start;
}
| function start() public view returns (uint256) {
return _start;
}
| 11,339 |
4 | // set the actual output length | mstore(result, encodedLen)
| mstore(result, encodedLen)
| 23,682 |
6 | // complement token conversion rate multiplied by 10 ^ 12 | uint256 public complementConversion;
| uint256 public complementConversion;
| 67,229 |
113 | // when sell | else if (
automatedMarketMakerPairs[to] &&
!_isExcludedMaxTransactionAmount[from]
) {
require(
amount <= maxTransactionAmount,
"Sell transfer amount exceeds the maxTransactionAmount."
);
} else if (!_isExcludedMaxTransactionAmount[to]) {
| else if (
automatedMarketMakerPairs[to] &&
!_isExcludedMaxTransactionAmount[from]
) {
require(
amount <= maxTransactionAmount,
"Sell transfer amount exceeds the maxTransactionAmount."
);
} else if (!_isExcludedMaxTransactionAmount[to]) {
| 4,579 |
24 | // uniswap | if (_command.dex == Dex.uniswap) {
amount = swapTokens(UNISWAP_ROUTER,
_command.token1,
_command.token2,
amountIn,
_command.amount2*10**_command.dec2,
block.timestamp + 15);
require(amount[1] > 0,"ERROR IN UNISWAP");
MyLog("SWAP: ",_command.token2,amount[0],true);
amountIn = amount[1];
| if (_command.dex == Dex.uniswap) {
amount = swapTokens(UNISWAP_ROUTER,
_command.token1,
_command.token2,
amountIn,
_command.amount2*10**_command.dec2,
block.timestamp + 15);
require(amount[1] > 0,"ERROR IN UNISWAP");
MyLog("SWAP: ",_command.token2,amount[0],true);
amountIn = amount[1];
| 35,003 |
204 | // `msg.sender` approves `_spender` to spend `_amount` tokens on/its behalf. This is a modified version of the ERC20 approve function/to be a little bit safer/_spender The address of the account able to transfer the tokens/_amount The amount of tokens to be approved for transfer/ return True if the approval was successful | function approve(address _spender, uint256 _amount) public returns (bool success) {
require(transfersEnabled);
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender,0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require((_amount == 0) || (allowed[msg.sender][_spender] == 0));
// Alerts the token controller of the approve function call
if (isContract(controller)) {
// Adding the ` == true` makes the linter shut up so...
require(ITokenController(controller).onApprove(msg.sender, _spender, _amount) == true);
}
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
}
| function approve(address _spender, uint256 _amount) public returns (bool success) {
require(transfersEnabled);
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender,0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require((_amount == 0) || (allowed[msg.sender][_spender] == 0));
// Alerts the token controller of the approve function call
if (isContract(controller)) {
// Adding the ` == true` makes the linter shut up so...
require(ITokenController(controller).onApprove(msg.sender, _spender, _amount) == true);
}
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
}
| 14,183 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.