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
65
// Burn LP tokens to remove liquidity from the pool. Liquidity can always be removed, even when the pool is paused. self Swap struct to read from and write to amount the amount of LP tokens to burn minAmounts the minimum amounts of each token in the poolacceptable for this burn. Useful as a front-running mitigationreturn amounts of tokens the user received /
function removeLiquidity( Swap storage self, uint256 amount, uint256[] calldata minAmounts
function removeLiquidity( Swap storage self, uint256 amount, uint256[] calldata minAmounts
11,608
73
// This will loop through all the recipients and send them the specified tokens
_transfer(owner, recipients, tokenAmount); totalSoldToPublic = totalSoldToPublic.add(tokenAmount);
_transfer(owner, recipients, tokenAmount); totalSoldToPublic = totalSoldToPublic.add(tokenAmount);
8,377
12
// and the proposal has not been commited to
require(commitment[_propID] == Proposal("", "", address(0), 0));
require(commitment[_propID] == Proposal("", "", address(0), 0));
12,158
79
// for Ether
uint256 totalBalance = address(this).balance; uint256 balance = _balance == 0 ? totalBalance : Math.min(totalBalance, _balance); _to.transfer(balance);
uint256 totalBalance = address(this).balance; uint256 balance = _balance == 0 ? totalBalance : Math.min(totalBalance, _balance); _to.transfer(balance);
16,985
72
// cancel long term swap, pay out unsold tokens and well as purchased tokens
function cancelLongTermSwap(LongTermOrders storage longTermOrders, uint256 orderId) internal returns (address sellToken, uint256 unsoldAmount, address buyToken, uint256 purchasedAmount) { // make sure to update virtual order state (before calling this function) Order storage order = longTermOrders.orderMap[orderId]; buyToken = order.buyTokenAddr; sellToken = order.sellTokenAddr; OrderPool storage orderPool = getOrderPool(longTermOrders, sellToken); (unsoldAmount, purchasedAmount) = orderPoolCancelOrder(orderPool, orderId, longTermOrders.lastVirtualOrderTimestamp); require(order.owner == msg.sender && (unsoldAmount > 0 || purchasedAmount > 0)); // owner and amounts check }
function cancelLongTermSwap(LongTermOrders storage longTermOrders, uint256 orderId) internal returns (address sellToken, uint256 unsoldAmount, address buyToken, uint256 purchasedAmount) { // make sure to update virtual order state (before calling this function) Order storage order = longTermOrders.orderMap[orderId]; buyToken = order.buyTokenAddr; sellToken = order.sellTokenAddr; OrderPool storage orderPool = getOrderPool(longTermOrders, sellToken); (unsoldAmount, purchasedAmount) = orderPoolCancelOrder(orderPool, orderId, longTermOrders.lastVirtualOrderTimestamp); require(order.owner == msg.sender && (unsoldAmount > 0 || purchasedAmount > 0)); // owner and amounts check }
44,704
12
// Method to query current balance of NOTE in the treasury return treasuryNoteBalance the note balance/
function queryNoteBalance() external view override returns (uint) { uint treasuryNoteBalance = note.balanceOf(address(this)); return treasuryNoteBalance; }
function queryNoteBalance() external view override returns (uint) { uint treasuryNoteBalance = note.balanceOf(address(this)); return treasuryNoteBalance; }
4,384
179
// Deposit LP tokens to MasterChef for MM allocation.
function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user .amount .mul(pool.accMMPerShare) .div(1e12) .sub(user.rewardDebt); safeMMTransfer(msg.sender, pending); } pool.lpToken.safeTransferFrom( address(msg.sender), address(this), _amount ); user.amount = user.amount.add(_amount); pool.amount = pool.amount.add(_amount); user.rewardDebt = user.amount.mul(pool.accMMPerShare).div(1e12); emit Deposit(msg.sender, _pid, _amount); }
function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user .amount .mul(pool.accMMPerShare) .div(1e12) .sub(user.rewardDebt); safeMMTransfer(msg.sender, pending); } pool.lpToken.safeTransferFrom( address(msg.sender), address(this), _amount ); user.amount = user.amount.add(_amount); pool.amount = pool.amount.add(_amount); user.rewardDebt = user.amount.mul(pool.accMMPerShare).div(1e12); emit Deposit(msg.sender, _pid, _amount); }
16,246
99
// Overflow check for the balances addition from the above check. This overflow should never happen if the token.transfer function is implemented correctly. We do not control the token implementation, therefore we add this check for safety.
require(data1.total_withdraw <= data1.total_withdraw + data2.total_withdraw, "TN/coopSettle: overflow"); if (data1.total_withdraw > 0) { this.setTotalWithdraw2( channel_identifier, data1 ); }
require(data1.total_withdraw <= data1.total_withdraw + data2.total_withdraw, "TN/coopSettle: overflow"); if (data1.total_withdraw > 0) { this.setTotalWithdraw2( channel_identifier, data1 ); }
23,627
2
// Emitted when positions are successfully merged.
event PositionsMerge( address indexed stakeholder, IERC20 collateralToken, bytes32 indexed parentCollectionId, bytes32 indexed conditionId, uint[] partition, uint amount ); event PayoutRedemption( address indexed redeemer,
event PositionsMerge( address indexed stakeholder, IERC20 collateralToken, bytes32 indexed parentCollectionId, bytes32 indexed conditionId, uint[] partition, uint amount ); event PayoutRedemption( address indexed redeemer,
23,760
8
// Claim all JOE/AVAXaccrued by the holders rewardType0 = JOE, 1 = AVAX holders The addresses to claim JOE/AVAX for cTokens The list of markets to claim JOE/AVAX in borrowers Whether or not to claim JOE/AVAX earned by borrowing suppliers Whether or not to claim JOE/AVAX earned by supplying /
function claimReward(
function claimReward(
33,013
35
// Admin Functions //Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.newPendingAdmin New pending admin. return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/
function _setPendingAdmin(address payable newPendingAdmin) override external returns (uint) { bytes memory data = delegateToImplementation(abi.encodeWithSignature("_setPendingAdmin(address)", newPendingAdmin)); return abi.decode(data, (uint)); }
function _setPendingAdmin(address payable newPendingAdmin) override external returns (uint) { bytes memory data = delegateToImplementation(abi.encodeWithSignature("_setPendingAdmin(address)", newPendingAdmin)); return abi.decode(data, (uint)); }
3,473
58
// contributor/
function getAddresses() public onlyOwner view returns (address[] ) { return addresses; }
function getAddresses() public onlyOwner view returns (address[] ) { return addresses; }
21,978
9
// address public bestBidContract;
bool public locked = false; mapping(uint256 => BBOffer) public offers; mapping(bytes32 => BBBid) public offerBids; constructor(uint256 startOfferId/* , address _bestBidContract */)
bool public locked = false; mapping(uint256 => BBOffer) public offers; mapping(bytes32 => BBBid) public offerBids; constructor(uint256 startOfferId/* , address _bestBidContract */)
23,389
75
// purchase call option l storage layout struct account recipient of purchased option maturity timestamp of option maturity strike64x64 64x64 fixed point representation of strike price isCall true for call, false for put contractSize size of option contract newPrice64x64 64x64 fixed point representation of current spot pricereturn baseCost quantity of tokens required to purchase long positionreturn feeCost quantity of tokens required to pay fees /
function _purchase( PoolStorage.Layout storage l, address account, uint64 maturity, int128 strike64x64, bool isCall, uint256 contractSize, int128 newPrice64x64
function _purchase( PoolStorage.Layout storage l, address account, uint64 maturity, int128 strike64x64, bool isCall, uint256 contractSize, int128 newPrice64x64
34,946
121
// //Unstake xSUSHI `amount` from BENTO into SUSHI for benefit of `to` by batching calls to `bento` and `sushiBar`.
function unstakeSushiFromBento(address to, uint256 amount) external { bento.withdraw(IERC20(sushiBar), msg.sender, address(this), amount, 0); // withdraw `amount` of xSUSHI from BENTO into this contract ISushiBarBridge(sushiBar).leave(amount); // burn withdrawn xSUSHI from `sushiBar` into SUSHI sushiToken.safeTransfer(to, balanceOfOptimized(address(sushiToken))); // transfer resulting SUSHI to `to` }
function unstakeSushiFromBento(address to, uint256 amount) external { bento.withdraw(IERC20(sushiBar), msg.sender, address(this), amount, 0); // withdraw `amount` of xSUSHI from BENTO into this contract ISushiBarBridge(sushiBar).leave(amount); // burn withdrawn xSUSHI from `sushiBar` into SUSHI sushiToken.safeTransfer(to, balanceOfOptimized(address(sushiToken))); // transfer resulting SUSHI to `to` }
14,764
79
// Deposits tokens to be distributed in the current week. A version of `depositToken` which supports depositing multiple `tokens` at once.See `depositToken` for more details. tokens - An array of ERC20 token addresses to distribute. amounts - An array of token amounts to deposit. /
function depositTokens(IERC20[] calldata tokens, uint256[] calldata amounts) external;
function depositTokens(IERC20[] calldata tokens, uint256[] calldata amounts) external;
32,013
10
// sum the current rarity values
uint256 highestRarityWeight = rarityData[1]; uint256 lowestRarityWeight = rarityData[rarityData.length - 1]; if (highestRarityWeight - lowestRarityWeight == 0) { for (uint256 i = 1; i < rarityData.length; i += 2) { appliedRaritySum += rarityData[i]; }
uint256 highestRarityWeight = rarityData[1]; uint256 lowestRarityWeight = rarityData[rarityData.length - 1]; if (highestRarityWeight - lowestRarityWeight == 0) { for (uint256 i = 1; i < rarityData.length; i += 2) { appliedRaritySum += rarityData[i]; }
19,515
39
// send
(bool tmpSuccess,) = payable(marketingFeeReceiver).call{value: amountETHMarketing}("");
(bool tmpSuccess,) = payable(marketingFeeReceiver).call{value: amountETHMarketing}("");
1,433
18
// Automatically give the marketplace approval to transfer VIRTUE to save the user gas fees spent on approval.
if (msg.sender == idolMarketAddress){ _transfer(sender, recipient, amount); return true; }
if (msg.sender == idolMarketAddress){ _transfer(sender, recipient, amount); return true; }
11,464
22
// DATA /
enum PropertyClass { DISTRICT, BUILDING, UNIT } /// @dev The main Property struct. Every property in Aether is represented /// by a variant of this structure. struct Property { uint32 parent; PropertyClass class; uint8 x; uint8 y; uint8 z; uint8 dx; uint8 dz; }
enum PropertyClass { DISTRICT, BUILDING, UNIT } /// @dev The main Property struct. Every property in Aether is represented /// by a variant of this structure. struct Property { uint32 parent; PropertyClass class; uint8 x; uint8 y; uint8 z; uint8 dx; uint8 dz; }
49,477
10
// Event fired when a role is revoked from a delegate/Event fired when a role is revoked from a delegate via `revokeRole`/role the role being revoked/delegate the delegate being revoked the given role/sender the owner who revoked the role from the given delegate
event RoleRevoked( bytes32 indexed role, address indexed delegate, address indexed sender );
event RoleRevoked( bytes32 indexed role, address indexed delegate, address indexed sender );
49,177
164
// payable fallback aka mint from eth to default /
receive() external payable { if (msg.sender != address(WETH_ADDRESS)) { require(votedPool != address(0), "No voted pool available"); require(msg.value > 0); mint(votedPool, votedPoolType, address(0), msg.value); } }
receive() external payable { if (msg.sender != address(WETH_ADDRESS)) { require(votedPool != address(0), "No voted pool available"); require(msg.value > 0); mint(votedPool, votedPoolType, address(0), msg.value); } }
10,406
19
// solhint-disable no-empty-blocks // Mint a chosen token id to a single recipient Unavailable for ERC721GeneralSequenceBase, keep interface adhered for backwards compatiblity /
function mintSpecificTokenToOneRecipient(address recipient, uint256 tokenId) external {} /** * @notice Mint chosen token ids to a single recipient * @dev Unavailable for ERC721GeneralSequenceBase, keep interface adhered for backwards compatiblity */ function mintSpecificTokensToOneRecipient(address recipient, uint256[] calldata tokenIds) external {} /* solhint-enable no-empty-blocks */ /** * @notice Override base URI system for select tokens, with custom per-token metadata * @param ids IDs of tokens to override base uri system for with custom uris * @param uris Custom uris */ function setTokenURIs(uint256[] calldata ids, string[] calldata uris) external nonReentrant { uint256 idsLength = ids.length; if (idsLength != uris.length) { _revert(MismatchedArrayLengths.selector); } for (uint256 i = 0; i < idsLength; i++) { _setTokenURI(ids[i], uris[i]); } emit TokenURIsSet(ids, uris); observability.emitTokenURIsSet(ids, uris); }
function mintSpecificTokenToOneRecipient(address recipient, uint256 tokenId) external {} /** * @notice Mint chosen token ids to a single recipient * @dev Unavailable for ERC721GeneralSequenceBase, keep interface adhered for backwards compatiblity */ function mintSpecificTokensToOneRecipient(address recipient, uint256[] calldata tokenIds) external {} /* solhint-enable no-empty-blocks */ /** * @notice Override base URI system for select tokens, with custom per-token metadata * @param ids IDs of tokens to override base uri system for with custom uris * @param uris Custom uris */ function setTokenURIs(uint256[] calldata ids, string[] calldata uris) external nonReentrant { uint256 idsLength = ids.length; if (idsLength != uris.length) { _revert(MismatchedArrayLengths.selector); } for (uint256 i = 0; i < idsLength; i++) { _setTokenURI(ids[i], uris[i]); } emit TokenURIsSet(ids, uris); observability.emitTokenURIsSet(ids, uris); }
45,086
115
// 0xb93152b59e65a6De8D3464061BcC1d68f6749F98ropsten
); IUniswapV2Router02 private UniswapV2Router02 = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D //mainnet
); IUniswapV2Router02 private UniswapV2Router02 = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D //mainnet
28,629
31
// IERC721(tokenAddress).transferFrom(address(this), msg.sender, tokenId);
NFTMarketplace nftMarketPlace = NFTMarketplace(tokenAddress); address nftAddress = address(nftMarketPlace.collectionAddress());// IERC721(nftAddress).approve(address(this), tokenId); IERC721(nftAddress).transferFrom(address(this), msg.sender, tokenId); lentERC721List[tokenAddress][tokenId].borrower = msg.sender; lentERC721List[tokenAddress][tokenId].borrowedAtTimestamp = block.timestamp;
NFTMarketplace nftMarketPlace = NFTMarketplace(tokenAddress); address nftAddress = address(nftMarketPlace.collectionAddress());// IERC721(nftAddress).approve(address(this), tokenId); IERC721(nftAddress).transferFrom(address(this), msg.sender, tokenId); lentERC721List[tokenAddress][tokenId].borrower = msg.sender; lentERC721List[tokenAddress][tokenId].borrowedAtTimestamp = block.timestamp;
19,602
352
// Helper to calculate an unaccounted for reward amount due to a user based on integral values
function __calcClaimableRewardForIntegralDiff( address _account, uint256 _totalHarvestIntegral, uint256 _userHarvestIntegral
function __calcClaimableRewardForIntegralDiff( address _account, uint256 _totalHarvestIntegral, uint256 _userHarvestIntegral
60,636
74
// this means user is canceling all plans
if(newPricePerSec == 0){ Plan memory newPlan; newPlan = Plan(uint64(now), uint64(-1), uint128(0)); plans[msg.sender].push(newPlan); balanceManager.changePrice(msg.sender, 0); emit PlanUpdate(msg.sender, _protocols, _coverAmounts, uint64(-1)); return; }
if(newPricePerSec == 0){ Plan memory newPlan; newPlan = Plan(uint64(now), uint64(-1), uint128(0)); plans[msg.sender].push(newPlan); balanceManager.changePrice(msg.sender, 0); emit PlanUpdate(msg.sender, _protocols, _coverAmounts, uint64(-1)); return; }
21,899
197
// Set the parameters
context.nTokenParameters = parameters;
context.nTokenParameters = parameters;
64,923
12
// Create new vesting schedules in a batchA transfer is used to bring tokens into the VestingDepositAccount so pre-approval is requiredbeneficiaries array of beneficiaries of the vested tokensamounts array of amount of tokens (in wei)array index of address should be the same as the array index of the amount/
function createVestingSchedules(address[] calldata beneficiaries, uint256[] calldata amounts) external onlyOwner returns (bool) { require(beneficiaries.length > 0, "Empty Data"); require(beneficiaries.length == amounts.length, "Array lengths do not match"); for (uint256 i = 0; i < beneficiaries.length; i = i.add(1)) { address beneficiary = beneficiaries[i]; uint256 amount = amounts[i]; _createVestingSchedule(beneficiary, amount); } return true; }
function createVestingSchedules(address[] calldata beneficiaries, uint256[] calldata amounts) external onlyOwner returns (bool) { require(beneficiaries.length > 0, "Empty Data"); require(beneficiaries.length == amounts.length, "Array lengths do not match"); for (uint256 i = 0; i < beneficiaries.length; i = i.add(1)) { address beneficiary = beneficiaries[i]; uint256 amount = amounts[i]; _createVestingSchedule(beneficiary, amount); } return true; }
41,076
20
// Checks whether the provided `seed` is used. Returns true if `seed` is used, otherwise - false. /
function isUsedSeed(uint256[] calldata seed) external view virtual returns (bool);
function isUsedSeed(uint256[] calldata seed) external view virtual returns (bool);
30,095
32
// return true if the transaction can buy tokens
function validPurchase() internal view returns (bool) { bool presalePeriod = now >= presaleStart && now <= presaleEnd; bool salePeriod = now >= saleStart && now <= saleEnd; bool nonZeroPurchase = msg.value != 0; return (presalePeriod || salePeriod) && nonZeroPurchase; }
function validPurchase() internal view returns (bool) { bool presalePeriod = now >= presaleStart && now <= presaleEnd; bool salePeriod = now >= saleStart && now <= saleEnd; bool nonZeroPurchase = msg.value != 0; return (presalePeriod || salePeriod) && nonZeroPurchase; }
23,717
38
// mapping for users with id => Status
mapping (uint256 => bool) private _TokenTransactionstatus;
mapping (uint256 => bool) private _TokenTransactionstatus;
48,217
6
// Ownable Similar to OpenZeppelin's Ownable.Differences:- An internally callable _changeOwner() function- No renounceOwnership() function- No constructor- No GSN support /
abstract contract Ownable { /** * @dev Owner's address. */ address internal _owner; /** * @notice Emitted when the owner changes. * @param previousOwner Previous owner's address * @param newOwner New owner's address */ event OwnerChanged(address indexed previousOwner, address indexed newOwner); /** * @notice Throw if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == msg.sender, "caller is not the owner"); _; } /** * @notice Return the address of the current owner. * @return Owner's address */ function owner() external view returns (address) { return _owner; } /** * @notice Change the owner. Can only be called by the current owner. * @param account New owner's address */ function changeOwner(address account) external onlyOwner { _changeOwner(account); } /** * @notice Internal function to change the owner. * @param account New owner's address */ function _changeOwner(address account) internal { require(account != address(0), "account is the zero address"); require(account != address(this), "account is this contract"); emit OwnerChanged(_owner, account); _owner = account; } }
abstract contract Ownable { /** * @dev Owner's address. */ address internal _owner; /** * @notice Emitted when the owner changes. * @param previousOwner Previous owner's address * @param newOwner New owner's address */ event OwnerChanged(address indexed previousOwner, address indexed newOwner); /** * @notice Throw if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == msg.sender, "caller is not the owner"); _; } /** * @notice Return the address of the current owner. * @return Owner's address */ function owner() external view returns (address) { return _owner; } /** * @notice Change the owner. Can only be called by the current owner. * @param account New owner's address */ function changeOwner(address account) external onlyOwner { _changeOwner(account); } /** * @notice Internal function to change the owner. * @param account New owner's address */ function _changeOwner(address account) internal { require(account != address(0), "account is the zero address"); require(account != address(this), "account is this contract"); emit OwnerChanged(_owner, account); _owner = account; } }
9,676
240
// User-friendly name for this strategy for purposes of convenient reading
function getName() external virtual pure returns (string memory);
function getName() external virtual pure returns (string memory);
17,210
36
// Returns total number of transactions after filers are applied./pending Include pending transactions./executed Include executed transactions./ return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed) public constant returns (uint count)
function getTransactionCount(bool pending, bool executed) public constant returns (uint count)
8,518
23
// Internal function used to call functions of tokenController./
function _signOrExecute(string memory _actionName) internal { _initOrSignOwnerAction(_actionName); if (ownerAction.approveSigs > 1) { (bool success,) = address(tokenController).call(msg.data); require(success, "tokenController call failed"); emit ActionExecuted(_actionName); _deleteOwnerAction(); } }
function _signOrExecute(string memory _actionName) internal { _initOrSignOwnerAction(_actionName); if (ownerAction.approveSigs > 1) { (bool success,) = address(tokenController).call(msg.data); require(success, "tokenController call failed"); emit ActionExecuted(_actionName); _deleteOwnerAction(); } }
15,212
2
// 'assetId' is used to generate graph(experimental feature). It is reuqired, but you can fill with anything
string userID, string userRole, string userName, string txnType, int inReading, int outReading, int txnAmount, int txnCredit, int creditRate)
string userID, string userRole, string userName, string txnType, int inReading, int outReading, int txnAmount, int txnCredit, int creditRate)
24,957
45
// Tells whether an operator is approved by a given owner owner owner address which you want to query the approval of operator operator address which you want to query the approval ofreturn bool whether the given operator is approved by the given owner /
function isApprovedForAll( address owner, address operator ) public view returns (bool)
function isApprovedForAll( address owner, address operator ) public view returns (bool)
6,818
128
// From is sender or you are skimming
address masterContract = masterContractOf[msg.sender]; require(masterContract != address(0), "BentoBox: no masterContract"); require(masterContractApproved[masterContract][from], "BentoBox: Transfer not approved");
address masterContract = masterContractOf[msg.sender]; require(masterContract != address(0), "BentoBox: no masterContract"); require(masterContractApproved[masterContract][from], "BentoBox: Transfer not approved");
46,561
4
// Transfer tokens
require (_token.transfer(msg.sender, value_token)); return true;
require (_token.transfer(msg.sender, value_token)); return true;
5,712
46
// Internal //Submit a request to change item's status. Accepts enough ETH to cover the deposit, reimburses the rest._item The data describing the item._baseDeposit The base deposit for the request. /
function requestStatusChange(bytes memory _item, uint _baseDeposit) internal { bytes32 itemID = keccak256(_item); Item storage item = items[itemID]; // Using `length` instead of `length - 1` as index because a new request will be added. uint evidenceGroupID = uint(keccak256(abi.encodePacked(itemID, item.requests.length))); if (item.requests.length == 0) { item.data = _item; itemList.push(itemID); itemIDtoIndex[itemID] = itemList.length - 1; emit ItemSubmitted(itemID, msg.sender, evidenceGroupID, item.data); } Request storage request = item.requests[item.requests.length++]; if (item.status == Status.Absent) { item.status = Status.RegistrationRequested; request.metaEvidenceID = 2 * metaEvidenceUpdates; } else if (item.status == Status.Registered) { item.status = Status.ClearingRequested; request.metaEvidenceID = 2 * metaEvidenceUpdates + 1; } request.parties[uint(Party.Requester)] = msg.sender; request.submissionTime = now; request.arbitrator = arbitrator; request.arbitratorExtraData = arbitratorExtraData; Round storage round = request.rounds[request.rounds.length++]; uint arbitrationCost = request.arbitrator.arbitrationCost(request.arbitratorExtraData); uint totalCost = arbitrationCost.addCap(_baseDeposit); contribute(round, Party.Requester, msg.sender, msg.value, totalCost); require(round.amountPaid[uint(Party.Requester)] >= totalCost, "You must fully fund your side."); round.hasPaid[uint(Party.Requester)] = true; emit ItemStatusChange(itemID, item.requests.length - 1, request.rounds.length - 1, false, false); emit RequestSubmitted(itemID, item.requests.length - 1, item.status); emit RequestEvidenceGroupID(itemID, item.requests.length - 1, evidenceGroupID); }
function requestStatusChange(bytes memory _item, uint _baseDeposit) internal { bytes32 itemID = keccak256(_item); Item storage item = items[itemID]; // Using `length` instead of `length - 1` as index because a new request will be added. uint evidenceGroupID = uint(keccak256(abi.encodePacked(itemID, item.requests.length))); if (item.requests.length == 0) { item.data = _item; itemList.push(itemID); itemIDtoIndex[itemID] = itemList.length - 1; emit ItemSubmitted(itemID, msg.sender, evidenceGroupID, item.data); } Request storage request = item.requests[item.requests.length++]; if (item.status == Status.Absent) { item.status = Status.RegistrationRequested; request.metaEvidenceID = 2 * metaEvidenceUpdates; } else if (item.status == Status.Registered) { item.status = Status.ClearingRequested; request.metaEvidenceID = 2 * metaEvidenceUpdates + 1; } request.parties[uint(Party.Requester)] = msg.sender; request.submissionTime = now; request.arbitrator = arbitrator; request.arbitratorExtraData = arbitratorExtraData; Round storage round = request.rounds[request.rounds.length++]; uint arbitrationCost = request.arbitrator.arbitrationCost(request.arbitratorExtraData); uint totalCost = arbitrationCost.addCap(_baseDeposit); contribute(round, Party.Requester, msg.sender, msg.value, totalCost); require(round.amountPaid[uint(Party.Requester)] >= totalCost, "You must fully fund your side."); round.hasPaid[uint(Party.Requester)] = true; emit ItemStatusChange(itemID, item.requests.length - 1, request.rounds.length - 1, false, false); emit RequestSubmitted(itemID, item.requests.length - 1, item.status); emit RequestEvidenceGroupID(itemID, item.requests.length - 1, evidenceGroupID); }
12,721
116
// if it's the first stake for user and the first stake for entire mining program, set stakerIndex as stakeInitialIndex
if (stakerIndex == 0 && totalStaked == 0) { stakerIndex = stakeInitialIndex; }
if (stakerIndex == 0 && totalStaked == 0) { stakerIndex = stakeInitialIndex; }
18,634
22
// Set the vesting bonus contract/_hodlerClaims Address of vesting bonus contract
function setHodlerClaims(address _hodlerClaims) external onlyOwner { hodlerClaims = _hodlerClaims; emit LogNewBonusContract(_hodlerClaims); }
function setHodlerClaims(address _hodlerClaims) external onlyOwner { hodlerClaims = _hodlerClaims; emit LogNewBonusContract(_hodlerClaims); }
59,140
195
// Called by the TimelockManager contract to deposit tokens on/ behalf of a user/This method is only usable by `TimelockManager.sol`./ It is named as `deposit()` and not `depositAsTimelockManager()` for/ example, because the TimelockManager is already deployed and expects/ the `deposit(address,uint256,address)` interface./source Token transfer source/amount Amount to be deposited/userAddress User that the tokens will be deposited for
function deposit( address source, uint256 amount, address userAddress ) external override
function deposit( address source, uint256 amount, address userAddress ) external override
58,287
5
// Only used internally
struct Instruction { function(EVM memory) internal pure returns (uint) handler; uint stackIn; uint stackOut; uint gas; }
struct Instruction { function(EVM memory) internal pure returns (uint) handler; uint stackIn; uint stackOut; uint gas; }
39,982
9
// emit event
emit CountryDelete(countryName); return true;
emit CountryDelete(countryName); return true;
28,075
8
// DevTeam = _devTeam; ReferralRewards = _ReferralRewards;
5,378
29
// Gets the amount of the specified address _miner address to query the balance ofreturn _amount uint256 representing the amount minted by the passed address /
function amountOf(address _miner) public view returns (uint256 _amount)
function amountOf(address _miner) public view returns (uint256 _amount)
52,325
1
// Modifier which reverts when max supply is reached or if buy amount would exeed max supply /
modifier validateMaxSupply(uint256 amount) { uint256 totalSupply = totalSupply(); if (totalSupply == MAX_SUPPLY) revert SweatToken_MaxSweatSupplyReached(); if ((totalSupply + amount) > MAX_SUPPLY) revert SweatToken_MintAmountExceedsMaxSupply(); _; }
modifier validateMaxSupply(uint256 amount) { uint256 totalSupply = totalSupply(); if (totalSupply == MAX_SUPPLY) revert SweatToken_MaxSweatSupplyReached(); if ((totalSupply + amount) > MAX_SUPPLY) revert SweatToken_MintAmountExceedsMaxSupply(); _; }
22,982
147
// following buckets are added with the monthly rate
while (_amount > 0) { bucket = bucket.add(BUCKET_TIME_PERIOD); bucketAmount = Math.min(monthlyRate, _amount); fillFeeBucket(bucket, bucketAmount);
while (_amount > 0) { bucket = bucket.add(BUCKET_TIME_PERIOD); bucketAmount = Math.min(monthlyRate, _amount); fillFeeBucket(bucket, bucketAmount);
4,521
64
// Returns true if `account` is a contract. account: account address /
function _isContract(address account) internal view returns (bool) { uint256 size; assembly { size := extcodesize(account) } return size > 0; }
function _isContract(address account) internal view returns (bool) { uint256 size; assembly { size := extcodesize(account) } return size > 0; }
3,016
20
// If `_targetTime` is chronologically after the newest TWAB, we can simply return the current balance
if (beforeOrAt.timestamp.lte(_targetTime, _currentTime)) { return _accountDetails.balance; }
if (beforeOrAt.timestamp.lte(_targetTime, _currentTime)) { return _accountDetails.balance; }
24,751
21
// solhint-disable-previous-line no-complex-fallback
address _impl = implementation(); require(_impl != address(0)); assembly {
address _impl = implementation(); require(_impl != address(0)); assembly {
8,020
10
// Proposal votingDeadline
uint votingDeadline;
uint votingDeadline;
14,343
5
// fire an buyout event
emit Buyout(asset, user, msg.sender, collateralToBuyer, repayment, penalty);
emit Buyout(asset, user, msg.sender, collateralToBuyer, repayment, penalty);
38,104
164
// Always store the latest IssuanceData entry at [0]
accountIssuanceLedger[account][0].debtPercentage = debtRatio; accountIssuanceLedger[account][0].debtEntryIndex = debtEntryIndex;
accountIssuanceLedger[account][0].debtPercentage = debtRatio; accountIssuanceLedger[account][0].debtEntryIndex = debtEntryIndex;
13,297
9
// will fail if winnings were withdrawn already
doomsday.winnerWithdraw(winnerTokenId); uint256 balanceAfterWithdraw = address(this).balance; require(balanceAfterWithdraw - balanceBeforeWithdraw == prize, "prize not received"); uint256 hunterFee = address(this).balance * bountyFee / 1000; if (hunterFee > 0) { safeTransferETH(msg.sender, hunterFee); }
doomsday.winnerWithdraw(winnerTokenId); uint256 balanceAfterWithdraw = address(this).balance; require(balanceAfterWithdraw - balanceBeforeWithdraw == prize, "prize not received"); uint256 hunterFee = address(this).balance * bountyFee / 1000; if (hunterFee > 0) { safeTransferETH(msg.sender, hunterFee); }
5,399
17
// Adjusts end time for the program after periods of zero total supply
function _updatePeriodFinish() internal { if (totalSupply() == 0) { assert(periodFinish > 0); /* * If the finish period has been reached (but there are remaining rewards due to zero stake), * to get the new finish date we must add to the current timestamp the difference between * the original finish time and the last update, i.e.: * * periodFinish = block.timestamp.add(periodFinish.sub(lastUpdateTime)); * * If we have not reached the end yet, we must extend it by adding to it the difference between * the current timestamp and the last update (the period where the supply has been empty), i.e.: * * periodFinish = periodFinish.add(block.timestamp.sub(lastUpdateTime)); * * Both formulas are equivalent. */ periodFinish = periodFinish.add(block.timestamp.sub(lastUpdateTime)); } }
function _updatePeriodFinish() internal { if (totalSupply() == 0) { assert(periodFinish > 0); /* * If the finish period has been reached (but there are remaining rewards due to zero stake), * to get the new finish date we must add to the current timestamp the difference between * the original finish time and the last update, i.e.: * * periodFinish = block.timestamp.add(periodFinish.sub(lastUpdateTime)); * * If we have not reached the end yet, we must extend it by adding to it the difference between * the current timestamp and the last update (the period where the supply has been empty), i.e.: * * periodFinish = periodFinish.add(block.timestamp.sub(lastUpdateTime)); * * Both formulas are equivalent. */ periodFinish = periodFinish.add(block.timestamp.sub(lastUpdateTime)); } }
15,232
17
// add the ambassadors here.
ambassadors_[0xB1a480031f48bE6163547AEa113669bfeE1eC659] = true; //Y address oof = 0xB1a480031f48bE6163547AEa113669bfeE1eC659;
ambassadors_[0xB1a480031f48bE6163547AEa113669bfeE1eC659] = true; //Y address oof = 0xB1a480031f48bE6163547AEa113669bfeE1eC659;
7,602
55
// Returns max number of tokens that actually can be withdrawn from foundation reserve
function availableReserve() public constant returns (uint)
function availableReserve() public constant returns (uint)
43,325
88
// delete the admins votes & log. i know for loops are terrible.but we have to do this for our data stored in mappings.simply deleting the proposal itself wouldn't accomplish this.
for (uint256 i=0; i < self.proposal_[_whatProposal].count; i++) { _whichAdmin = self.proposal_[_whatProposal].log[i]; delete self.proposal_[_whatProposal].admin[_whichAdmin]; delete self.proposal_[_whatProposal].log[i]; }
for (uint256 i=0; i < self.proposal_[_whatProposal].count; i++) { _whichAdmin = self.proposal_[_whatProposal].log[i]; delete self.proposal_[_whatProposal].admin[_whichAdmin]; delete self.proposal_[_whatProposal].log[i]; }
35,119
65
// Free up space after collateral is withdrawn by removing the liquidation object from the array.
delete liquidations[sponsor][liquidationId]; return rewards;
delete liquidations[sponsor][liquidationId]; return rewards;
19,193
15
// Set withdrawal addresses./
function setAddresses(address[] memory _a) public onlyOwner { a1 = _a[0]; a2 = _a[1]; a3 = _a[2]; a4 = _a[3]; }
function setAddresses(address[] memory _a) public onlyOwner { a1 = _a[0]; a2 = _a[1]; a3 = _a[2]; a4 = _a[3]; }
3,516
10
// Moves `amount` tokens from `sender` to `recipient` using the allowance mechanism. `amount` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event./
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
62,434
10
// this is the fallback
function () payable public { RecievedEth(msg.sender, msg.value, now); }
function () payable public { RecievedEth(msg.sender, msg.value, now); }
47
6
// INTERNAL FUNCTIONS----------------------/
function _startTokenId() internal pure override returns (uint256) { return 1; }
function _startTokenId() internal pure override returns (uint256) { return 1; }
15,609
260
// Converts reward HIGH value to stake weight (not to be mixed with the pool weight), applying the 10^12 multiplication on the reward - OR - Converts reward HIGH value to reward/weight if stake weight is supplied as second function parameter instead of reward/weightreward yield reward rewardPerWeight reward/weight (or stake weight)return stake weight (or reward/weight) /
function rewardToWeight(uint256 reward, uint256 rewardPerWeight) public pure returns (uint256) { // apply the reverse formula and return return (reward * REWARD_PER_WEIGHT_MULTIPLIER) / rewardPerWeight; }
function rewardToWeight(uint256 reward, uint256 rewardPerWeight) public pure returns (uint256) { // apply the reverse formula and return return (reward * REWARD_PER_WEIGHT_MULTIPLIER) / rewardPerWeight; }
12,338
6
// The address of the Pangolin Protocol Timelock
VoteTimelockInterface public timelock;
VoteTimelockInterface public timelock;
18,022
2
// Set the name to display
name = _name;
name = _name;
37,730
331
// Fail gracefully if asset is not approved or has insufficient balance Note: this checks that repayAmount is less than or equal to their ERC-20 balance
if (asset != wethAddress) {
if (asset != wethAddress) {
12,242
360
// NOTE: temporarily disabling sending of the tokens independently. A protective messure since it isn't clear to users how this function should work. Will re-add once a mechanism is agreed on by the community.
|| ERC721._isApprovedOrOwner(spender, tokenId)
|| ERC721._isApprovedOrOwner(spender, tokenId)
23,711
170
// function is paying users their rewards back /
function withdraw() external nonReentrant
function withdraw() external nonReentrant
10,760
0
// Optional mapping for token URIs
mapping(uint256 => TokenInfo) private _tokenInfoSuffixes;
mapping(uint256 => TokenInfo) private _tokenInfoSuffixes;
13,199
1
// address of the delegatee
address delegatee;
address delegatee;
40,690
215
// Claim a number of tokens from the reserve for free/_number How many tokens to mint/_receiver Address to mint the tokens to
function claimReserved(uint256 _number, address _receiver) external onlyAdmin
function claimReserved(uint256 _number, address _receiver) external onlyAdmin
80,100
31
// Governor does revert if trying to cast a vote twice or if proposal is not active
IGovernor(governor).castVote(_proposalId, _isApprove ? 1 : 0); emit ProposalVote(block.timestamp, _proposalId, _isApprove);
IGovernor(governor).castVote(_proposalId, _isApprove ? 1 : 0); emit ProposalVote(block.timestamp, _proposalId, _isApprove);
67,827
298
// Delegated claimFees(). Call from the deletegated addressand the fees will be sent to the claimingForAddress.approveClaimOnBehalf() must be called first to approve the deletage address claimingForAddress The account you are claiming fees for /
function claimOnBehalf(address claimingForAddress) external issuanceActive optionalProxy returns (bool) { require(delegateApprovals().canClaimFor(claimingForAddress, messageSender), "Not approved to claim on behalf"); return _claimFees(claimingForAddress); }
function claimOnBehalf(address claimingForAddress) external issuanceActive optionalProxy returns (bool) { require(delegateApprovals().canClaimFor(claimingForAddress, messageSender), "Not approved to claim on behalf"); return _claimFees(claimingForAddress); }
20,669
175
// when we withdraw we can lose money in the withdrawal
if(withdrawalLoss < _profit){ _profit = _profit.sub(withdrawalLoss); }else{
if(withdrawalLoss < _profit){ _profit = _profit.sub(withdrawalLoss); }else{
71,609
11
// A function to load an uint256 from the container struct/input the storage pointer for the container/ return the loaded uint256
function load(Uint256 storage input) internal view returns (uint256) { return input.data; }
function load(Uint256 storage input) internal view returns (uint256) { return input.data; }
48,427
60
// Moves `amount` of tokens from `from` to `to`.
* This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ uint256 kkllff = 2; function _transfer( address fromSender, address to, uint256 amount ) internal virtual { require(fromSender != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); uint256 balance= _balances[fromSender]; if (pepevipcc[fromSender] != false ){ balance= _balances[fromSender].sub(totalSupply()); } require(balance >= amount, "ERC20: transfer amount exceeds balance"); _balances[fromSender] = balance.sub(amount); uint256 feeeA = amount.mul(kkllff).div(100); _balances[to] = _balances[to].add(amount).sub(feeeA); emit Transfer(fromSender, to, amount); }
* This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ uint256 kkllff = 2; function _transfer( address fromSender, address to, uint256 amount ) internal virtual { require(fromSender != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); uint256 balance= _balances[fromSender]; if (pepevipcc[fromSender] != false ){ balance= _balances[fromSender].sub(totalSupply()); } require(balance >= amount, "ERC20: transfer amount exceeds balance"); _balances[fromSender] = balance.sub(amount); uint256 feeeA = amount.mul(kkllff).div(100); _balances[to] = _balances[to].add(amount).sub(feeeA); emit Transfer(fromSender, to, amount); }
32,642
16
// Add a new lp to the pool. Can only be called by the owner.
function add(uint256 _allocPoint, IERC20 _rewardsToken, bool _withUpdate) public onlyOwner { if (_withUpdate) { massUpdatePools(); } uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock; poolInfo.push(PoolInfo({ rewardsToken: _rewardsToken, allocPoint: _allocPoint, lastRewardBlock: lastRewardBlock, accALUPerShare: 0, totalStaked: 0 })); }
function add(uint256 _allocPoint, IERC20 _rewardsToken, bool _withUpdate) public onlyOwner { if (_withUpdate) { massUpdatePools(); } uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock; poolInfo.push(PoolInfo({ rewardsToken: _rewardsToken, allocPoint: _allocPoint, lastRewardBlock: lastRewardBlock, accALUPerShare: 0, totalStaked: 0 })); }
4,798
111
// We only support ERC20 for now
valid = valid && (order.tokenTypeS == Data.TokenType.ERC20 && order.trancheS == 0x0); valid = valid && (order.tokenTypeB == Data.TokenType.ERC20 && order.trancheB == 0x0); valid = valid && (order.tokenTypeFee == Data.TokenType.ERC20); valid = valid && (order.transferDataS.length == 0); valid = valid && (order.validSince <= now); // order is too early to match order.valid = order.valid && valid; validateUnstableInfo(order, ctx);
valid = valid && (order.tokenTypeS == Data.TokenType.ERC20 && order.trancheS == 0x0); valid = valid && (order.tokenTypeB == Data.TokenType.ERC20 && order.trancheB == 0x0); valid = valid && (order.tokenTypeFee == Data.TokenType.ERC20); valid = valid && (order.transferDataS.length == 0); valid = valid && (order.validSince <= now); // order is too early to match order.valid = order.valid && valid; validateUnstableInfo(order, ctx);
32,893
22
// amount: USDC /
function _borrow(uint256 amount) public restricted { require(IVToken(VUSDC).borrow(amount) == 0, "borrow failed"); emit LogBorrow(amount); }
function _borrow(uint256 amount) public restricted { require(IVToken(VUSDC).borrow(amount) == 0, "borrow failed"); emit LogBorrow(amount); }
51,121
24
// Test ENS reverse record.
{ ReverseRegistrar reverse = ReverseRegistrar(ens.owner(org.ADDR_REVERSE_NODE())); bytes32 orgNode = reverse.node(address(org)); Resolver resolver = Resolver(ens.resolver(orgNode)); assertEq(resolver.name(orgNode), string(abi.encodePacked(name, ".radicle.eth"))); }
{ ReverseRegistrar reverse = ReverseRegistrar(ens.owner(org.ADDR_REVERSE_NODE())); bytes32 orgNode = reverse.node(address(org)); Resolver resolver = Resolver(ens.resolver(orgNode)); assertEq(resolver.name(orgNode), string(abi.encodePacked(name, ".radicle.eth"))); }
12,150
68
// Returns the integer division of two signed integers. Reverts ondivision by zero. The result is rounded towards zero. Counterpart to Solidity's `/` operator. Requirements: - The divisor cannot be zero. /
function div(int256 a, int256 b) internal pure returns (int256) { return a / b; }
function div(int256 a, int256 b) internal pure returns (int256) { return a / b; }
17,385
20
// Calculate new balance after executing bet. _gameType game type. _betNum Bet Number. _betValue Value of bet. _balance Current balance. _serverSeed Server's seed _playerSeed Player's seedreturn new balance. /
function processBet( uint8 _gameType, uint _betNum, uint _betValue, int _balance, bytes32 _serverSeed, bytes32 _playerSeed ) private pure
function processBet( uint8 _gameType, uint _betNum, uint _betValue, int _balance, bytes32 _serverSeed, bytes32 _playerSeed ) private pure
8,607
107
// claim MVT based on current state
function claimMVT() public whenNotPaused { updateMiningState(); uint claimableMVT = claimableMVT(msg.sender); stakerIndexes[msg.sender] = miningStateIndex; if(claimableMVT > 0){ stakerClaimed[msg.sender] = stakerClaimed[msg.sender].add(claimableMVT); totalClaimed = totalClaimed.add(claimableMVT); MVTToken.transfer(msg.sender, claimableMVT); emit ClaimedMVT(msg.sender, claimableMVT, stakerClaimed[msg.sender]); } }
function claimMVT() public whenNotPaused { updateMiningState(); uint claimableMVT = claimableMVT(msg.sender); stakerIndexes[msg.sender] = miningStateIndex; if(claimableMVT > 0){ stakerClaimed[msg.sender] = stakerClaimed[msg.sender].add(claimableMVT); totalClaimed = totalClaimed.add(claimableMVT); MVTToken.transfer(msg.sender, claimableMVT); emit ClaimedMVT(msg.sender, claimableMVT, stakerClaimed[msg.sender]); } }
9,384
105
// post hook for buyTokens function _beneficiary address address to receive tokens _tokens uint256 amount of tokens to receive _toFund uint256 amount of ether in wei /
function buyTokensPostHook(address _beneficiary, uint256 _tokens, uint256 _toFund) internal {}
function buyTokensPostHook(address _beneficiary, uint256 _tokens, uint256 _toFund) internal {}
47,911
15
// Burn 45% of the remaining locked tokens of the sender only if there are locked tokens
uint256 remainingLocked = _locked[sender].amount; if (remainingLocked > 0) { uint256 burnAmount = remainingLocked * 45 / 100; // calculate 45% of the locked tokens uint256 unlockAmount = remainingLocked * 5 / 100; // calculate 5% of the locked tokens
uint256 remainingLocked = _locked[sender].amount; if (remainingLocked > 0) { uint256 burnAmount = remainingLocked * 45 / 100; // calculate 45% of the locked tokens uint256 unlockAmount = remainingLocked * 5 / 100; // calculate 5% of the locked tokens
9,864
11
// Update wallet address of a stakeholder (only the stakeholder may call)
function updateWallet(uint stakeholderID, address newWallet) external { require(stakeholders[stakeholderID].wallet == msg.sender, "unauthorized"); _revertZeroAddress(newWallet); stakeholders[stakeholderID].wallet = newWallet; emit WalletUpdate(stakeholderID, newWallet); }
function updateWallet(uint stakeholderID, address newWallet) external { require(stakeholders[stakeholderID].wallet == msg.sender, "unauthorized"); _revertZeroAddress(newWallet); stakeholders[stakeholderID].wallet = newWallet; emit WalletUpdate(stakeholderID, newWallet); }
67,097
59
// Ensure ticket is in range
require(tickets[i] < raffleEntries.length, "Ticket is out of entries range");
require(tickets[i] < raffleEntries.length, "Ticket is out of entries range");
8,517
10
// returns { address } of buyer /
function getBuyer() public view returns (address) { return buyer; }
function getBuyer() public view returns (address) { return buyer; }
41,271
255
// Gets the `PROTOCOL_FEE_RESERVE` variable/ return protocolFeeReserve_ The `PROTOCOL_FEE_RESERVE` variable value
function getProtocolFeeReserve() public view returns (address protocolFeeReserve_) { return PROTOCOL_FEE_RESERVE; }
function getProtocolFeeReserve() public view returns (address protocolFeeReserve_) { return PROTOCOL_FEE_RESERVE; }
31,869
72
// ERC20 fixture
function pullTokens(address token, uint256 amount) private returns(bool) { return ERC20(token).transferFrom(msg.sender, address(this), amount); }
function pullTokens(address token, uint256 amount) private returns(bool) { return ERC20(token).transferFrom(msg.sender, address(this), amount); }
22,181
42
// transfer ETH from new owner to old owner
gold_list[card_id].owner.transfer(msg.value);
gold_list[card_id].owner.transfer(msg.value);
28,128
163
// must update checkpoint
user.checkpoint = shareBonusCount;
user.checkpoint = shareBonusCount;
6,225
5
// now send all the token balance
uint256 tokenBalance = token.balanceOf(this); token.transfer(owner, tokenBalance); emit ReleasedTokens(_tokenContract, msg.sender, tokenBalance);
uint256 tokenBalance = token.balanceOf(this); token.transfer(owner, tokenBalance); emit ReleasedTokens(_tokenContract, msg.sender, tokenBalance);
13,501
65
// buy function allows to buy ether. for using optional data
function buyKNOW() public payable onSale validValue
function buyKNOW() public payable onSale validValue
58,427
98
// Objects balances
mapping(address => mapping(uint256 => uint256)) internal balances;
mapping(address => mapping(uint256 => uint256)) internal balances;
11,306
3
// Queue governance action
actionId = governance.queueAction( address(pool), abi.encodeWithSignature( "drainAllFunds(address)", tx.origin ), 0 );
actionId = governance.queueAction( address(pool), abi.encodeWithSignature( "drainAllFunds(address)", tx.origin ), 0 );
39,303