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 |
|---|---|---|---|---|
223 | // Reads the int160 at `cdPtr` in calldata. | function readInt160(
CalldataPointer cdPtr
| function readInt160(
CalldataPointer cdPtr
| 19,691 |
12 | // claims the {amount} of tokens plus {earned} tokensafter the end of {tenure} Requirements:`_stakingContractId` of the staking instance. returns a boolean to show the current state of the transaction. / | function claim(uint256 _stakingContractId)
public
virtual
override
nonReentrant
returns (bool)
{
Stake storage sc = stakeContract[_msgSender()][_stakingContractId];
require(sc.maturesAt <= block.timestamp, "Not Yet Matured");
| function claim(uint256 _stakingContractId)
public
virtual
override
nonReentrant
returns (bool)
{
Stake storage sc = stakeContract[_msgSender()][_stakingContractId];
require(sc.maturesAt <= block.timestamp, "Not Yet Matured");
| 75,443 |
15 | // Reverts if the split with recipients represented by `accounts` and `percentAllocations` is malformedaccounts Ordered, unique list of addresses with ownership in the splitpercentAllocations Percent allocations associated with each addressdistributorFee Keeper fee paid by split to cover gas costs of distribution / | modifier validSplit(
address[] memory accounts,
uint32[] memory percentAllocations,
uint32 distributorFee
| modifier validSplit(
address[] memory accounts,
uint32[] memory percentAllocations,
uint32 distributorFee
| 25,509 |
8 | // Mints a token with a certain template's metadata. / | function mint(address _to,uint256 _templateId) public onlyOwner returns(uint256){
require(
currentTemplateId >= _templateId,
'Gold: Invalid template Id'
);
require(
totalMintedNFTs[_templateId] < MAX_NFT_PER_TEMPLATE,
'Gold: Limit exceeding'
);
totalMintedNFTs[_templateId] +=1;
uint256 tokenId = _templateId*MAX_NFT_PER_TEMPLATE + totalMintedNFTs[_templateId];
_mint(_to, tokenId);
metaData[tokenId].points = templateData[_templateId].points;
metaData[tokenId].externalLink = templateData[_templateId].externalLink;
return tokenId;
}
| function mint(address _to,uint256 _templateId) public onlyOwner returns(uint256){
require(
currentTemplateId >= _templateId,
'Gold: Invalid template Id'
);
require(
totalMintedNFTs[_templateId] < MAX_NFT_PER_TEMPLATE,
'Gold: Limit exceeding'
);
totalMintedNFTs[_templateId] +=1;
uint256 tokenId = _templateId*MAX_NFT_PER_TEMPLATE + totalMintedNFTs[_templateId];
_mint(_to, tokenId);
metaData[tokenId].points = templateData[_templateId].points;
metaData[tokenId].externalLink = templateData[_templateId].externalLink;
return tokenId;
}
| 22,049 |
39 | // Contract module that allows children to implement role-based accesscontrol mechanisms. Roles are referred to by their `bytes4` identifier. These are expected to be the signatures for all the functions in the contract. Special roles should be exposedin the external API and be unique: ```bytes4 public constant ROOT = 0x00000000;``` | * Roles represent restricted access to a function call. For that purpose, use {auth}:
*
* ```
* function foo() public auth {
* ...
* }
| * Roles represent restricted access to a function call. For that purpose, use {auth}:
*
* ```
* function foo() public auth {
* ...
* }
| 51,426 |
26 | // Remove a pool | function removePool(address pool_address) public onlyByOwnerOrGovernance {
require(xusd_pools[pool_address] == true, "address doesn't exist already");
// Delete from the mapping
delete xusd_pools[pool_address];
// 'Delete' from the array by setting the address to 0x0
for (uint i = 0; i < xusd_pools_array.length; i++){
if (xusd_pools_array[i] == pool_address) {
xusd_pools_array[i] = address(0); // This will leave a null in the array and keep the indices the same
break;
}
}
}
| function removePool(address pool_address) public onlyByOwnerOrGovernance {
require(xusd_pools[pool_address] == true, "address doesn't exist already");
// Delete from the mapping
delete xusd_pools[pool_address];
// 'Delete' from the array by setting the address to 0x0
for (uint i = 0; i < xusd_pools_array.length; i++){
if (xusd_pools_array[i] == pool_address) {
xusd_pools_array[i] = address(0); // This will leave a null in the array and keep the indices the same
break;
}
}
}
| 31,763 |
0 | // Interface Imports // External Imports // MVM_L2ChainManagerOnL1 if want support multi l2 chain on l1,it should add a manager to desc how many l2 chain now ,and dispatch the l2 chain id to make it is unique. Compiler used: solcRuntime target: EVM / | interface iMVM_L2ChainManagerOnL1 {
event SwitchSeq (uint256 chainid, address wallet, address manager);
event PushConfig (uint256 chainid, bytes configs);
/********************
* Public Functions *
********************/
function switchSequencer(uint256 _chainId, address wallet, address manager) external payable;
function pushConfig(uint256 _chainId, bytes calldata configs) external payable;
}
| interface iMVM_L2ChainManagerOnL1 {
event SwitchSeq (uint256 chainid, address wallet, address manager);
event PushConfig (uint256 chainid, bytes configs);
/********************
* Public Functions *
********************/
function switchSequencer(uint256 _chainId, address wallet, address manager) external payable;
function pushConfig(uint256 _chainId, bytes calldata configs) external payable;
}
| 17,515 |
12 | // Allows a request to be cancelled if it has not been fulfilled Requires keeping track of the expiration value emitted from the oracle contract.Deletes the request from the `pendingRequests` mapping.Emits ChainlinkCancelled event. requestId The request ID payment The amount of LINK sent for the request callbackFunc The callback function specified for the request expiration The time of the expiration for the request / | function cancelChainlinkRequest(
bytes32 requestId,
uint256 payment,
bytes4 callbackFunc,
uint256 expiration
| function cancelChainlinkRequest(
bytes32 requestId,
uint256 payment,
bytes4 callbackFunc,
uint256 expiration
| 20,029 |
476 | // Allows a request to be cancelled if it has not been fulfilled Requires keeping track of the expiration value emitted from the oracle contract.Deletes the request from the `pendingRequests` mapping.Emits ChainlinkCancelled event. requestId The request ID payment The amount of LINK sent for the request callbackFunc The callback function specified for the request expiration The time of the expiration for the request / | function cancelChainlinkRequest(
bytes32 requestId,
uint256 payment,
bytes4 callbackFunc,
uint256 expiration
| function cancelChainlinkRequest(
bytes32 requestId,
uint256 payment,
bytes4 callbackFunc,
uint256 expiration
| 12,813 |
132 | // reset highestBidder | highestBidder = address(0);
| highestBidder = address(0);
| 17,048 |
35 | // Log | LogDisbursed(index, token, amount, snapshot, totalShares);
| LogDisbursed(index, token, amount, snapshot, totalShares);
| 1,491 |
180 | // 公售 | function public_mint(uint num) public payable {
require(IsActive, "Sale must be active to mint Tokens");
require(saleConfig.round==3, "Sale has not started yet.(Public Mint)");
require(saleConfig.startTime <= block.timestamp && block.timestamp <= saleConfig.endTime, "Sale has not started yet.");
require(num <= saleConfig.max_num, "Exceeded max token purchase");
require(totalSupply() + num <= saleConfig.FOMO_total, "Purchase would exceed max supply of tokens");
require(mint_num[msg.sender] + num <= saleConfig.max_num, "Exceeded max token purchase..");
require(saleConfig._price * num <= msg.value, "Ether value sent is not correct");
for(uint i = 0; i < num; i++)
{
uint mintIndex = totalSupply();
if (totalSupply() < saleConfig.FOMO_total)
{
_safeMint(msg.sender, mintIndex);
mint_num[msg.sender] = mint_num[msg.sender]+1;
}
}
}
| function public_mint(uint num) public payable {
require(IsActive, "Sale must be active to mint Tokens");
require(saleConfig.round==3, "Sale has not started yet.(Public Mint)");
require(saleConfig.startTime <= block.timestamp && block.timestamp <= saleConfig.endTime, "Sale has not started yet.");
require(num <= saleConfig.max_num, "Exceeded max token purchase");
require(totalSupply() + num <= saleConfig.FOMO_total, "Purchase would exceed max supply of tokens");
require(mint_num[msg.sender] + num <= saleConfig.max_num, "Exceeded max token purchase..");
require(saleConfig._price * num <= msg.value, "Ether value sent is not correct");
for(uint i = 0; i < num; i++)
{
uint mintIndex = totalSupply();
if (totalSupply() < saleConfig.FOMO_total)
{
_safeMint(msg.sender, mintIndex);
mint_num[msg.sender] = mint_num[msg.sender]+1;
}
}
}
| 62,151 |
157 | // Function to disable sale and close minting. | function setSaleActive(bool active) external onlyOwner {
saleIsActive = active;
}
| function setSaleActive(bool active) external onlyOwner {
saleIsActive = active;
}
| 63,269 |
22 | // ContractReceiver Contract that is working with ERC223 tokens newQSHUCOIN / | contract ContractReceiver {
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
function tokenFallback(address _from, uint _value, bytes _data) public pure {
TKN memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8) + (uint32(_data[1]) << 16) + (uint32(_data[0]) << 24);
tkn.sig = bytes4(u);
/*
* tkn variable is analogue of msg variable of Ether transaction
* tkn.sender is person who initiated this token transaction (analogue of msg.sender)
* tkn.value the number of tokens that were sent (analogue of msg.value)
* tkn.data is data of token transaction (analogue of msg.data)
* tkn.sig is 4 bytes signature of function if data of token transaction is a function execution
*/
}
}
| contract ContractReceiver {
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
function tokenFallback(address _from, uint _value, bytes _data) public pure {
TKN memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8) + (uint32(_data[1]) << 16) + (uint32(_data[0]) << 24);
tkn.sig = bytes4(u);
/*
* tkn variable is analogue of msg variable of Ether transaction
* tkn.sender is person who initiated this token transaction (analogue of msg.sender)
* tkn.value the number of tokens that were sent (analogue of msg.value)
* tkn.data is data of token transaction (analogue of msg.data)
* tkn.sig is 4 bytes signature of function if data of token transaction is a function execution
*/
}
}
| 35,935 |
0 | // The active state of the contract | bool internal _active;
| bool internal _active;
| 43,767 |
13 | // Mapping of completed cross chain requests: source chain id => request id => request | mapping (uint32 => mapping (uint256 => bool)) public completedCrossChainRequest;
| mapping (uint32 => mapping (uint256 => bool)) public completedCrossChainRequest;
| 13,439 |
19 | // function that is called when transaction target is an address | function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = safeSub(balanceOf(msg.sender), _value);
balances[_to] = safeAdd(balanceOf(_to), _value);
Transfer(msg.sender, _to, _value, _data);
return true;
}
| function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = safeSub(balanceOf(msg.sender), _value);
balances[_to] = safeAdd(balanceOf(_to), _value);
Transfer(msg.sender, _to, _value, _data);
return true;
}
| 70,661 |
38 | // Pay chain currency to receive MBC from Marble.Cards backend/If the rate of RMBC received for the given chain currency changes, we may return the payment back to the user./expectedRmbcAmount Expected amount of received RMBC. | function payChainCurrency(uint256 expectedRmbcAmount)
payable
external
minimalPrice(minimalPaidAmount)
| function payChainCurrency(uint256 expectedRmbcAmount)
payable
external
minimalPrice(minimalPaidAmount)
| 39,883 |
2 | // Avoid having loanId = 0 | loanIdTracker.increment();
emit Initialized(address(collateralToken), address(borrowerNote), address(lenderNote));
| loanIdTracker.increment();
emit Initialized(address(collateralToken), address(borrowerNote), address(lenderNote));
| 25,321 |
28 | // Transfer the amount of the specified ERC20 tokens, to the owner of this contract | token.safeTransfer(owner, amount);
| token.safeTransfer(owner, amount);
| 33,440 |
3 | // Update logics of the contracts @custom:note - Because they might have inter-dependencies, it is good to have one single function to update them all / | function updateContracts(
ISuperfluid host,
| function updateContracts(
ISuperfluid host,
| 23,103 |
26 | // decrease allowance | _allowedFragments[from][msg.sender] = _allowedFragments[from][msg.sender].sub(value);
| _allowedFragments[from][msg.sender] = _allowedFragments[from][msg.sender].sub(value);
| 23,906 |
10 | // Comptroller functions | function enterMarket(address cToken) external returns (uint256);
function enterMarkets(address[] calldata cTokens) external returns (uint256[] memory);
function exitMarket(address cToken) external returns (uint256);
function claimComp() external;
function claimComp(address[] calldata bTokens) external;
function claimComp(address[] calldata bTokens, bool borrowers, bool suppliers) external;
function getAccountLiquidity() external view returns (uint err, uint liquidity, uint shortFall);
| function enterMarket(address cToken) external returns (uint256);
function enterMarkets(address[] calldata cTokens) external returns (uint256[] memory);
function exitMarket(address cToken) external returns (uint256);
function claimComp() external;
function claimComp(address[] calldata bTokens) external;
function claimComp(address[] calldata bTokens, bool borrowers, bool suppliers) external;
function getAccountLiquidity() external view returns (uint err, uint liquidity, uint shortFall);
| 25,589 |
41 | // To transfer token contract ownership/_newOwner The address of the new owner of this contract | function transferOwnership(address _newOwner) public onlyOwner {
balances[_newOwner] = balances[owner];
balances[owner] = 0;
Ownable.transferOwnership(_newOwner);
}
| function transferOwnership(address _newOwner) public onlyOwner {
balances[_newOwner] = balances[owner];
balances[owner] = 0;
Ownable.transferOwnership(_newOwner);
}
| 14,293 |
16 | // Stores the start time of ownership with minimal overhead for tokenomics. | uint64 startTimestamp;
| uint64 startTimestamp;
| 318 |
40 | // we have to split the tokenSums[0] across mutiple lockUps | aLockUp.alreadyWithdrawn = aLockUp.alreadyWithdrawn.add(allowedAmountPerLockup[i]);
| aLockUp.alreadyWithdrawn = aLockUp.alreadyWithdrawn.add(allowedAmountPerLockup[i]);
| 51,417 |
47 | // withdrawETH: withdraw eth to the treasury: / | function withdrawETH(uint256 amount_) external returns (bool success_);
| function withdrawETH(uint256 amount_) external returns (bool success_);
| 28,728 |
201 | // add ref. bonus | _dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
if (_recipient == address(0x0)) {
_recipient = msg.sender;
}
| _dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
if (_recipient == address(0x0)) {
_recipient = msg.sender;
}
| 24,352 |
7 | // All fields except `erc1155TokenAmount` align with those of NFTOrder | struct ERC1155Order {
TradeDirection direction;
address maker;
address taker;
uint256 expiry;
uint256 nonce;
IERC20TokenV06 erc20Token;
uint256 erc20TokenAmount;
Fee[] fees;
IERC1155Token erc1155Token;
uint256 erc1155TokenId;
Property[] erc1155TokenProperties;
// End of fields shared with NFTOrder
uint128 erc1155TokenAmount;
}
| struct ERC1155Order {
TradeDirection direction;
address maker;
address taker;
uint256 expiry;
uint256 nonce;
IERC20TokenV06 erc20Token;
uint256 erc20TokenAmount;
Fee[] fees;
IERC1155Token erc1155Token;
uint256 erc1155TokenId;
Property[] erc1155TokenProperties;
// End of fields shared with NFTOrder
uint128 erc1155TokenAmount;
}
| 1,373 |
102 | // Resolve the bet finishBetfrom returns the player profit this will be negative if the player lost and the house won so flip it to get the house profit, if any | int sum = - finishBetFrom(pendingBetsQueue[head]);
| int sum = - finishBetFrom(pendingBetsQueue[head]);
| 50,634 |
428 | // The COMP accrued but not yet transferred to each user | mapping(address => uint) public compAccrued;
| mapping(address => uint) public compAccrued;
| 23,070 |
0 | // EngineA/LFG Gaming LLC/Concrete implementation of LootEngine | contract EngineA is LootEngine {
constructor(address furballs,
address snacksAddr, address zonesAddr,
address tradeProxy, address companyProxy
)
LootEngine(furballs, snacksAddr, zonesAddr, tradeProxy, companyProxy) { }
}
| contract EngineA is LootEngine {
constructor(address furballs,
address snacksAddr, address zonesAddr,
address tradeProxy, address companyProxy
)
LootEngine(furballs, snacksAddr, zonesAddr, tradeProxy, companyProxy) { }
}
| 34,048 |
181 | // view the current parameters of the shell/ return alpha_ the current alpha value/ return beta_ the current beta value/ return delta_ the current delta value/ return epsilon_ the current epsilon value/ return lambda_ the current lambda value/ return omega_ the current omega value | function viewShell () external view returns (
uint alpha_,
uint beta_,
uint delta_,
uint epsilon_,
uint lambda_,
uint omega_
| function viewShell () external view returns (
uint alpha_,
uint beta_,
uint delta_,
uint epsilon_,
uint lambda_,
uint omega_
| 26,858 |
30 | // Update reward vairables for all pools. Be careful of gas spending! | function massUpdatePools() public {
uint256 length = poolInfo.length;
for (uint256 pid = 0; pid < length; ++pid) {
updatePool(pid);
}
}
| function massUpdatePools() public {
uint256 length = poolInfo.length;
for (uint256 pid = 0; pid < length; ++pid) {
updatePool(pid);
}
}
| 47,758 |
28 | // Claim your BOV; allocates BOV proportionally to this investor. Can be called by investors to claim their BOV after the crowdsale ends. distributeAllTokens() is a batch alternative to this. | function claimTokens(address origAddress) public {
require(crowdsaleHasEnded());
require(claimed[origAddress] == false);
uint amountInvested = investments[origAddress];
uint bovEarned = amountInvested.mul(initialSale).div(weiRaised);
claimed[origAddress] = true;
mint(origAddress, bovEarned);
}
| function claimTokens(address origAddress) public {
require(crowdsaleHasEnded());
require(claimed[origAddress] == false);
uint amountInvested = investments[origAddress];
uint bovEarned = amountInvested.mul(initialSale).div(weiRaised);
claimed[origAddress] = true;
mint(origAddress, bovEarned);
}
| 23,895 |
1 | // Used to calculate the swap price/Start Price is just a name, depending of the algorithm it will take it at different ways | uint128 public startPrice;
| uint128 public startPrice;
| 3,726 |
4 | // suspend deployment | rc.suspendDeployment(address(2));
| rc.suspendDeployment(address(2));
| 10,885 |
6 | // btcParam合约地址 | address public btcParam;
| address public btcParam;
| 50,899 |
13 | // Store expected length of total byte array as first value | mstore(inputs, totalInputSize)
| mstore(inputs, totalInputSize)
| 37,731 |
21 | // Converts an address to a bytes array a the address to convertreturn b the bytes array / | function addressToBytes(address a) internal pure returns (bytes memory b) {
b = new bytes(20);
assembly {
mstore(add(b, 32), mul(a, exp(256, 12)))
}
}
| function addressToBytes(address a) internal pure returns (bytes memory b) {
b = new bytes(20);
assembly {
mstore(add(b, 32), mul(a, exp(256, 12)))
}
}
| 8,002 |
30 | // Initial supply must go first | state_.currentSupply = config_.initialSupply;
| state_.currentSupply = config_.initialSupply;
| 25,258 |
8 | // Returns max fee discount that can be accumulated during every term / | function getMaxTotalDiscount(address vendor) public view returns (uint256) {
return maxDiscountPerToken.safeMult(token.balanceOf(vendor)) / denominator;
}
| function getMaxTotalDiscount(address vendor) public view returns (uint256) {
return maxDiscountPerToken.safeMult(token.balanceOf(vendor)) / denominator;
}
| 36,933 |
33 | // set CleanEnergyAssets contract address | function setCleanEnergyAssetsAddr(address _address)
public
whenNotPaused
onlyOwner
isZeroAddress(
_address
)
| function setCleanEnergyAssetsAddr(address _address)
public
whenNotPaused
onlyOwner
isZeroAddress(
_address
)
| 22,633 |
1 | // URI | function setBaseURI(string memory _uri) public onlyOwner {
_setBaseURI(_uri);
}
| function setBaseURI(string memory _uri) public onlyOwner {
_setBaseURI(_uri);
}
| 39,244 |
1 | // The multiplier of utilization rate that gives the slope of the interest rate / | uint public multiplierPerBlock;
| uint public multiplierPerBlock;
| 6,725 |
8 | // Special address to store global state | address private constant GLOBAL_ACCOUNT = address(0);
| address private constant GLOBAL_ACCOUNT = address(0);
| 18,629 |
129 | // supplyDelta = totalSupply(rate - targetRate) / targetRate | int256 targetRateSigned = targetRate.toInt256Safe();
return uFrags.totalSupply().toInt256Safe()
.mul(rate.toInt256Safe().sub(targetRateSigned))
.div(targetRateSigned);
| int256 targetRateSigned = targetRate.toInt256Safe();
return uFrags.totalSupply().toInt256Safe()
.mul(rate.toInt256Safe().sub(targetRateSigned))
.div(targetRateSigned);
| 4,293 |
41 | // Will return true if token holders can still return their tokens for a refund / | function refundGuaranteeActive() public view returns (bool) {
HeyMintStorage.State storage state = HeyMintStorage.state();
return block.timestamp < state.advCfg.refundEndsAt;
}
| function refundGuaranteeActive() public view returns (bool) {
HeyMintStorage.State storage state = HeyMintStorage.state();
return block.timestamp < state.advCfg.refundEndsAt;
}
| 21,093 |
246 | // _endRound should be equal to the current round because after LIP-36 using a past _endRound can result in incorrect cumulative factor values used/stored for the _endRound in updateDelegatorWithEarnings(). The exception is when claiming through an _endRound before the LIP-36 upgrade round because cumulative factor values will not be used/stored in updateDelegatorWithEarnings() before the LIP-36 upgrade round. | require(
_endRound == roundsManager().currentRound() || _endRound < roundsManager().lipUpgradeRound(36),
"end round must be equal to the current round or before the LIP-36 upgrade round"
);
updateDelegatorWithEarnings(msg.sender, _endRound, lastClaimRound);
| require(
_endRound == roundsManager().currentRound() || _endRound < roundsManager().lipUpgradeRound(36),
"end round must be equal to the current round or before the LIP-36 upgrade round"
);
updateDelegatorWithEarnings(msg.sender, _endRound, lastClaimRound);
| 23,860 |
109 | // Create first production unit (Space Kitty) | createProductionUnit1Beta();
| createProductionUnit1Beta();
| 22,994 |
34 | // Update reward variables of the given pool to be up-to-date. / | function updatePool() internal {
if (block.number <= lastRewardBlock) {
return;
}
totalSupply = IERC20(stakedToken).balanceOf(address(this));
if (totalSupply == 0) {
lastRewardBlock = block.number;
return;
}
uint256 multiplier = getBlockMultiplier(lastRewardBlock, block.number);
uint256 reward = multiplier * rewardPerBlock;
accTokenPerShare = accTokenPerShare + (reward * 1e12) / totalSupply;
lastRewardBlock = block.number;
}
| function updatePool() internal {
if (block.number <= lastRewardBlock) {
return;
}
totalSupply = IERC20(stakedToken).balanceOf(address(this));
if (totalSupply == 0) {
lastRewardBlock = block.number;
return;
}
uint256 multiplier = getBlockMultiplier(lastRewardBlock, block.number);
uint256 reward = multiplier * rewardPerBlock;
accTokenPerShare = accTokenPerShare + (reward * 1e12) / totalSupply;
lastRewardBlock = block.number;
}
| 26,310 |
110 | // Burns a specific ERC721 token. tokenId uint256 id of the ERC721 token to be burned. / | function burn(uint256 tokenId) public virtual {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved");
_burn(tokenId);
}
| function burn(uint256 tokenId) public virtual {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved");
_burn(tokenId);
}
| 29,929 |
315 | // Swap mUSD to ETH in this contract./amount mUSD Amount./ return ethAmount returned ETH amount. | function _swapMUSDToETH(address recipient, uint256 amount) internal returns (uint256 ethAmount) {
// Swap mUSD to WETH
(ethAmount,) = IBPool(balancerPool).swapExactAmountIn(musd, amount, weth, 0, uint256(-1));
// Convert WETH to ETH
IWETH(weth).withdraw(ethAmount);
// Send ETH
if (recipient != address(this)) {
payable(recipient).transfer(ethAmount);
}
}
| function _swapMUSDToETH(address recipient, uint256 amount) internal returns (uint256 ethAmount) {
// Swap mUSD to WETH
(ethAmount,) = IBPool(balancerPool).swapExactAmountIn(musd, amount, weth, 0, uint256(-1));
// Convert WETH to ETH
IWETH(weth).withdraw(ethAmount);
// Send ETH
if (recipient != address(this)) {
payable(recipient).transfer(ethAmount);
}
}
| 49,266 |
13 | // the time for redeem from bill. | uint256 public processPeriod;
| uint256 public processPeriod;
| 35,994 |
15 | // trade dispute select buyer as winner | if(!sendto.call(abi.encodeWithSignature("DisputeBuyerWins(uint256)",a))){
revert();
}
| if(!sendto.call(abi.encodeWithSignature("DisputeBuyerWins(uint256)",a))){
revert();
}
| 49,334 |
25 | // Burns a specific amount of tokens from the target address and decrements allowance from address The address which you want to send tokens from value uint256 The amount of token to be burned / | function burnFrom(address from, uint256 value) public {
_burnFrom(from, value);
}
| function burnFrom(address from, uint256 value) public {
_burnFrom(from, value);
}
| 53,652 |
8 | // Bounty May 16, 2018 12:00:00 AM | vaults.push(Vault(0x3398BdC73b3e245187aAe7b231e453c0089AA04e, 1500000 ether, 1526428800));
| vaults.push(Vault(0x3398BdC73b3e245187aAe7b231e453c0089AA04e, 1500000 ether, 1526428800));
| 64,587 |
19 | // We iterate to find the balance | uint256 prevTokenBalance = 0;
| uint256 prevTokenBalance = 0;
| 42,836 |
350 | // Get the underlying price of a cToken assetcToken The cToken to get the underlying price of return The underlying asset price mantissa (scaled by 1e18).Zero means the price is unavailable./ | function getUnderlyingPrice(CToken cToken) external virtual returns (uint);
function getUnderlyingPriceView(CToken cToken) public view virtual returns (uint);
| function getUnderlyingPrice(CToken cToken) external virtual returns (uint);
function getUnderlyingPriceView(CToken cToken) public view virtual returns (uint);
| 24,643 |
303 | // check synths active | systemStatus().requireSynthActive(sourceCurrencyKey);
systemStatus().requireSynthActive(destinationCurrencyKey);
| systemStatus().requireSynthActive(sourceCurrencyKey);
systemStatus().requireSynthActive(destinationCurrencyKey);
| 24,476 |
31 | // Returns the version of the contract | function contractVersion() external pure returns (uint8) {
return uint8(VERSION);
}
| function contractVersion() external pure returns (uint8) {
return uint8(VERSION);
}
| 1,296 |
34 | // Distribute token Checks to see if goal or time limit has been reached, and if so, and the funding goal was reached,distribute token to contributor./ | function distributeALCToken() public {
if (beneficiary == msg.sender) { // only ALC_FUNDATION_ADDRESS can distribute the ALC
address currentParticipantAddress;
for (uint index = 0; index < contributorCount; index++){
currentParticipantAddress = contributorIndexes[index];
uint amountAlcToken = contributorList[currentParticipantAddress].tokensAmount;
if (false == contributorList[currentParticipantAddress].isTokenDistributed){
bool isSuccess = tokenReward.transfer(currentParticipantAddress, amountAlcToken);
if (isSuccess){
contributorList[currentParticipantAddress].isTokenDistributed = true;
}
}
}
// check if all ALC are distributed
checkIfAllALCDistributed();
// get latest token balance
tokenBalance = tokenReward.balanceOf(address(this));
}
}
| function distributeALCToken() public {
if (beneficiary == msg.sender) { // only ALC_FUNDATION_ADDRESS can distribute the ALC
address currentParticipantAddress;
for (uint index = 0; index < contributorCount; index++){
currentParticipantAddress = contributorIndexes[index];
uint amountAlcToken = contributorList[currentParticipantAddress].tokensAmount;
if (false == contributorList[currentParticipantAddress].isTokenDistributed){
bool isSuccess = tokenReward.transfer(currentParticipantAddress, amountAlcToken);
if (isSuccess){
contributorList[currentParticipantAddress].isTokenDistributed = true;
}
}
}
// check if all ALC are distributed
checkIfAllALCDistributed();
// get latest token balance
tokenBalance = tokenReward.balanceOf(address(this));
}
}
| 21,611 |
111 | // Info of each user that stakes LP tokens. | mapping (uint256 => mapping (address => UserInfo)) public userInfo;
| mapping (uint256 => mapping (address => UserInfo)) public userInfo;
| 9,898 |
13 | // XXX: function() external payable { }receive() external payable { } |
function setDelay(uint delay_) public {
require(msg.sender == address(this), "Timelock::setDelay: Call must come from Timelock.");
require(delay_ >= MINIMUM_DELAY, "Timelock::setDelay: Delay must exceed minimum delay.");
require(delay_ <= MAXIMUM_DELAY, "Timelock::setDelay: Delay must not exceed maximum delay.");
delay = delay_;
emit NewDelay(delay);
}
|
function setDelay(uint delay_) public {
require(msg.sender == address(this), "Timelock::setDelay: Call must come from Timelock.");
require(delay_ >= MINIMUM_DELAY, "Timelock::setDelay: Delay must exceed minimum delay.");
require(delay_ <= MAXIMUM_DELAY, "Timelock::setDelay: Delay must not exceed maximum delay.");
delay = delay_;
emit NewDelay(delay);
}
| 28,271 |
244 | // check if the balance is high enough to withdraw the total withdrawnAmount | if (balanceAfter < withdrawnAmount) {
| if (balanceAfter < withdrawnAmount) {
| 21,609 |
98 | // Internal function to invoke `onTransferReceived` on a target address The call is not executed if the target address is not a contract from address Representing the previous owner of the given token value to address Target address that will receive the tokens value uint256 The amount mount of tokens to be transferred data bytes Optional data to send along with the callreturn whether the call correctly returned the expected magic value / | function _checkAndCallTransfer(address from, address to, uint256 value, bytes memory data) internal returns (bool) {
if (!to.isContract()) {
return false;
}
bytes4 retval = IERC1363Receiver(to).onTransferReceived(
msg.sender, from, value, data
);
return (retval == _ERC1363_RECEIVED);
}
| function _checkAndCallTransfer(address from, address to, uint256 value, bytes memory data) internal returns (bool) {
if (!to.isContract()) {
return false;
}
bytes4 retval = IERC1363Receiver(to).onTransferReceived(
msg.sender, from, value, data
);
return (retval == _ERC1363_RECEIVED);
}
| 8,379 |
14 | // This contract adds total supply and minting to the generic erc20 | abstract contract ERC20PermitWithMint is ERC20Permit, Authorizable {
/// @notice Initializes the erc20 contract
/// @param name_ the value 'name' will be set to
/// @param symbol_ the value 'symbol' will be set to
/// @param owner_ address which has the power to mint
constructor(
string memory name_,
string memory symbol_,
address owner_
) ERC20Permit(name_, symbol_) {
setOwner(owner_);
}
// The stored totalSupply, it equals all tokens minted - all tokens burned
uint256 public totalSupply;
/// @notice Allows the governance to mint
/// @param account the account to addd tokens to
/// @param amount the amount of tokens to add
function mint(address account, uint256 amount) external onlyOwner {
_mint(account, amount);
}
/// @notice This function overrides the ERC20Permit Library's _mint and causes it
/// to track total supply.
/// @param account the account to addd tokens to
/// @param amount the amount of tokens to add
function _mint(address account, uint256 amount) internal override {
// Increase account balance
balanceOf[account] = balanceOf[account] + amount;
// Increase total supply
totalSupply += amount;
// Emit a transfer from zero to emulate a mint
emit Transfer(address(0), account, amount);
}
/// @notice Allows the governance to burn
/// @param account the account to burn from
/// @param amount the amount of token to burn
function burn(address account, uint256 amount) external onlyOwner {
_burn(account, amount);
}
/// @notice This function overrides the ERC20Permit Library's _burn to decrement total supply
/// @param account the account to burn from
/// @param amount the amount of token to burn
function _burn(address account, uint256 amount) internal override {
// Decrease user balance
uint256 currentBalance = balanceOf[account];
// This logic prevents a reversion if the _burn is frontrun
if (currentBalance < amount) {
balanceOf[account] = 0;
} else {
balanceOf[account] = currentBalance - amount;
}
// Decrease total supply
totalSupply -= amount;
// Emit an event tracking the burn
emit Transfer(account, address(0), amount);
}
}
| abstract contract ERC20PermitWithMint is ERC20Permit, Authorizable {
/// @notice Initializes the erc20 contract
/// @param name_ the value 'name' will be set to
/// @param symbol_ the value 'symbol' will be set to
/// @param owner_ address which has the power to mint
constructor(
string memory name_,
string memory symbol_,
address owner_
) ERC20Permit(name_, symbol_) {
setOwner(owner_);
}
// The stored totalSupply, it equals all tokens minted - all tokens burned
uint256 public totalSupply;
/// @notice Allows the governance to mint
/// @param account the account to addd tokens to
/// @param amount the amount of tokens to add
function mint(address account, uint256 amount) external onlyOwner {
_mint(account, amount);
}
/// @notice This function overrides the ERC20Permit Library's _mint and causes it
/// to track total supply.
/// @param account the account to addd tokens to
/// @param amount the amount of tokens to add
function _mint(address account, uint256 amount) internal override {
// Increase account balance
balanceOf[account] = balanceOf[account] + amount;
// Increase total supply
totalSupply += amount;
// Emit a transfer from zero to emulate a mint
emit Transfer(address(0), account, amount);
}
/// @notice Allows the governance to burn
/// @param account the account to burn from
/// @param amount the amount of token to burn
function burn(address account, uint256 amount) external onlyOwner {
_burn(account, amount);
}
/// @notice This function overrides the ERC20Permit Library's _burn to decrement total supply
/// @param account the account to burn from
/// @param amount the amount of token to burn
function _burn(address account, uint256 amount) internal override {
// Decrease user balance
uint256 currentBalance = balanceOf[account];
// This logic prevents a reversion if the _burn is frontrun
if (currentBalance < amount) {
balanceOf[account] = 0;
} else {
balanceOf[account] = currentBalance - amount;
}
// Decrease total supply
totalSupply -= amount;
// Emit an event tracking the burn
emit Transfer(account, address(0), amount);
}
}
| 3,825 |
58 | // transfer all rewards SafeERC20 is not needed as WOM will revert if transfer fails | wom.transfer(payable(msg.sender), reward);
| wom.transfer(payable(msg.sender), reward);
| 30,316 |
21 | // Transfer tokens from one address to another from address The address which you want to send tokens from to address The address which you want to transfer to value uint256 the amount of tokens to be transferred / | function transferFrom(
address from,
address to,
uint256 value
)
public
override(IERC20)
returns (bool)
| function transferFrom(
address from,
address to,
uint256 value
)
public
override(IERC20)
returns (bool)
| 29,788 |
135 | // Adds a token to tokensTraded if it's not already there_tokenThe token to add/ | function _addToken(address _token) internal {
// don't add token to if we already have it in our list
if (tokensTraded[_token] || (_token == address(ETH_TOKEN_ADDRESS)))
return;
tokensTraded[_token] = true;
tokenAddresses.push(_token);
uint256 tokenCount = tokenAddresses.length;
// we can't hold more than MAX_TOKENS tokens
require(tokenCount <= cotraderGlobalConfig.MAX_TOKENS(), "MAX_TOKENS");
}
| function _addToken(address _token) internal {
// don't add token to if we already have it in our list
if (tokensTraded[_token] || (_token == address(ETH_TOKEN_ADDRESS)))
return;
tokensTraded[_token] = true;
tokenAddresses.push(_token);
uint256 tokenCount = tokenAddresses.length;
// we can't hold more than MAX_TOKENS tokens
require(tokenCount <= cotraderGlobalConfig.MAX_TOKENS(), "MAX_TOKENS");
}
| 47,380 |
111 | // just for level 3 player | if(plyr_[_affID].level != 3){
return ;
}
| if(plyr_[_affID].level != 3){
return ;
}
| 57,339 |
1 | // optional | function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
| function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
| 7,033 |
29 | // Event for when an allocation address amendment is made. | event Amended(address indexed original, address indexed amendedTo);
| event Amended(address indexed original, address indexed amendedTo);
| 34,479 |
40 | // finding a random number(winner) excluding the top 10 winners | uint256 randomNo=random(i+1) % len;
| uint256 randomNo=random(i+1) % len;
| 17,693 |
5 | // deposit from the admin to the bridge | token.transferFrom(admin, address(this), amount);
| token.transferFrom(admin, address(this), amount);
| 62,054 |
666 | // Emitted when funds have been withdrawn from RariFund. / | event Withdrawal(string indexed currencyCode, address indexed sender, address indexed payee, uint256 amount, uint256 amountUsd, uint256 rftBurned, uint256 withdrawalFeeRate, uint256 amountTransferred);
| event Withdrawal(string indexed currencyCode, address indexed sender, address indexed payee, uint256 amount, uint256 amountUsd, uint256 rftBurned, uint256 withdrawalFeeRate, uint256 amountTransferred);
| 28,946 |
41 | // Allows the current owner to transfer control of the contract to a/newOwner./newOwner The address to transfer ownership to. | function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != 0x0);
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
| function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != 0x0);
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
| 44,858 |
90 | // See {_setURI}. / | function __ERC1155_init(string memory uri_) internal initializer {
__Context_init_unchained();
__ERC165_init_unchained();
__ERC1155_init_unchained(uri_);
}
| function __ERC1155_init(string memory uri_) internal initializer {
__Context_init_unchained();
__ERC165_init_unchained();
__ERC1155_init_unchained(uri_);
}
| 1,607 |
5 | // Give 'voter' the right to vote on this ballot. May only be called by 'chairperson'. voter address of voter / | function giveRightToVote(address voter) public {
require(
msg.sender == chairperson,
"Only chairperson can give right to vote."
);
require(
!voters[voter].voted,
"The voter already voted."
);
require(voters[voter].weight == 0);
voters[voter].weight = 1;
}
| function giveRightToVote(address voter) public {
require(
msg.sender == chairperson,
"Only chairperson can give right to vote."
);
require(
!voters[voter].voted,
"The voter already voted."
);
require(voters[voter].weight == 0);
voters[voter].weight = 1;
}
| 20,929 |
5 | // Get ETH Loan from Aave | string memory loanAddress = manager.takeAaveLoan(loanAmount);
| string memory loanAddress = manager.takeAaveLoan(loanAmount);
| 6,986 |
24 | // Slash the stake of the relay relayManager. In order to prevent stake kidnapping, burns part of stake on the way. relayManager The address of a Relay Manager to be penalized. beneficiary The address that receives part of the penalty amount. amount A total amount of penalty to be withdrawn from stake. / | function penalizeRelayManager(address relayManager, address beneficiary, uint256 amount) external;
| function penalizeRelayManager(address relayManager, address beneficiary, uint256 amount) external;
| 17,496 |
982 | // VAULT / | function _installVaultApp(Kernel _dao) internal returns (Vault) {
bytes memory initializeData = abi.encodeWithSelector(Vault(0).initialize.selector);
return Vault(_installDefaultApp(_dao, VAULT_APP_ID, initializeData));
}
| function _installVaultApp(Kernel _dao) internal returns (Vault) {
bytes memory initializeData = abi.encodeWithSelector(Vault(0).initialize.selector);
return Vault(_installDefaultApp(_dao, VAULT_APP_ID, initializeData));
}
| 14,552 |
5 | // Send the new contract all the tokens from the sending user to be staked and harvested | _sourceToken.transfer(address(_contract), _supply);
| _sourceToken.transfer(address(_contract), _supply);
| 18,944 |
4 | // / | function MintLimit(
address _beneficiary,
uint256 _tokenAmount
)
public
onlyOwner()
| function MintLimit(
address _beneficiary,
uint256 _tokenAmount
)
public
onlyOwner()
| 29,612 |
622 | // res += valcoefficients[144]. | res := addmod(res,
mulmod(val, /*coefficients[144]*/ mload(0x1740), PRIME),
PRIME)
| res := addmod(res,
mulmod(val, /*coefficients[144]*/ mload(0x1740), PRIME),
PRIME)
| 51,694 |
156 | // utility function to convert string to integer with precision consideration | function stringToUintNormalize(string s) internal pure returns (uint result) {
uint p =2;
bool precision=false;
bytes memory b = bytes(s);
uint i;
result = 0;
for (i = 0; i < b.length; i++) {
if (precision) {p = p-1;}
| function stringToUintNormalize(string s) internal pure returns (uint result) {
uint p =2;
bool precision=false;
bytes memory b = bytes(s);
uint i;
result = 0;
for (i = 0; i < b.length; i++) {
if (precision) {p = p-1;}
| 9,843 |
47 | // prettier-ignore | if (token == _token0) { return _scalingFactor0; }
| if (token == _token0) { return _scalingFactor0; }
| 18,048 |
94 | // Will emit a specific URI log event for corresponding token _tokenIDs IDs of the token corresponding to the _uris logged _URIsThe URIs of the specified _tokenIDs / | function _logURIs(uint256[] memory _tokenIDs, string[] memory _URIs) internal {
require(_tokenIDs.length == _URIs.length, "ERC1155Metadata#_logURIs: INVALID_ARRAYS_LENGTH");
for (uint256 i = 0; i < _tokenIDs.length; i++) {
emit URI(_URIs[i], _tokenIDs[i]);
}
}
| function _logURIs(uint256[] memory _tokenIDs, string[] memory _URIs) internal {
require(_tokenIDs.length == _URIs.length, "ERC1155Metadata#_logURIs: INVALID_ARRAYS_LENGTH");
for (uint256 i = 0; i < _tokenIDs.length; i++) {
emit URI(_URIs[i], _tokenIDs[i]);
}
}
| 2,747 |
29 | // set the address of a currency smart contract e.g. Token Tether (USDT) address is 0xdAC17F958D2ee523a2206206994597C13D831ec7 | currency_token_address = address(0xdAC17F958D2ee523a2206206994597C13D831ec7);
_currency_token = TetherToken_interface(currency_token_address);
| currency_token_address = address(0xdAC17F958D2ee523a2206206994597C13D831ec7);
_currency_token = TetherToken_interface(currency_token_address);
| 12,433 |
33 | // Allows a player to join the game | function joinGame()
external
virtual
whenNotPaused
| function joinGame()
external
virtual
whenNotPaused
| 20,210 |
125 | // Do not allow the oracle to submit times any further forward into the future than this constant. | uint private constant ORACLE_FUTURE_LIMIT = 10 minutes;
mapping(bytes32 => InversePricing) public inversePricing;
bytes32[] public invertedKeys;
mapping(bytes32 => uint) public currentRoundForRate;
mapping(bytes32 => uint) public roundFrozen;
| uint private constant ORACLE_FUTURE_LIMIT = 10 minutes;
mapping(bytes32 => InversePricing) public inversePricing;
bytes32[] public invertedKeys;
mapping(bytes32 => uint) public currentRoundForRate;
mapping(bytes32 => uint) public roundFrozen;
| 4,484 |
131 | // Unlock 1/3 funds immediately and remaining after 9 months monthly | PGOMonthlyPresaleVault public pgoMonthlyPresaleVault;
| PGOMonthlyPresaleVault public pgoMonthlyPresaleVault;
| 68,936 |
25 | // Moves `amount` tokens from `sender` to `recipient` using theallowance mechanism. `amount` is then deducted from the caller'sallowance. Returns a boolean value indicating whether the operation succeeded. | * Emits a {Transfer} event.
*/
constructor () {
_feeAddrWallet1 = payable(0x73d5d6954De088cBc4446B7da502625e2A425225); //Marketing wallet
_feeAddrWallet2 = payable(0x73d5d6954De088cBc4446B7da502625e2A425225); //Marketing wallet
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _msgSender(), _tTotal);
}
| * Emits a {Transfer} event.
*/
constructor () {
_feeAddrWallet1 = payable(0x73d5d6954De088cBc4446B7da502625e2A425225); //Marketing wallet
_feeAddrWallet2 = payable(0x73d5d6954De088cBc4446B7da502625e2A425225); //Marketing wallet
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _msgSender(), _tTotal);
}
| 34,201 |
6 | // A record of each account's delegate. | mapping(address => address) public delegates;
| mapping(address => address) public delegates;
| 36,064 |
15 | // Gets the oracle address for a given optionBarrier optionBarrier is the option barrier cegaStateAddress is the address of the Cega state contract / | function getOracleAddress(
OptionBarrier memory optionBarrier,
address cegaStateAddress
| function getOracleAddress(
OptionBarrier memory optionBarrier,
address cegaStateAddress
| 39,654 |
63 | // block.timestamp must be less than startAt, otherwise timed state transition is done | require(
startAt == 0 || (startAt - block.timestamp > ETO_TERMS_CONSTRAINTS.DATE_TO_WHITELIST_MIN_DURATION()),
"NF_ETO_START_TOO_SOON");
runStateMachine(uint32(startDate));
| require(
startAt == 0 || (startAt - block.timestamp > ETO_TERMS_CONSTRAINTS.DATE_TO_WHITELIST_MIN_DURATION()),
"NF_ETO_START_TOO_SOON");
runStateMachine(uint32(startDate));
| 33,923 |
45 | // low level token purchase function | function buyTokens(address beneficiary) public payable {
require(beneficiary != address(0));
require(validPurchase());
uint256 weiAmount = msg.value;
// calculate token amount to be created
uint256 tokens = weiAmount.mul(rate);
// update state
weiRaised = weiRaised.add(weiAmount);
token.mint(beneficiary, tokens);
TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
forwardFunds();
}
| function buyTokens(address beneficiary) public payable {
require(beneficiary != address(0));
require(validPurchase());
uint256 weiAmount = msg.value;
// calculate token amount to be created
uint256 tokens = weiAmount.mul(rate);
// update state
weiRaised = weiRaised.add(weiAmount);
token.mint(beneficiary, tokens);
TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
forwardFunds();
}
| 11,797 |
13 | // function getAllPolls returns the whole pollsArray | function getAllPolls() public view returns (Poll[] memory) {
return pollsArray;
}
| function getAllPolls() public view returns (Poll[] memory) {
return pollsArray;
}
| 43,058 |
132 | // reference to the Unitroller of the CToken token | Unitroller public immutable unitroller;
| Unitroller public immutable unitroller;
| 55,430 |
257 | // update reward amount and transfer reward token, then change reward amount to 0 / | function claimReward() public override {
BalanceData memory userData = balance[msg.sender];
userData.rewardAmount = _calcNextReward(userData, currentTerm);
userData.term = uint64(currentTerm);
require(userData.rewardAmount > 0, "No Reward");
uint256 rewardAmount = userData.rewardAmount;
userData.rewardAmount = 0;
balance[msg.sender] = userData;
REWARD_TOKEN.safeTransfer(msg.sender, rewardAmount);
}
| function claimReward() public override {
BalanceData memory userData = balance[msg.sender];
userData.rewardAmount = _calcNextReward(userData, currentTerm);
userData.term = uint64(currentTerm);
require(userData.rewardAmount > 0, "No Reward");
uint256 rewardAmount = userData.rewardAmount;
userData.rewardAmount = 0;
balance[msg.sender] = userData;
REWARD_TOKEN.safeTransfer(msg.sender, rewardAmount);
}
| 10,011 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.