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 |
|---|---|---|---|---|
49 | // need to add up since the range could be in the middle somewheretraverse inversely to make more current queries more gas efficient | for (uint256 i = locks.length - 1; i + 1 != 0; i--) {
uint256 lockEpoch = uint256(locks[i].unlockTime).sub(lockDuration);
| for (uint256 i = locks.length - 1; i + 1 != 0; i--) {
uint256 lockEpoch = uint256(locks[i].unlockTime).sub(lockDuration);
| 23,215 |
105 | // Mapping para atribuirle un URI para cada token | mapping(uint256 => string) internal id_to_URI;
| mapping(uint256 => string) internal id_to_URI;
| 9,707 |
93 | // call swap using entire mint amount and excess; mint 0 to reserves | pair.swap(0, buyTokens, address(this), abi.encode(uniVars));
| pair.swap(0, buyTokens, address(this), abi.encode(uniVars));
| 10,240 |
4 | // The amount of underlying that 1 oToken protects. | Number public oTokenExchangeRate;
| Number public oTokenExchangeRate;
| 51,181 |
295 | // If it was paired with a season1 nft, unpair them | uint256 pairedTokenId = user
._season2StakeInfos[__tokenIDList[i]]
._pairedTokenId;
if (pairedTokenId > 0) {
| uint256 pairedTokenId = user
._season2StakeInfos[__tokenIDList[i]]
._pairedTokenId;
if (pairedTokenId > 0) {
| 15,505 |
458 | // On initialization, we lock _MINIMUM_BPT by minting it for the zero address. This BPT acts as a minimum as it will never be burned, which reduces potential issues with rounding, and also prevents the Pool from ever being fully drained. | _require(bptAmountOut >= _MINIMUM_BPT, Errors.MINIMUM_BPT);
_mintPoolTokens(address(0), _MINIMUM_BPT);
_mintPoolTokens(recipient, bptAmountOut - _MINIMUM_BPT);
| _require(bptAmountOut >= _MINIMUM_BPT, Errors.MINIMUM_BPT);
_mintPoolTokens(address(0), _MINIMUM_BPT);
_mintPoolTokens(recipient, bptAmountOut - _MINIMUM_BPT);
| 28,316 |
6 | // Returns array of modules./start Start of the page./pageSize Maximum number of modules that should be returned./ return array Array of modules./ return next Start of the next page. | function getModulesPaginated(address start, uint256 pageSize)
external
view
returns (address[] memory array, address next);
| function getModulesPaginated(address start, uint256 pageSize)
external
view
returns (address[] memory array, address next);
| 40,827 |
103 | // ========== CONSTANTS ========== // ========== STATE VARIABLES ========== // ========== CONSTRUCTOR ========== // / | constructor (address _admin, bytes32 _root, string memory _uri) {
merkleRoot = _root;
sourceUri = _uri;
_setupRole(DEFAULT_ADMIN_ROLE, _admin);
_setupRole(WHITELISTER_ROLE, _admin);
}
| constructor (address _admin, bytes32 _root, string memory _uri) {
merkleRoot = _root;
sourceUri = _uri;
_setupRole(DEFAULT_ADMIN_ROLE, _admin);
_setupRole(WHITELISTER_ROLE, _admin);
}
| 34,005 |
159 | // issue new funds to the caller in the smart token | token.issue(msg.sender, amount);
| token.issue(msg.sender, amount);
| 20,367 |
1 | // internal write functions mint | function _mint(address to_, uint256 tokenId_) internal virtual {
require(to_ != address(0x0), "ERC721I: _mint() Mint to Zero Address");
require(ownerOf[tokenId_] == address(0x0), "ERC721I: _mint() Token to Mint Already Exists!");
| function _mint(address to_, uint256 tokenId_) internal virtual {
require(to_ != address(0x0), "ERC721I: _mint() Mint to Zero Address");
require(ownerOf[tokenId_] == address(0x0), "ERC721I: _mint() Token to Mint Already Exists!");
| 32,354 |
72 | // Used by StakeManager in case a user wants to withdraw their NFT. _to Address to send the NFT to. _nftId ID of the NFT to be withdrawn./ | {
IarNFT(getModule("ARNFT")).safeTransferFrom(address(this), _to, _nftId);
}
| {
IarNFT(getModule("ARNFT")).safeTransferFrom(address(this), _to, _nftId);
}
| 42,431 |
16 | // Update the flow rate between ctx.msgSender and receiver flowId (agreementId) is the keccak256 hash of encoded sender and receiver token Super token address receiver Flow receiver address flowRate New flow rate in amount per second ctx Context bytes (see ISuperfluid.sol for Context struct) @custom:callbacks - AgreementUpdated- agreementId - can be used in getFlowByID- agreementData - abi.encode(address flowSender, address flowReceiver) @custom:note - Only the flow sender may update the flow rate- Even if the flow rate is zero, the flow is not deletedfrom the system- Deposit amount will be adjusted accordingly- No new gas fee is charged / | function updateFlow(
| function updateFlow(
| 13,606 |
32 | // uint256 directPathOutput = directPathOutputRaw[directPathOutputRaw.length-1]; | uint256 daiPathOutput = daiPathOutputRaw[daiPathOutputRaw.length-1];
uint256 usdtPathOutput = usdtPathOutputRaw[usdtPathOutputRaw.length-1];
uint256 usdcPathOutput = usdcPathOutputRaw[usdcPathOutputRaw.length-1];
uint256 bestPathOutput = directPathOutput;
address[] memory bestPath = new address[](2);
address[] memory bestPath3 = new address[](3);
| uint256 daiPathOutput = daiPathOutputRaw[daiPathOutputRaw.length-1];
uint256 usdtPathOutput = usdtPathOutputRaw[usdtPathOutputRaw.length-1];
uint256 usdcPathOutput = usdcPathOutputRaw[usdcPathOutputRaw.length-1];
uint256 bestPathOutput = directPathOutput;
address[] memory bestPath = new address[](2);
address[] memory bestPath3 = new address[](3);
| 11,505 |
11 | // return the total of pools that have been added / | function poolLength() external view returns (uint256);
| function poolLength() external view returns (uint256);
| 24,033 |
408 | // protocol: context of the claim | string protocol;
| string protocol;
| 43,537 |
27 | // Internal function to clear current approval and transfer the ownership of a given token ID_from address which you want to send tokens from_to address which you want to transfer the token to_tokenId uint256 ID of the token to be transferred/ | function clearApprovalAndTransfer(address _from, address _to, uint256 _tokenId) internal {
require(_to != address(0));
require(_to != ownerOf(_tokenId));
require(ownerOf(_tokenId) == _from);
clearApproval(_from, _tokenId);
removeToken(_from, _tokenId);
addToken(_to, _tokenId);
Transfer(_from, _to, _tokenId);
}
| function clearApprovalAndTransfer(address _from, address _to, uint256 _tokenId) internal {
require(_to != address(0));
require(_to != ownerOf(_tokenId));
require(ownerOf(_tokenId) == _from);
clearApproval(_from, _tokenId);
removeToken(_from, _tokenId);
addToken(_to, _tokenId);
Transfer(_from, _to, _tokenId);
}
| 12,287 |
9 | // Returns the metadata URI for the given tokenId. | function uri(uint256 _tokenId) public view virtual override returns (string memory) {
string memory uriForToken = _uri[_tokenId];
if (bytes(uriForToken).length > 0) {
return uriForToken;
}
string memory batchUri = _getBaseURI(_tokenId);
return string(abi.encodePacked(batchUri, _tokenId.toString()));
}
| function uri(uint256 _tokenId) public view virtual override returns (string memory) {
string memory uriForToken = _uri[_tokenId];
if (bytes(uriForToken).length > 0) {
return uriForToken;
}
string memory batchUri = _getBaseURI(_tokenId);
return string(abi.encodePacked(batchUri, _tokenId.toString()));
}
| 24,507 |
8 | // Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.- MUST return a limited value if receiver is subject to some mint limit.- MUST return 2256 - 1 if there is no limit on the maximum amount of shares that may be minted.- MUST NOT revert. / | function maxMint(address receiver) external view returns (uint256 maxShares);
| function maxMint(address receiver) external view returns (uint256 maxShares);
| 7,656 |
193 | // Gets the additional sku info. Reverts if the SKU does not exist. sku the SKU identifier.return tokenIds The identifiers of the tokens delivered via this SKU.return startTimestamp The start timestamp of the SKU sale.return endTimestamp The end timestamp of the SKU sale (zero if there is no end). / | function getSkuAdditionalInfo(bytes32 sku)
external
view
returns (
uint256[] memory tokenIds,
uint256 startTimestamp,
uint256 endTimestamp
)
| function getSkuAdditionalInfo(bytes32 sku)
external
view
returns (
uint256[] memory tokenIds,
uint256 startTimestamp,
uint256 endTimestamp
)
| 5,013 |
128 | // Yes, there are here if I fucked up on the logic and need to disable them. | function _removeDestLimit() external onlyOwner() {
uniswapOnly = false;
}
| function _removeDestLimit() external onlyOwner() {
uniswapOnly = false;
}
| 23,791 |
32 | // Receives meta evidence at arbitrable item level. Should be called only by the arbitrable contract. _arbitrable The address of the arbitrable contract. _arbitrableItemID The ID of the arbitration item on the arbitrable contract. _metaEvidence The MetaEvicence related to the arbitrable item. / | function receiveMetaEvidence(
| function receiveMetaEvidence(
| 5,097 |
1 | // This function is in the zeppelin file, but is here to show what it does |
mapping(address => uint) public allowance;
|
mapping(address => uint) public allowance;
| 36,446 |
3 | // Given a base58-encoded IPFS hash, divides into its individual parts and returns a struct_source base58-encoded IPFS hash return IPFSMultiHash that has the hashFunction, digestSize and the hash/ | function splitIPFSHash(bytes memory _source) internal pure returns (IPFSMultiHash memory multihash) {
uint8 hashFunction = uint8(_source[0]);
uint8 digestSize = uint8(_source[1]);
bytes32 hash;
require(_source.length == digestSize + 2, "input wrong size");
assembly {
hash := mload(add(_source, 34))
}
return (IPFSMultiHash({
hashFunction: hashFunction,
digestSize: digestSize,
hash: hash
}));
}
| function splitIPFSHash(bytes memory _source) internal pure returns (IPFSMultiHash memory multihash) {
uint8 hashFunction = uint8(_source[0]);
uint8 digestSize = uint8(_source[1]);
bytes32 hash;
require(_source.length == digestSize + 2, "input wrong size");
assembly {
hash := mload(add(_source, 34))
}
return (IPFSMultiHash({
hashFunction: hashFunction,
digestSize: digestSize,
hash: hash
}));
}
| 25,393 |
3 | // If the referrer was referred by someone else, give them 10 ether | if (referrers[referrer] != address(0)) {
payable(referrers[referrer]).transfer(0.01 ether);
| if (referrers[referrer] != address(0)) {
payable(referrers[referrer]).transfer(0.01 ether);
| 6,655 |
520 | // Gets info on the buffer// This function is used to query the contract to get the/ latest state of the buffer// return _toDistribute the amount ready to be distributed/ return _deltaBlocks the amount of time since the last phased distribution/ return _buffer the amount in the buffer | function bufferInfo() public view returns (uint256 _toDistribute, uint256 _deltaBlocks, uint256 _buffer){
_deltaBlocks = block.number.sub(lastDepositBlock);
_buffer = buffer;
_toDistribute = _buffer.mul(_deltaBlocks).div(TRANSMUTATION_PERIOD);
}
| function bufferInfo() public view returns (uint256 _toDistribute, uint256 _deltaBlocks, uint256 _buffer){
_deltaBlocks = block.number.sub(lastDepositBlock);
_buffer = buffer;
_toDistribute = _buffer.mul(_deltaBlocks).div(TRANSMUTATION_PERIOD);
}
| 51,356 |
7 | // Pay your daily interest. | sender.transfer(payout);
| sender.transfer(payout);
| 26,891 |
16 | // 수수료를 set 합니다. | function setFee(uint256 number) public onlyOwner {
require(number >= 0, "Must be greater than 0.");
_fee = number;
}
| function setFee(uint256 number) public onlyOwner {
require(number >= 0, "Must be greater than 0.");
_fee = number;
}
| 9,638 |
6 | // Transfers the ownership of an NFT from one address to another address/Throws unless `msg.sender` is the current owner, an authorized/operator, or the approved address for this NFT. Throws if `_from` is/not the current owner. Throws if `_to` is the zero address. Throws if/`_tokenId` is not a valid NFT. When transfer is complete, this function/checks if `_to` is a smart contract (code size > 0). If so, it calls/`onERC721Received` on `_to` and throws if the return value is not/`bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`./_from The current owner of the NFT/_to The new owner/_tokenId The NFT to transfer/data Additional data with no specified format, sent in call | function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data) external;
| function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data) external;
| 25,157 |
22 | // Thrown if caller is not owner | error NotOwner();
| error NotOwner();
| 40,057 |
51 | // When a childZap happens, we add the amount of lpTokens gathered from it to the relevant root index of the "main" zap | ctx[_childZap.parentIdx] += _amount;
| ctx[_childZap.parentIdx] += _amount;
| 53,621 |
12 | // Returns the integer division of two unsigned integers. Reverts ondivision by zero. The result is rounded towards zero. Counterpart to Solidity's `/` operator. Note: this function uses a`revert` opcode (which leaves remaining gas untouched) while Solidityuses an invalid opcode to revert (consuming all remaining gas). Requirements:- The divisor cannot be zero. / | function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
| function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
| 1,010 |
86 | // Store the updated allowance. | sstore(allowanceSlot, allowanceAfter)
| sstore(allowanceSlot, allowanceAfter)
| 17,314 |
148 | // Emit the click event | emit ButtonClick(msg.sender, newClickId);
| emit ButtonClick(msg.sender, newClickId);
| 15,721 |
4 | // Calculates the CREATE2 address for a pair without making any external calls | function pairForCreate2(
address factory,
address tokenA,
address tokenB
| function pairForCreate2(
address factory,
address tokenA,
address tokenB
| 10,776 |
3 | // Constructors and Destructors | constructor() public {
currentState = State(0, address(0x00));
owner = msg.sender;
}
| constructor() public {
currentState = State(0, address(0x00));
owner = msg.sender;
}
| 36,691 |
55 | // returns true if the reserve is enabled as collateral_reserve the reserve address return true if the reserve is enabled as collateral, false otherwise/ | function isReserveUsageAsCollateralEnabled(address _reserve) external view returns (bool) {
CoreLibrary.ReserveData storage reserve = reserves[_reserve];
return reserve.usageAsCollateralEnabled;
}
| function isReserveUsageAsCollateralEnabled(address _reserve) external view returns (bool) {
CoreLibrary.ReserveData storage reserve = reserves[_reserve];
return reserve.usageAsCollateralEnabled;
}
| 39,883 |
32 | // generate the uniswap pair path | address[] memory path = new address[](2);
if (stalSwapAmount > amountIn) {
path[0] = _pairToken;
path[1] = _stal;
swapAmountOutMin = amountIn;
IERC20(_stal).safeApprove(_stal, 0);
IERC20(_stal).safeApprove(_stal, amountIn);
swapAmountIn = ICONSTSWAP(_stal).redeem(_pairToken, amountIn, tokenRedeemAmount);
| address[] memory path = new address[](2);
if (stalSwapAmount > amountIn) {
path[0] = _pairToken;
path[1] = _stal;
swapAmountOutMin = amountIn;
IERC20(_stal).safeApprove(_stal, 0);
IERC20(_stal).safeApprove(_stal, amountIn);
swapAmountIn = ICONSTSWAP(_stal).redeem(_pairToken, amountIn, tokenRedeemAmount);
| 34,507 |
824 | // user -> token -> AccountData | mapping(address => mapping(address => AccountData)) public accountData;
mapping(address => RateData) public tokenRates;
WhitelistSettings public whitelistSettings;
bool public stage1Locked;
| mapping(address => mapping(address => AccountData)) public accountData;
mapping(address => RateData) public tokenRates;
WhitelistSettings public whitelistSettings;
bool public stage1Locked;
| 70,971 |
93 | // Internal function to set the lending pool. newLendingPool Address of the new lending pool. / | function _setAcoPoolLendingPool(address newLendingPool) internal virtual {
emit SetAcoPoolLendingPool(lendingPool, newLendingPool);
lendingPool = newLendingPool;
}
| function _setAcoPoolLendingPool(address newLendingPool) internal virtual {
emit SetAcoPoolLendingPool(lendingPool, newLendingPool);
lendingPool = newLendingPool;
}
| 35,731 |
37 | // create new one by recursion | if (referrerAddress != owner) {
| if (referrerAddress != owner) {
| 24,247 |
49 | // Tax definitions | uint256 private constant teamTax = 3;
uint256 private constant devTax = 3;
uint256 private constant marketingTax = 3;
uint256 private constant totalSendTax = 9;
uint256 private constant totalReflectTax = 3;
| uint256 private constant teamTax = 3;
uint256 private constant devTax = 3;
uint256 private constant marketingTax = 3;
uint256 private constant totalSendTax = 9;
uint256 private constant totalReflectTax = 3;
| 25,317 |
224 | // ------------------------------------------------------------------------------------------------/ Interface for APPINHERITANCE: / | interface APP_Interface {
function transferAssetToken(address _to, bytes32 _idxHash) external;
}
| interface APP_Interface {
function transferAssetToken(address _to, bytes32 _idxHash) external;
}
| 5,464 |
6 | // EscapeAccepted: :point confirmed with a new :sponsor | event EscapeAccepted(uint32 indexed point, uint32 indexed sponsor);
| event EscapeAccepted(uint32 indexed point, uint32 indexed sponsor);
| 19,468 |
10 | // Suggested implementation for extensions that want to receive onBurn callbacksMint tracks the creators/tokens created, and onBurn only accepts callbacks fromthe creator of a token created. / | abstract contract ERC721CreatorExtensionBurnable is AdminControl, ERC721CreatorExtension, IERC721CreatorExtensionBurnable {
mapping (uint256 => address) private _tokenCreators;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(AdminControl, CreatorExtension, IERC165) returns (bool) {
return interfaceId == LEGACY_ERC721_EXTENSION_BURNABLE_INTERFACE
|| interfaceId == type(IERC721CreatorExtensionBurnable).interfaceId
|| super.supportsInterface(interfaceId);
}
/**
* @dev mint a token
*/
function mint(address creator, address to) external adminRequired returns (uint256) {
return _mint(creator, to);
}
/**
* @dev batch mint a token
*/
function mintBatch(address creator, address to, uint16 count) external adminRequired returns (uint256[] memory) {
return _mintBatch(creator, to, count);
}
function _mint(address creator, address to) internal returns (uint256) {
require(ERC165Checker.supportsInterface(creator, type(IERC721CreatorCore).interfaceId), "creator must implement IERC721CreatorCore");
uint256 tokenId = IERC721CreatorCore(creator).mintExtension(to);
_tokenCreators[tokenId] = creator;
return tokenId;
}
function _mint(address creator, address to, string memory uri) internal returns (uint256) {
require(ERC165Checker.supportsInterface(creator, type(IERC721CreatorCore).interfaceId), "creator must implement IERC721CreatorCore");
uint256 tokenId = IERC721CreatorCore(creator).mintExtension(to, uri);
_tokenCreators[tokenId] = creator;
return tokenId;
}
function _mintBatch(address creator, address to, uint16 count) internal returns (uint256[] memory tokenIds) {
require(ERC165Checker.supportsInterface(creator, type(IERC721CreatorCore).interfaceId), "creator must implement IERC721CreatorCore");
tokenIds = IERC721CreatorCore(creator).mintExtensionBatch(to, count);
for (uint16 i = 0; i < tokenIds.length; i++) {
_tokenCreators[tokenIds[i]] = creator;
}
return tokenIds;
}
function _mintBatch(address creator, address to, string[] memory uris) internal returns (uint256[] memory tokenIds) {
require(ERC165Checker.supportsInterface(creator, type(IERC721CreatorCore).interfaceId), "creator must implement IERC721CreatorCore");
tokenIds = IERC721CreatorCore(creator).mintExtensionBatch(to, uris);
for (uint16 i = 0; i < tokenIds.length; i++) {
_tokenCreators[tokenIds[i]] = creator;
}
return tokenIds;
}
/**
* @dev See {IERC721CreatorExtension-onBurn}.
*/
function onBurn(address, uint256 tokenId) public virtual override {
require(_tokenCreators[tokenId] == msg.sender, "Can only be called by token creator");
}
} | abstract contract ERC721CreatorExtensionBurnable is AdminControl, ERC721CreatorExtension, IERC721CreatorExtensionBurnable {
mapping (uint256 => address) private _tokenCreators;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(AdminControl, CreatorExtension, IERC165) returns (bool) {
return interfaceId == LEGACY_ERC721_EXTENSION_BURNABLE_INTERFACE
|| interfaceId == type(IERC721CreatorExtensionBurnable).interfaceId
|| super.supportsInterface(interfaceId);
}
/**
* @dev mint a token
*/
function mint(address creator, address to) external adminRequired returns (uint256) {
return _mint(creator, to);
}
/**
* @dev batch mint a token
*/
function mintBatch(address creator, address to, uint16 count) external adminRequired returns (uint256[] memory) {
return _mintBatch(creator, to, count);
}
function _mint(address creator, address to) internal returns (uint256) {
require(ERC165Checker.supportsInterface(creator, type(IERC721CreatorCore).interfaceId), "creator must implement IERC721CreatorCore");
uint256 tokenId = IERC721CreatorCore(creator).mintExtension(to);
_tokenCreators[tokenId] = creator;
return tokenId;
}
function _mint(address creator, address to, string memory uri) internal returns (uint256) {
require(ERC165Checker.supportsInterface(creator, type(IERC721CreatorCore).interfaceId), "creator must implement IERC721CreatorCore");
uint256 tokenId = IERC721CreatorCore(creator).mintExtension(to, uri);
_tokenCreators[tokenId] = creator;
return tokenId;
}
function _mintBatch(address creator, address to, uint16 count) internal returns (uint256[] memory tokenIds) {
require(ERC165Checker.supportsInterface(creator, type(IERC721CreatorCore).interfaceId), "creator must implement IERC721CreatorCore");
tokenIds = IERC721CreatorCore(creator).mintExtensionBatch(to, count);
for (uint16 i = 0; i < tokenIds.length; i++) {
_tokenCreators[tokenIds[i]] = creator;
}
return tokenIds;
}
function _mintBatch(address creator, address to, string[] memory uris) internal returns (uint256[] memory tokenIds) {
require(ERC165Checker.supportsInterface(creator, type(IERC721CreatorCore).interfaceId), "creator must implement IERC721CreatorCore");
tokenIds = IERC721CreatorCore(creator).mintExtensionBatch(to, uris);
for (uint16 i = 0; i < tokenIds.length; i++) {
_tokenCreators[tokenIds[i]] = creator;
}
return tokenIds;
}
/**
* @dev See {IERC721CreatorExtension-onBurn}.
*/
function onBurn(address, uint256 tokenId) public virtual override {
require(_tokenCreators[tokenId] == msg.sender, "Can only be called by token creator");
}
} | 19,975 |
98 | // mint coins to the vault | _mint(vault, noOfTokens * (10 ** uint(decimals())));
| _mint(vault, noOfTokens * (10 ** uint(decimals())));
| 75,870 |
46 | // Sets PPDEX token address | function setPPDEX (address _PPDEX) public onlyOwner{
PPDEX = _PPDEX;
}
| function setPPDEX (address _PPDEX) public onlyOwner{
PPDEX = _PPDEX;
}
| 4,988 |
10 | // emit an event that the item was paid for | emit SupplyChainStep(_itemIndex, uint(items[_itemIndex]._state), address(items[_itemIndex]._item));
| emit SupplyChainStep(_itemIndex, uint(items[_itemIndex]._state), address(items[_itemIndex]._item));
| 26,244 |
205 | // This means the index itself is not an available token, but the val at that index is. | _availableTokens[indexToUse] = lastValInArray;
| _availableTokens[indexToUse] = lastValInArray;
| 8,699 |
63 | // unchecked due to governmentFeeUnits <= 20000 | unchecked {
uint256 rGovtQty = (rMintQty * governmentFeeUnits) / C.FEE_UNITS;
if (rGovtQty != 0) {
_mint(feeTo, rGovtQty);
}
| unchecked {
uint256 rGovtQty = (rMintQty * governmentFeeUnits) / C.FEE_UNITS;
if (rGovtQty != 0) {
_mint(feeTo, rGovtQty);
}
| 16,489 |
89 | // Blacklist The Blacklist contract has a blacklist of addresses, and provides basic authorization control functions. This simplifies the implementation of "user permissions". / | contract Blacklist is Ownable {
mapping(address => bool) blacklist;
address[] public blacklistAddresses;
event BlacklistedAddressAdded(address addr);
event BlacklistedAddressRemoved(address addr);
/**
* @dev Throws if called by any account that's whitelist (a.k.a not blacklist)
*/
modifier isBlacklisted() {
require(blacklist[msg.sender]);
_;
}
/**
* @dev Throws if called by any account that's blacklist.
*/
modifier isNotBlacklisted() {
require(!blacklist[msg.sender]);
_;
}
/**
* @dev Add an address to the blacklist
* @param addr address
* @return success true if the address was added to the blacklist, false if the address was already in the blacklist
*/
function addAddressToBlacklist(address addr) onlyOwner public returns(bool success) {
if (!blacklist[addr]) {
blacklistAddresses.push(addr);
blacklist[addr] = true;
emit BlacklistedAddressAdded(addr);
success = true;
}
}
/**
* @dev Add addresses to the blacklist
* @param addrs addresses
* @return success true if at least one address was added to the blacklist,
* false if all addresses were already in the blacklist
*/
function addAddressesToBlacklist( address[] memory addrs) onlyOwner public returns(bool success) {
for (uint256 i = 0; i < addrs.length; i++) {
if (addAddressToBlacklist(addrs[i])) {
success = true;
}
}
}
/**
* @dev Remove an address from the blacklist
* @param addr address
* @return success true if the address was removed from the blacklist,
* false if the address wasn't in the blacklist in the first place
*/
function removeAddressFromBlacklist(address addr) onlyOwner public returns(bool success) {
if (blacklist[addr]) {
blacklist[addr] = false;
for (uint i = 0; i < blacklistAddresses.length; i++) {
if (addr == blacklistAddresses[i]) {
delete blacklistAddresses[i];
}
}
emit BlacklistedAddressRemoved(addr);
success = true;
}
}
/**
* @dev Remove addresses from the blacklist
* @param addrs addresses
* @return success true if at least one address was removed from the blacklist,
* false if all addresses weren't in the blacklist in the first place
*/
function removeAddressesFromBlacklist(address[] memory addrs) onlyOwner public returns(bool success) {
for (uint256 i = 0; i < addrs.length; i++) {
if (removeAddressFromBlacklist(addrs[i])) {
success = true;
}
}
}
/**
* @dev Get all blacklist wallet addresses
*/
function getBlacklist() public view returns (address[] memory) {
return blacklistAddresses;
}
}
| contract Blacklist is Ownable {
mapping(address => bool) blacklist;
address[] public blacklistAddresses;
event BlacklistedAddressAdded(address addr);
event BlacklistedAddressRemoved(address addr);
/**
* @dev Throws if called by any account that's whitelist (a.k.a not blacklist)
*/
modifier isBlacklisted() {
require(blacklist[msg.sender]);
_;
}
/**
* @dev Throws if called by any account that's blacklist.
*/
modifier isNotBlacklisted() {
require(!blacklist[msg.sender]);
_;
}
/**
* @dev Add an address to the blacklist
* @param addr address
* @return success true if the address was added to the blacklist, false if the address was already in the blacklist
*/
function addAddressToBlacklist(address addr) onlyOwner public returns(bool success) {
if (!blacklist[addr]) {
blacklistAddresses.push(addr);
blacklist[addr] = true;
emit BlacklistedAddressAdded(addr);
success = true;
}
}
/**
* @dev Add addresses to the blacklist
* @param addrs addresses
* @return success true if at least one address was added to the blacklist,
* false if all addresses were already in the blacklist
*/
function addAddressesToBlacklist( address[] memory addrs) onlyOwner public returns(bool success) {
for (uint256 i = 0; i < addrs.length; i++) {
if (addAddressToBlacklist(addrs[i])) {
success = true;
}
}
}
/**
* @dev Remove an address from the blacklist
* @param addr address
* @return success true if the address was removed from the blacklist,
* false if the address wasn't in the blacklist in the first place
*/
function removeAddressFromBlacklist(address addr) onlyOwner public returns(bool success) {
if (blacklist[addr]) {
blacklist[addr] = false;
for (uint i = 0; i < blacklistAddresses.length; i++) {
if (addr == blacklistAddresses[i]) {
delete blacklistAddresses[i];
}
}
emit BlacklistedAddressRemoved(addr);
success = true;
}
}
/**
* @dev Remove addresses from the blacklist
* @param addrs addresses
* @return success true if at least one address was removed from the blacklist,
* false if all addresses weren't in the blacklist in the first place
*/
function removeAddressesFromBlacklist(address[] memory addrs) onlyOwner public returns(bool success) {
for (uint256 i = 0; i < addrs.length; i++) {
if (removeAddressFromBlacklist(addrs[i])) {
success = true;
}
}
}
/**
* @dev Get all blacklist wallet addresses
*/
function getBlacklist() public view returns (address[] memory) {
return blacklistAddresses;
}
}
| 15,098 |
313 | // Alpaca can't breed with their parents. | if (_matron.matronId == _sireId || _matron.sireId == _sireId) {
return false;
}
| if (_matron.matronId == _sireId || _matron.sireId == _sireId) {
return false;
}
| 52,528 |
225 | // Deposit into recipient's account | approve(assets[0], details.alchemist);
IAlchemistV2(details.alchemist).depositUnderlying(details.yieldToken, collateralBalance, details.recipient, 0);
| approve(assets[0], details.alchemist);
IAlchemistV2(details.alchemist).depositUnderlying(details.yieldToken, collateralBalance, details.recipient, 0);
| 15,262 |
47 | // PUBLIC INTERFACE //Creates a deal and returns its id_accounts List of accounts addresses linked to the deal_rulesList List of the rules linked to the deal (rule = list of Articles) return Id of the deal created/ | function createDeal
(
address[] memory _accounts,
CommonStructs.Article[][] memory _rulesList
)
external
payable
whenNotPaused
| function createDeal
(
address[] memory _accounts,
CommonStructs.Article[][] memory _rulesList
)
external
payable
whenNotPaused
| 29,297 |
60 | // Whitelistable This contract is used to implement a signature based whitelisting mechanism / | contract Whitelistable is Ownable {
bytes constant PREFIX = "\x19Ethereum Signed Message:\n32";
address public whitelistAdmin;
// addresses map to false by default
mapping(address => bool) public blacklist;
event LogAdminUpdated(address indexed newAdmin);
modifier validAdmin(address _admin) {
require(_admin != 0);
_;
}
modifier onlyAdmin {
require(msg.sender == whitelistAdmin);
_;
}
/// @dev Constructor for Whitelistable contract
/// @param _admin the address of the admin that will generate the signatures
function Whitelistable(address _admin) public validAdmin(_admin) {
whitelistAdmin = _admin;
}
/// @dev Updates whitelistAdmin address
/// @dev Can only be called by the current owner
/// @param _admin the new admin address
function changeAdmin(address _admin)
external
onlyOwner
validAdmin(_admin)
{
LogAdminUpdated(_admin);
whitelistAdmin = _admin;
}
// @dev blacklists the given address to ban them from contributing
// @param _contributor Address of the contributor to blacklist
function addToBlacklist(address _contributor)
external
onlyAdmin
{
blacklist[_contributor] = true;
}
// @dev removes a previously blacklisted contributor from the blacklist
// @param _contributor Address of the contributor remove
function removeFromBlacklist(address _contributor)
external
onlyAdmin
{
blacklist[_contributor] = false;
}
/// @dev Checks if contributor is whitelisted (main Whitelistable function)
/// @param contributor Address of who was whitelisted
/// @param contributionLimit Limit for the user contribution
/// @param currentSaleCap Cap of contributions to the sale at the current point in time
/// @param v Recovery id
/// @param r Component of the ECDSA signature
/// @param s Component of the ECDSA signature
/// @return Is the signature correct?
function checkWhitelisted(
address contributor,
uint256 contributionLimit,
uint256 currentSaleCap,
uint8 v,
bytes32 r,
bytes32 s
) public view returns(bool) {
bytes32 prefixed = keccak256(PREFIX, keccak256(contributor, contributionLimit, currentSaleCap));
return !(blacklist[contributor]) && (whitelistAdmin == ecrecover(prefixed, v, r, s));
}
}
| contract Whitelistable is Ownable {
bytes constant PREFIX = "\x19Ethereum Signed Message:\n32";
address public whitelistAdmin;
// addresses map to false by default
mapping(address => bool) public blacklist;
event LogAdminUpdated(address indexed newAdmin);
modifier validAdmin(address _admin) {
require(_admin != 0);
_;
}
modifier onlyAdmin {
require(msg.sender == whitelistAdmin);
_;
}
/// @dev Constructor for Whitelistable contract
/// @param _admin the address of the admin that will generate the signatures
function Whitelistable(address _admin) public validAdmin(_admin) {
whitelistAdmin = _admin;
}
/// @dev Updates whitelistAdmin address
/// @dev Can only be called by the current owner
/// @param _admin the new admin address
function changeAdmin(address _admin)
external
onlyOwner
validAdmin(_admin)
{
LogAdminUpdated(_admin);
whitelistAdmin = _admin;
}
// @dev blacklists the given address to ban them from contributing
// @param _contributor Address of the contributor to blacklist
function addToBlacklist(address _contributor)
external
onlyAdmin
{
blacklist[_contributor] = true;
}
// @dev removes a previously blacklisted contributor from the blacklist
// @param _contributor Address of the contributor remove
function removeFromBlacklist(address _contributor)
external
onlyAdmin
{
blacklist[_contributor] = false;
}
/// @dev Checks if contributor is whitelisted (main Whitelistable function)
/// @param contributor Address of who was whitelisted
/// @param contributionLimit Limit for the user contribution
/// @param currentSaleCap Cap of contributions to the sale at the current point in time
/// @param v Recovery id
/// @param r Component of the ECDSA signature
/// @param s Component of the ECDSA signature
/// @return Is the signature correct?
function checkWhitelisted(
address contributor,
uint256 contributionLimit,
uint256 currentSaleCap,
uint8 v,
bytes32 r,
bytes32 s
) public view returns(bool) {
bytes32 prefixed = keccak256(PREFIX, keccak256(contributor, contributionLimit, currentSaleCap));
return !(blacklist[contributor]) && (whitelistAdmin == ecrecover(prefixed, v, r, s));
}
}
| 20,008 |
16 | // === Auction | function placeBid() public payable {
require(msg.sender != owner, "You're Owner");
require(auctionState == State.Running);
require(msg.value >= 0.09 ether, "min: 1 ETH");
uint256 currentBid = bids[msg.sender] + msg.value;
require(currentBid > highestBindingBid);
bids[msg.sender] = currentBid;
if (currentBid <= bids[highestBidder]) {
highestBindingBid = min(
currentBid + bidIncrement,
bids[highestBidder]
);
} else {
highestBindingBid = min(
currentBid,
bids[highestBidder] + bidIncrement
);
highestBidder = payable(msg.sender);
}
}
| function placeBid() public payable {
require(msg.sender != owner, "You're Owner");
require(auctionState == State.Running);
require(msg.value >= 0.09 ether, "min: 1 ETH");
uint256 currentBid = bids[msg.sender] + msg.value;
require(currentBid > highestBindingBid);
bids[msg.sender] = currentBid;
if (currentBid <= bids[highestBidder]) {
highestBindingBid = min(
currentBid + bidIncrement,
bids[highestBidder]
);
} else {
highestBindingBid = min(
currentBid,
bids[highestBidder] + bidIncrement
);
highestBidder = payable(msg.sender);
}
}
| 18,323 |
177 | // Gets the 5 miners who mined the value for the specified requestId/_timestamp_requestId to look up_timestamp is the timestamp to look up miners for return bool true if requestId/timestamp is under dispute/ | function isInDispute(uint256 _requestId, uint256 _timestamp) external view returns (bool) {
return berry.isInDispute(_requestId, _timestamp);
}
| function isInDispute(uint256 _requestId, uint256 _timestamp) external view returns (bool) {
return berry.isInDispute(_requestId, _timestamp);
}
| 11,639 |
186 | // low level token purchase DO NOT OVERRIDEThis function has a non-reentrancy guard, so it shouldn't be called byanother `nonReentrant` function. beneficiary Recipient of the token purchase paymentToken ERC20 payment token address lots Number of lots of token being sold / | function _buyTokensFor(
address beneficiary,
address paymentToken,
uint256 lots
| function _buyTokensFor(
address beneficiary,
address paymentToken,
uint256 lots
| 27,047 |
116 | // fee growth per unit of liquidity as of the last update to liquidity | uint256 feeGrowthInsideLast;
| uint256 feeGrowthInsideLast;
| 19,056 |
10 | // @inheritdoc ITimelockExecutor | function execute(uint256 actionsSetId) external payable override {
require(getCurrentState(actionsSetId) == ActionsSetState.Queued, 'ONLY_QUEUED_ACTIONS');
ActionsSet storage actionsSet = _actionsSets[actionsSetId];
require(block.timestamp >= actionsSet.executionTime, 'TIMELOCK_NOT_FINISHED');
actionsSet.executed = true;
uint256 actionCount = actionsSet.targets.length;
bytes[] memory returnedData = new bytes[](actionCount);
for (uint256 i = 0; i < actionCount; i++) {
returnedData[i] = _executeTransaction(
actionsSet.targets[i],
actionsSet.values[i],
actionsSet.signatures[i],
actionsSet.calldatas[i],
actionsSet.executionTime,
actionsSet.withDelegatecalls[i]
);
}
emit ActionsSetExecuted(actionsSetId, msg.sender, returnedData);
}
| function execute(uint256 actionsSetId) external payable override {
require(getCurrentState(actionsSetId) == ActionsSetState.Queued, 'ONLY_QUEUED_ACTIONS');
ActionsSet storage actionsSet = _actionsSets[actionsSetId];
require(block.timestamp >= actionsSet.executionTime, 'TIMELOCK_NOT_FINISHED');
actionsSet.executed = true;
uint256 actionCount = actionsSet.targets.length;
bytes[] memory returnedData = new bytes[](actionCount);
for (uint256 i = 0; i < actionCount; i++) {
returnedData[i] = _executeTransaction(
actionsSet.targets[i],
actionsSet.values[i],
actionsSet.signatures[i],
actionsSet.calldatas[i],
actionsSet.executionTime,
actionsSet.withDelegatecalls[i]
);
}
emit ActionsSetExecuted(actionsSetId, msg.sender, returnedData);
}
| 29,428 |
44 | // Refund the bounty amount and fees to ambassador | bountyRefund = bounty.amount.add(bountyFee);
| bountyRefund = bounty.amount.add(bountyFee);
| 51,491 |
91 | // update the pool size of the next epoch to its current balance | Pool storage pNextEpoch = poolSize[tokenAddress][currentEpoch + 1];
pNextEpoch.size = stakedSwapp;
pNextEpoch.set = true;
Checkpoint[] storage checkpoints = balanceCheckpoints[msg.sender][tokenAddress];
uint256 last = checkpoints.length - 1;
| Pool storage pNextEpoch = poolSize[tokenAddress][currentEpoch + 1];
pNextEpoch.size = stakedSwapp;
pNextEpoch.set = true;
Checkpoint[] storage checkpoints = balanceCheckpoints[msg.sender][tokenAddress];
uint256 last = checkpoints.length - 1;
| 37,604 |
41 | // See {IERC721Metadata-symbol}. / | function symbol() public view virtual override returns (string memory) {
return ERC721AStorage.layout()._symbol;
}
| function symbol() public view virtual override returns (string memory) {
return ERC721AStorage.layout()._symbol;
}
| 4,518 |
259 | // Constructor | constructor() ERC721A("Vindico Studios - TKTV Presale Mint Pass", "TKTV Presale Mint Pass") {}
// Free Mint - Functions
function freeMint(uint256 _mintAmount, bytes32[] memory _merkleTreeProof) public payable freeMintCompliance(_mintAmount, _merkleTreeProof) {
require(!paused, "MSG: The contract is paused");
require(freeMintActive == true, "MSG: free mint is not live yet");
_safeMint(msg.sender, _mintAmount);
for (uint256 i = 0; i < _mintAmount; i++) {
walletFreeMintBalance[msg.sender]++;
}
}
| constructor() ERC721A("Vindico Studios - TKTV Presale Mint Pass", "TKTV Presale Mint Pass") {}
// Free Mint - Functions
function freeMint(uint256 _mintAmount, bytes32[] memory _merkleTreeProof) public payable freeMintCompliance(_mintAmount, _merkleTreeProof) {
require(!paused, "MSG: The contract is paused");
require(freeMintActive == true, "MSG: free mint is not live yet");
_safeMint(msg.sender, _mintAmount);
for (uint256 i = 0; i < _mintAmount; i++) {
walletFreeMintBalance[msg.sender]++;
}
}
| 14,612 |
59 | // Change the richest user if this is the case... | if (playerScore[_newOwner] > playerScore[richestBuyer]) {
richestBuyer = _newOwner;
emit newRichest(_newOwner, playerScore[_newOwner], block.timestamp, block.number);
}
| if (playerScore[_newOwner] > playerScore[richestBuyer]) {
richestBuyer = _newOwner;
emit newRichest(_newOwner, playerScore[_newOwner], block.timestamp, block.number);
}
| 18,553 |
406 | // Validators |
function canFactoryPlay(uint256 _factory)
public
view
virtual
returns (bool);
|
function canFactoryPlay(uint256 _factory)
public
view
virtual
returns (bool);
| 30,681 |
29 | // TOKEN GENERATION EVENT | mapping (address => uint256) contribution;
mapping (address => uint256) presaleLimit;
mapping (address => bool) presaleContributor;
uint256 public constant tokenGenerationMin = 50 * 10**6 * 10**decimals;
uint256 public constant tokenGenerationMax = 150 * 10**6 * 10**decimals;
uint256 public presale_start_block;
uint256 public start_block;
uint256 public end_block;
| mapping (address => uint256) contribution;
mapping (address => uint256) presaleLimit;
mapping (address => bool) presaleContributor;
uint256 public constant tokenGenerationMin = 50 * 10**6 * 10**decimals;
uint256 public constant tokenGenerationMax = 150 * 10**6 * 10**decimals;
uint256 public presale_start_block;
uint256 public start_block;
uint256 public end_block;
| 1,555 |
2 | // The SILVER TOKEN! | MySecure public cake;
constructor(
MySecure _cake
| MySecure public cake;
constructor(
MySecure _cake
| 23,101 |
177 | // Internal pure function to determine whether a given execution is filterable and may be removed from the executions array. The offerer and the recipient must be the same address and the item type cannot indicate a native token transfer.execution The execution to check for filterability. return filterable A boolean indicating whether the execution in question can be filtered from the executions array. / | function _isFilterableExecution(Execution memory execution) internal pure returns (bool filterable) {
// Utilize assembly to efficiently determine if execution is filterable.
assembly {
// Retrieve the received item referenced by the execution.
let item := mload(execution)
// Determine whether the execution is filterable.
filterable :=
and(
// Determine if offerer and recipient are the same address.
eq(
// Retrieve the recipient's address from the received item.
mload(add(item, ReceivedItem_recipient_offset)),
// Retrieve the offerer's address from the execution.
mload(add(execution, Execution_offerer_offset))
),
// Determine if received item's item type is non-zero, thereby
// indicating that the execution does not involve native tokens.
iszero(iszero(mload(item)))
)
}
}
| function _isFilterableExecution(Execution memory execution) internal pure returns (bool filterable) {
// Utilize assembly to efficiently determine if execution is filterable.
assembly {
// Retrieve the received item referenced by the execution.
let item := mload(execution)
// Determine whether the execution is filterable.
filterable :=
and(
// Determine if offerer and recipient are the same address.
eq(
// Retrieve the recipient's address from the received item.
mload(add(item, ReceivedItem_recipient_offset)),
// Retrieve the offerer's address from the execution.
mload(add(execution, Execution_offerer_offset))
),
// Determine if received item's item type is non-zero, thereby
// indicating that the execution does not involve native tokens.
iszero(iszero(mload(item)))
)
}
}
| 16,951 |
427 | // Sanity check: router is sensible | require(args.invariantData.router != address(0), "#P:001");
| require(args.invariantData.router != address(0), "#P:001");
| 36,607 |
1 | // Set the minimumEthBalance of the contract to cover gas.Not eligible for relayed calls. / | function setMinEthBalance(uint256 amount) public onlyOwner {
_minEthBalance = amount;
}
| function setMinEthBalance(uint256 amount) public onlyOwner {
_minEthBalance = amount;
}
| 26,628 |
165 | // Set NFT Publicsale Per Address Limit | function setNFTPublicsalePerAddressLimit(uint256 _cost) public onlyOwner {
nftPublicsalePerAddressLimit = _cost;
}
| function setNFTPublicsalePerAddressLimit(uint256 _cost) public onlyOwner {
nftPublicsalePerAddressLimit = _cost;
}
| 48,757 |
15 | // Apply library functions to the data type. | using IterableMapping for ItMap;
IERC20 public votes;
PaiMaster public chef;
address public owner;
PaiBar public bar;
uint256 public lpPow;
uint256 public balancePow;
uint256 public stakePow;
bool public sqrtEnable;
| using IterableMapping for ItMap;
IERC20 public votes;
PaiMaster public chef;
address public owner;
PaiBar public bar;
uint256 public lpPow;
uint256 public balancePow;
uint256 public stakePow;
bool public sqrtEnable;
| 34,288 |
283 | // ETH Price | eth_price = (precise_price * PRECISE_PRICE_PRECISION) / getETHPricePrecise();
| eth_price = (precise_price * PRECISE_PRICE_PRECISION) / getETHPricePrecise();
| 30,162 |
20 | // approve allowances | function approve(address _spender, uint256 _value) when_no_eth returns (bool) {
Approval(msg.sender, _spender, _value);
accounts[msg.sender].allowanceOf[_spender] += _value;
return true;
}
| function approve(address _spender, uint256 _value) when_no_eth returns (bool) {
Approval(msg.sender, _spender, _value);
accounts[msg.sender].allowanceOf[_spender] += _value;
return true;
}
| 4,033 |
6 | // require (_collateralAsset != address(0)); add this to avoid violations | return vault.addCollateral(_collateralAsset, _amount, _index);
| return vault.addCollateral(_collateralAsset, _amount, _index);
| 44,971 |
12 | // Fully close a leveraged position. Optionally provide ETH (esp if cbETH depegged on Uni) | function close() external payable {
uint256 totalCompoundRepay = compound.borrowBalanceOf(msg.sender);
uint256 flashAmount = totalCompoundRepay;
if (0 < msg.value) {
weth.deposit{value: msg.value}();
unchecked {
flashAmount -= msg.value;
}
}
// if user can repay the loan entirely with Ether balance, they might as well use the UI
// instead of the contract
flashBorrow(
IERC20(address(weth)),
flashAmount,
totalCompoundRepay,
compound.collateralBalanceOf(msg.sender, address(cbETH)),
0
);
returnETH();
returnCBETH();
}
| function close() external payable {
uint256 totalCompoundRepay = compound.borrowBalanceOf(msg.sender);
uint256 flashAmount = totalCompoundRepay;
if (0 < msg.value) {
weth.deposit{value: msg.value}();
unchecked {
flashAmount -= msg.value;
}
}
// if user can repay the loan entirely with Ether balance, they might as well use the UI
// instead of the contract
flashBorrow(
IERC20(address(weth)),
flashAmount,
totalCompoundRepay,
compound.collateralBalanceOf(msg.sender, address(cbETH)),
0
);
returnETH();
returnCBETH();
}
| 15,774 |
8 | // ========== MODIFIERS ========== / | modifier onlyTradingBotRegistry() {
require(msg.sender == tradingBotRegistry, "TradingBots: Only the TradingBotRegistry contract can call this function.");
_;
}
| modifier onlyTradingBotRegistry() {
require(msg.sender == tradingBotRegistry, "TradingBots: Only the TradingBotRegistry contract can call this function.");
_;
}
| 712 |
4 | // Mapping for users, event id and amount of tickets purchased | mapping(address => mapping(uint256 => uint256)) public ticketsPurchased;
| mapping(address => mapping(uint256 => uint256)) public ticketsPurchased;
| 45,686 |
2,620 | // 1311 | entry "unclayed" : ENG_ADJECTIVE
| entry "unclayed" : ENG_ADJECTIVE
| 17,923 |
40 | // Removes a permission from the list of permissions that a user has._methodsignature Signature of the method that this permission controls./ | function removeUserPermission(address _who, bytes4 _methodsignature) public onlyValidator {
require(permissions[_methodsignature].active, "Permission being removed must be for a valid method signature");
userPermissions[_who][_methodsignature] = false;
}
| function removeUserPermission(address _who, bytes4 _methodsignature) public onlyValidator {
require(permissions[_methodsignature].active, "Permission being removed must be for a valid method signature");
userPermissions[_who][_methodsignature] = false;
}
| 33,293 |
22 | // return true if voter has already registered for the election given | function isVoterRegistered(address _address,uint _electionID) public view returns(bool isRegistered){
for(uint i=0;i<Elections[_electionID].voterCount;i++){
if(Elections[_electionID].Election_Voters[i].voterAddress == _address){
return true;
}
}
return false;
}
| function isVoterRegistered(address _address,uint _electionID) public view returns(bool isRegistered){
for(uint i=0;i<Elections[_electionID].voterCount;i++){
if(Elections[_electionID].Election_Voters[i].voterAddress == _address){
return true;
}
}
return false;
}
| 23,202 |
1 | // Check if Positive EV TX @ UNI | uint256 estimatedETH = getEstimatedETHForTokenAtSUSHI(_tokenAmountToBuy, _pathOut)[1];
if(_enforcePositiveEV){
| uint256 estimatedETH = getEstimatedETHForTokenAtSUSHI(_tokenAmountToBuy, _pathOut)[1];
if(_enforcePositiveEV){
| 9,718 |
79 | // Internal utility function to cast uint types to addressto dedupe the need for multiple implementations of`_removeFromEnumeration`.fnIn The fn with uint input. return fnOut The fn with address input. / | function _asAddressArray(function(uint256, uint256[] storage) internal fnIn)
| function _asAddressArray(function(uint256, uint256[] storage) internal fnIn)
| 9,983 |
107 | // emit instant sell event | emit InstantSell(nftContractAddress, nftId, saleAmountReceived);
| emit InstantSell(nftContractAddress, nftId, saleAmountReceived);
| 31,893 |
31 | // If too much time elapsed, return the max reward | uint256 adjustedTime = subtract(timeElapsed, defaultDelayBetweenCalls);
uint256 maxPossibleReward = minimum(maxUpdateCallerReward, treasuryAllowance() / RAY);
| uint256 adjustedTime = subtract(timeElapsed, defaultDelayBetweenCalls);
uint256 maxPossibleReward = minimum(maxUpdateCallerReward, treasuryAllowance() / RAY);
| 334 |
189 | // HomeFeeManagerMultiAMBErc20ToErc677Implements the logic to distribute fees from the multi erc20 to erc677 mediator contract operations. The fees are distributed in the form of native tokens to the list of reward accounts./ | contract HomeFeeManagerMultiAMBErc20ToErc677 is BaseRewardAddressList, Ownable, BasicMultiTokenBridge {
using SafeMath for uint256;
event FeeUpdated(bytes32 feeType, address indexed token, uint256 fee);
event FeeDistributed(uint256 fee, address indexed token, bytes32 indexed messageId);
// This is not a real fee value but a relative value used to calculate the fee percentage
uint256 internal constant MAX_FEE = 1 ether;
bytes32 public constant HOME_TO_FOREIGN_FEE = 0x741ede137d0537e88e0ea0ff25b1f22d837903dbbee8980b4a06e8523247ee26; // keccak256(abi.encodePacked("homeToForeignFee"))
bytes32 public constant FOREIGN_TO_HOME_FEE = 0x03be2b2875cb41e0e77355e802a16769bb8dfcf825061cde185c73bf94f12625; // keccak256(abi.encodePacked("foreignToHomeFee"))
/**
* @dev Throws if given fee percentage is >= 100%.
*/
modifier validFee(uint256 _fee) {
require(_fee < MAX_FEE);
/* solcov ignore next */
_;
}
/**
* @dev Throws if given fee type is unknown.
*/
modifier validFeeType(bytes32 _feeType) {
require(_feeType == HOME_TO_FOREIGN_FEE || _feeType == FOREIGN_TO_HOME_FEE);
/* solcov ignore next */
_;
}
/**
* @dev Adds a new reward address to the list, which will receive fees collected from the bridge operations.
* Only the owner can call this method.
* @param _addr new reward account.
*/
function addRewardAddress(address _addr) external onlyOwner {
_addRewardAddress(_addr);
}
/**
* @dev Removes a reward address from the rewards list.
* Only the owner can call this method.
* @param _addr old reward account, that should be removed.
*/
function removeRewardAddress(address _addr) external onlyOwner {
_removeRewardAddress(_addr);
}
/**
* @dev Updates the value for the particular fee type.
* Only the owner can call this method.
* @param _feeType type of the updated fee, can be one of [HOME_TO_FOREIGN_FEE, FOREIGN_TO_HOME_FEE].
* @param _token address of the token contract for which fee should apply, 0x00..00 describes the initial fee for newly created tokens.
* @param _fee new fee value, in percentage (1 ether == 10**18 == 100%).
*/
function setFee(bytes32 _feeType, address _token, uint256 _fee) external onlyOwner {
_setFee(_feeType, _token, _fee);
}
/**
* @dev Retrieves the value for the particular fee type.
* @param _feeType type of the updated fee, can be one of [HOME_TO_FOREIGN_FEE, FOREIGN_TO_HOME_FEE].
* @param _token address of the token contract for which fee should apply, 0x00..00 describes the initial fee for newly created tokens.
* @return fee value associated with the requested fee type.
*/
function getFee(bytes32 _feeType, address _token) public view validFeeType(_feeType) returns (uint256) {
return uintStorage[keccak256(abi.encodePacked(_feeType, _token))];
}
/**
* @dev Calculates the amount of fee to pay for the value of the particular fee type.
* @param _feeType type of the updated fee, can be one of [HOME_TO_FOREIGN_FEE, FOREIGN_TO_HOME_FEE].
* @param _token address of the token contract for which fee should apply, 0x00..00 describes the initial fee for newly created tokens.
* @param _value bridged value, for which fee should be evaluated.
* @return amount of fee to be subtracted from the transferred value.
*/
function calculateFee(bytes32 _feeType, address _token, uint256 _value) public view returns (uint256) {
uint256 _fee = getFee(_feeType, _token);
return _value.mul(_fee).div(MAX_FEE);
}
/**
* @dev Internal function for updating the fee value for the given fee type.
* @param _feeType type of the updated fee, can be one of [HOME_TO_FOREIGN_FEE, FOREIGN_TO_HOME_FEE].
* @param _token address of the token contract for which fee should apply, 0x00..00 describes the initial fee for newly created tokens.
* @param _fee new fee value, in percentage (1 ether == 10**18 == 100%).
*/
function _setFee(bytes32 _feeType, address _token, uint256 _fee) internal validFeeType(_feeType) validFee(_fee) {
require(isTokenRegistered(_token));
uintStorage[keccak256(abi.encodePacked(_feeType, _token))] = _fee;
emit FeeUpdated(_feeType, _token, _fee);
}
/**
* @dev Calculates a random number based on the block number.
* @param _count the max value for the random number.
* @return a number between 0 and _count.
*/
function random(uint256 _count) internal view returns (uint256) {
return uint256(blockhash(block.number.sub(1))) % _count;
}
/**
* @dev Calculates and distributes the amount of fee proportionally between registered reward addresses.
* @param _feeType type of the updated fee, can be one of [HOME_TO_FOREIGN_FEE, FOREIGN_TO_HOME_FEE].
* @param _token address of the token contract for which fee should apply, 0x00..00 describes the initial fee for newly created tokens.
* @param _value bridged value, for which fee should be evaluated.
* @return total amount of fee subtracted from the transferred value and distributed between the reward accounts.
*/
function _distributeFee(bytes32 _feeType, address _token, uint256 _value) internal returns (uint256) {
uint256 numOfAccounts = rewardAddressCount();
uint256 _fee = calculateFee(_feeType, _token, _value);
if (numOfAccounts == 0 || _fee == 0) {
return 0;
}
uint256 feePerAccount = _fee.div(numOfAccounts);
uint256 randomAccountIndex;
uint256 diff = _fee.sub(feePerAccount.mul(numOfAccounts));
if (diff > 0) {
randomAccountIndex = random(numOfAccounts);
}
address nextAddr = getNextRewardAddress(F_ADDR);
require(nextAddr != F_ADDR && nextAddr != address(0));
uint256 i = 0;
while (nextAddr != F_ADDR) {
uint256 feeToDistribute = feePerAccount;
if (diff > 0 && randomAccountIndex == i) {
feeToDistribute = feeToDistribute.add(diff);
}
if (_feeType == HOME_TO_FOREIGN_FEE) {
ERC677(_token).transfer(nextAddr, feeToDistribute);
} else {
IBurnableMintableERC677Token(_token).mint(nextAddr, feeToDistribute);
}
nextAddr = getNextRewardAddress(nextAddr);
require(nextAddr != address(0));
i = i + 1;
}
return _fee;
}
}
| contract HomeFeeManagerMultiAMBErc20ToErc677 is BaseRewardAddressList, Ownable, BasicMultiTokenBridge {
using SafeMath for uint256;
event FeeUpdated(bytes32 feeType, address indexed token, uint256 fee);
event FeeDistributed(uint256 fee, address indexed token, bytes32 indexed messageId);
// This is not a real fee value but a relative value used to calculate the fee percentage
uint256 internal constant MAX_FEE = 1 ether;
bytes32 public constant HOME_TO_FOREIGN_FEE = 0x741ede137d0537e88e0ea0ff25b1f22d837903dbbee8980b4a06e8523247ee26; // keccak256(abi.encodePacked("homeToForeignFee"))
bytes32 public constant FOREIGN_TO_HOME_FEE = 0x03be2b2875cb41e0e77355e802a16769bb8dfcf825061cde185c73bf94f12625; // keccak256(abi.encodePacked("foreignToHomeFee"))
/**
* @dev Throws if given fee percentage is >= 100%.
*/
modifier validFee(uint256 _fee) {
require(_fee < MAX_FEE);
/* solcov ignore next */
_;
}
/**
* @dev Throws if given fee type is unknown.
*/
modifier validFeeType(bytes32 _feeType) {
require(_feeType == HOME_TO_FOREIGN_FEE || _feeType == FOREIGN_TO_HOME_FEE);
/* solcov ignore next */
_;
}
/**
* @dev Adds a new reward address to the list, which will receive fees collected from the bridge operations.
* Only the owner can call this method.
* @param _addr new reward account.
*/
function addRewardAddress(address _addr) external onlyOwner {
_addRewardAddress(_addr);
}
/**
* @dev Removes a reward address from the rewards list.
* Only the owner can call this method.
* @param _addr old reward account, that should be removed.
*/
function removeRewardAddress(address _addr) external onlyOwner {
_removeRewardAddress(_addr);
}
/**
* @dev Updates the value for the particular fee type.
* Only the owner can call this method.
* @param _feeType type of the updated fee, can be one of [HOME_TO_FOREIGN_FEE, FOREIGN_TO_HOME_FEE].
* @param _token address of the token contract for which fee should apply, 0x00..00 describes the initial fee for newly created tokens.
* @param _fee new fee value, in percentage (1 ether == 10**18 == 100%).
*/
function setFee(bytes32 _feeType, address _token, uint256 _fee) external onlyOwner {
_setFee(_feeType, _token, _fee);
}
/**
* @dev Retrieves the value for the particular fee type.
* @param _feeType type of the updated fee, can be one of [HOME_TO_FOREIGN_FEE, FOREIGN_TO_HOME_FEE].
* @param _token address of the token contract for which fee should apply, 0x00..00 describes the initial fee for newly created tokens.
* @return fee value associated with the requested fee type.
*/
function getFee(bytes32 _feeType, address _token) public view validFeeType(_feeType) returns (uint256) {
return uintStorage[keccak256(abi.encodePacked(_feeType, _token))];
}
/**
* @dev Calculates the amount of fee to pay for the value of the particular fee type.
* @param _feeType type of the updated fee, can be one of [HOME_TO_FOREIGN_FEE, FOREIGN_TO_HOME_FEE].
* @param _token address of the token contract for which fee should apply, 0x00..00 describes the initial fee for newly created tokens.
* @param _value bridged value, for which fee should be evaluated.
* @return amount of fee to be subtracted from the transferred value.
*/
function calculateFee(bytes32 _feeType, address _token, uint256 _value) public view returns (uint256) {
uint256 _fee = getFee(_feeType, _token);
return _value.mul(_fee).div(MAX_FEE);
}
/**
* @dev Internal function for updating the fee value for the given fee type.
* @param _feeType type of the updated fee, can be one of [HOME_TO_FOREIGN_FEE, FOREIGN_TO_HOME_FEE].
* @param _token address of the token contract for which fee should apply, 0x00..00 describes the initial fee for newly created tokens.
* @param _fee new fee value, in percentage (1 ether == 10**18 == 100%).
*/
function _setFee(bytes32 _feeType, address _token, uint256 _fee) internal validFeeType(_feeType) validFee(_fee) {
require(isTokenRegistered(_token));
uintStorage[keccak256(abi.encodePacked(_feeType, _token))] = _fee;
emit FeeUpdated(_feeType, _token, _fee);
}
/**
* @dev Calculates a random number based on the block number.
* @param _count the max value for the random number.
* @return a number between 0 and _count.
*/
function random(uint256 _count) internal view returns (uint256) {
return uint256(blockhash(block.number.sub(1))) % _count;
}
/**
* @dev Calculates and distributes the amount of fee proportionally between registered reward addresses.
* @param _feeType type of the updated fee, can be one of [HOME_TO_FOREIGN_FEE, FOREIGN_TO_HOME_FEE].
* @param _token address of the token contract for which fee should apply, 0x00..00 describes the initial fee for newly created tokens.
* @param _value bridged value, for which fee should be evaluated.
* @return total amount of fee subtracted from the transferred value and distributed between the reward accounts.
*/
function _distributeFee(bytes32 _feeType, address _token, uint256 _value) internal returns (uint256) {
uint256 numOfAccounts = rewardAddressCount();
uint256 _fee = calculateFee(_feeType, _token, _value);
if (numOfAccounts == 0 || _fee == 0) {
return 0;
}
uint256 feePerAccount = _fee.div(numOfAccounts);
uint256 randomAccountIndex;
uint256 diff = _fee.sub(feePerAccount.mul(numOfAccounts));
if (diff > 0) {
randomAccountIndex = random(numOfAccounts);
}
address nextAddr = getNextRewardAddress(F_ADDR);
require(nextAddr != F_ADDR && nextAddr != address(0));
uint256 i = 0;
while (nextAddr != F_ADDR) {
uint256 feeToDistribute = feePerAccount;
if (diff > 0 && randomAccountIndex == i) {
feeToDistribute = feeToDistribute.add(diff);
}
if (_feeType == HOME_TO_FOREIGN_FEE) {
ERC677(_token).transfer(nextAddr, feeToDistribute);
} else {
IBurnableMintableERC677Token(_token).mint(nextAddr, feeToDistribute);
}
nextAddr = getNextRewardAddress(nextAddr);
require(nextAddr != address(0));
i = i + 1;
}
return _fee;
}
}
| 51,544 |
13 | // Get configuration parameters/ getBaseStakeAmountForPlay | function getBaseStakeAmountForPlay() external view returns (uint256) {
return _baseStakeAmountForPlay;
}
| function getBaseStakeAmountForPlay() external view returns (uint256) {
return _baseStakeAmountForPlay;
}
| 31,778 |
80 | // Accounting updates | member.iTW += earningsToUser;
member.iTB -= earningsToUser;
totalDeposits -= earningsToUser;
unsafeInternalTransfer(GUILD, memberAddress, address(wETH), earningsToUser);
emit WithdrawEarnings(msg.sender, address(wETH), earningsToUser, depositToken);
| member.iTW += earningsToUser;
member.iTB -= earningsToUser;
totalDeposits -= earningsToUser;
unsafeInternalTransfer(GUILD, memberAddress, address(wETH), earningsToUser);
emit WithdrawEarnings(msg.sender, address(wETH), earningsToUser, depositToken);
| 19,151 |
527 | // Get unsigned hash for revocation_policyId Policy id_node Node that will be excluded return Revocation hash, EIP191 version 0x45 ('E')/ | function getRevocationHash(bytes16 _policyId, address _node) public view returns (bytes32) {
| function getRevocationHash(bytes16 _policyId, address _node) public view returns (bytes32) {
| 50,228 |
21 | // Public mapping that maps an Ethereum address to a BotInfo struct for each user | mapping(address => BotInfo) public botInfo;
| mapping(address => BotInfo) public botInfo;
| 31,478 |
7 | // Lets users gift airdrop to another non-contract address / | function gift(address recipient) external returns (bool) {
require(Address.isContract(msg.sender) == false, 'sender must not be a contract');
require(Address.isContract(recipient) == false, 'recipient must not be a contract');
IBEP20 bep20 = IBEP20(_token);
uint256 balance = bep20.balanceOf(address(this));
require(balance >= _claimAmount, 'airdrop has insufficient balance');
require(_beneficiaries[recipient] == false, 'address already claimed airdrop');
_beneficiaries[recipient] = true;
bool success = bep20.transfer(recipient, _claimAmount);
require(success, 'transfer failed');
emit Gift(msg.sender, recipient, _claimAmount);
return true;
}
| function gift(address recipient) external returns (bool) {
require(Address.isContract(msg.sender) == false, 'sender must not be a contract');
require(Address.isContract(recipient) == false, 'recipient must not be a contract');
IBEP20 bep20 = IBEP20(_token);
uint256 balance = bep20.balanceOf(address(this));
require(balance >= _claimAmount, 'airdrop has insufficient balance');
require(_beneficiaries[recipient] == false, 'address already claimed airdrop');
_beneficiaries[recipient] = true;
bool success = bep20.transfer(recipient, _claimAmount);
require(success, 'transfer failed');
emit Gift(msg.sender, recipient, _claimAmount);
return true;
}
| 20,775 |
5 | // See {ERC721Pausable} and {Pausable-_pause}. Requirements: - the caller must have the `PAUSER_ROLE`. / | function pause() public virtual {
require(hasRole(PAUSER_ROLE, _msgSender()), "ERC721PresetMinterPauserAutoId: must have pauser role to pause");
_pause();
}
| function pause() public virtual {
require(hasRole(PAUSER_ROLE, _msgSender()), "ERC721PresetMinterPauserAutoId: must have pauser role to pause");
_pause();
}
| 33,496 |
92 | // Update total amount of tokens issued | totalTokenIssued = totalTokenIssued.add(tokens);
emit Transfer(address(MAINSALE_EVENT), buyer, tokens);
return true;
| totalTokenIssued = totalTokenIssued.add(tokens);
emit Transfer(address(MAINSALE_EVENT), buyer, tokens);
return true;
| 14,773 |
42 | // if someone wants to transfer tokens to other account. | function transferTokens(address _to, uint256 _tokens) lockTokenTransferBeforeStage4 TeamTransferConditions(_tokens, msg.sender) public {
_transfer(msg.sender, _to, _tokens);
}
| function transferTokens(address _to, uint256 _tokens) lockTokenTransferBeforeStage4 TeamTransferConditions(_tokens, msg.sender) public {
_transfer(msg.sender, _to, _tokens);
}
| 33,527 |
8 | // PausableAssets Handles assets pause and unpause of Wombat protocol. Allows pausing and unpausing of deposit and swap operations / | contract PausableAssets {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event PausedAsset(address token, address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event UnpausedAsset(address token, address account);
// We use the asset's underlying token as the key to check whether an asset is paused.
// A pool will never have two assets with the same underlying token.
mapping(address => bool) private _pausedAssets;
error WOMBAT_ASSET_ALREADY_PAUSED();
error WOMBAT_ASSET_NOT_PAUSED();
/**
* @dev Function to return if the asset is paused.
* The return value is only useful when true.
* When the return value is false, the asset can be either not paused or not exist.
*/
function isPaused(address token) public view returns (bool) {
return _pausedAssets[token];
}
/**
* @dev Function to make a function callable only when the asset is not paused.
*
* Requirements:
*
* - The asset must not be paused.
*/
function requireAssetNotPaused(address token) internal view {
if (_pausedAssets[token]) revert WOMBAT_ASSET_ALREADY_PAUSED();
}
/**
* @dev Function to make a function callable only when the asset is paused.
*
* Requirements:
*
* - The asset must be paused.
*/
function requireAssetPaused(address token) internal view {
if (!_pausedAssets[token]) revert WOMBAT_ASSET_NOT_PAUSED();
}
/**
* @dev Triggers paused state.
*
* Requirements:
*
* - The asset must not be paused.
*/
function _pauseAsset(address token) internal {
requireAssetNotPaused(token);
_pausedAssets[token] = true;
emit PausedAsset(token, msg.sender);
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The asset must be paused.
*/
function _unpauseAsset(address token) internal {
requireAssetPaused(token);
_pausedAssets[token] = false;
emit UnpausedAsset(token, msg.sender);
}
}
| contract PausableAssets {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event PausedAsset(address token, address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event UnpausedAsset(address token, address account);
// We use the asset's underlying token as the key to check whether an asset is paused.
// A pool will never have two assets with the same underlying token.
mapping(address => bool) private _pausedAssets;
error WOMBAT_ASSET_ALREADY_PAUSED();
error WOMBAT_ASSET_NOT_PAUSED();
/**
* @dev Function to return if the asset is paused.
* The return value is only useful when true.
* When the return value is false, the asset can be either not paused or not exist.
*/
function isPaused(address token) public view returns (bool) {
return _pausedAssets[token];
}
/**
* @dev Function to make a function callable only when the asset is not paused.
*
* Requirements:
*
* - The asset must not be paused.
*/
function requireAssetNotPaused(address token) internal view {
if (_pausedAssets[token]) revert WOMBAT_ASSET_ALREADY_PAUSED();
}
/**
* @dev Function to make a function callable only when the asset is paused.
*
* Requirements:
*
* - The asset must be paused.
*/
function requireAssetPaused(address token) internal view {
if (!_pausedAssets[token]) revert WOMBAT_ASSET_NOT_PAUSED();
}
/**
* @dev Triggers paused state.
*
* Requirements:
*
* - The asset must not be paused.
*/
function _pauseAsset(address token) internal {
requireAssetNotPaused(token);
_pausedAssets[token] = true;
emit PausedAsset(token, msg.sender);
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The asset must be paused.
*/
function _unpauseAsset(address token) internal {
requireAssetPaused(token);
_pausedAssets[token] = false;
emit UnpausedAsset(token, msg.sender);
}
}
| 30,275 |
7 | // Get the incentives rate per year (ie 0.0010 AAVE rewarder per USDC locked for 1 year)return the reward rate / | function getRewardRate() external view returns (uint256) {
(address rewardContract, address rewardToken) = getIncentivesAddresses();
return _getRewardRate(rewardContract, rewardToken);
}
| function getRewardRate() external view returns (uint256) {
(address rewardContract, address rewardToken) = getIncentivesAddresses();
return _getRewardRate(rewardContract, rewardToken);
}
| 10,703 |
7 | // Contract constructor _tokenFullName token full name _tokenTicker token ticker name _burnAddress address where tokens to be burned should be stored _tokensPerBlock how many tokens are issued every block / | constructor(
string memory _tokenFullName,
string memory _tokenTicker,
address _burnAddress,
uint _tokensPerBlock,
address _toMint
| constructor(
string memory _tokenFullName,
string memory _tokenTicker,
address _burnAddress,
uint _tokensPerBlock,
address _toMint
| 32,469 |
2 | // / | function createMultiSigVault(
string memory name,
address[] memory owners,
uint256 confirmationsRequired
| function createMultiSigVault(
string memory name,
address[] memory owners,
uint256 confirmationsRequired
| 32,776 |
85 | // gasAmount => 120000 ( OK ) , 110000 ( Fail ) | _unirouter.swapExactETHForTokens.value(eth_amount).gas(gasAmount)(0, _pair_weth_artt, contract_addr, deadline);
| _unirouter.swapExactETHForTokens.value(eth_amount).gas(gasAmount)(0, _pair_weth_artt, contract_addr, deadline);
| 14,348 |
98 | // We need to swap the current tokens to ETH and send to the charity wallet | swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToCharity(address(this).balance);
}
| swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToCharity(address(this).balance);
}
| 9,799 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.