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
|
---|---|---|---|---|
5 | // Error Code: Rewards pool depleted, no rewards to distribute. | uint256 public constant ERR_REWARDS_DEPLETED = 0xf03;
| uint256 public constant ERR_REWARDS_DEPLETED = 0xf03;
| 2,844 |
239 | // The value of the global index when the user's staked balance was last updated. | mapping(address => uint256) internal _USER_INDEXES_;
| mapping(address => uint256) internal _USER_INDEXES_;
| 36,382 |
164 | // --- --- similar to addToTheUsersAssignedReward(), but without the writes, plus few other modifications --- |
uint256 currentStakingDayNumber = getCurrentStakingDayNumber();
uint256 currentStakingDayNumberMinusOne = SafeMath.sub(currentStakingDayNumber, 1);
if (currentStakingDayNumber == 0) {
return 0;
}
|
uint256 currentStakingDayNumber = getCurrentStakingDayNumber();
uint256 currentStakingDayNumberMinusOne = SafeMath.sub(currentStakingDayNumber, 1);
if (currentStakingDayNumber == 0) {
return 0;
}
| 29,407 |
50 | // 10k max deposit | if (whitelistedDeposited[msg.sender] > 10000e18) {
revert("Curve/exceed-whitelist-maximum-deposit");
}
| if (whitelistedDeposited[msg.sender] > 10000e18) {
revert("Curve/exceed-whitelist-maximum-deposit");
}
| 43,557 |
561 | // res += val(coefficients[252] + coefficients[253]adjustments[4]). | res := addmod(res,
mulmod(val,
add(/*coefficients[252]*/ mload(0x23c0),
mulmod(/*coefficients[253]*/ mload(0x23e0),
| res := addmod(res,
mulmod(val,
add(/*coefficients[252]*/ mload(0x23c0),
mulmod(/*coefficients[253]*/ mload(0x23e0),
| 17,644 |
13 | // Each bet is deducted 1% in favour of the house, but no less than some minimum. The lower bound is dictated by gas costs of the settleBet transaction, providing headroom for up to 10 Gwei prices. | uint constant HOUSE_EDGE_PERCENT = 1;
uint constant HOUSE_EDGE_MINIMUM_AMOUNT = 0.0004 ether;
| uint constant HOUSE_EDGE_PERCENT = 1;
uint constant HOUSE_EDGE_MINIMUM_AMOUNT = 0.0004 ether;
| 67,549 |
21 | // Low-level wrapper if updateFlow/updateFlowByOperator.If the address of msg.sender doesn't match the address of the `sender` argument,updateFlowByOperator is invoked. In this case msg.sender needs to have permission to update flowson behalf of the given sender account with sufficient flowRateAllowance. token Super token address sender Sender address of the flow receiver Receiver address of the flow flowrate The flowrate in wad/second the flow should be updated to userData (optional) User data to be set. Should be set to zero if not needed.return bool / | function updateFlow(ISuperToken token, address sender, address receiver, int96 flowrate, bytes memory userData)
external returns (bool)
| function updateFlow(ISuperToken token, address sender, address receiver, int96 flowrate, bytes memory userData)
external returns (bool)
| 8,127 |
87 | // transfer goodwill | uint256 goodwillPortion = _transferGoodwill(_pairAddress, LPBought);
IERC20(_pairAddress).safeTransfer(
msg.sender,
SafeMath.sub(LPBought, goodwillPortion)
);
return SafeMath.sub(LPBought, goodwillPortion);
| uint256 goodwillPortion = _transferGoodwill(_pairAddress, LPBought);
IERC20(_pairAddress).safeTransfer(
msg.sender,
SafeMath.sub(LPBought, goodwillPortion)
);
return SafeMath.sub(LPBought, goodwillPortion);
| 30,268 |
126 | // Decrease length of adIds array by 1 | adIds.length--;
| adIds.length--;
| 8,188 |
1 | // compute child token template code hash | childTokenTemplateCodeHash = keccak256(minimalProxyCreationCode(_fxERC20Token));
| childTokenTemplateCodeHash = keccak256(minimalProxyCreationCode(_fxERC20Token));
| 14,636 |
123 | // This is here for when someone transfers BITX to the contract directly. We have no way of knowing who it's from, so we'll just give it to the next person who happens to buy. | uint256 bonusTokens = bitx.myTokens() + tmp - totalSupply;
| uint256 bonusTokens = bitx.myTokens() + tmp - totalSupply;
| 21,525 |
835 | // Deploys this contract and initializes the master version of the SynthSwapper contract. The address tothe Synthetix protocol's Exchanger contract is also set on deployment. / | constructor(address synthSwapperAddress)
public
ERC721("Saddle Cross-Asset Swap", "SaddleSynthSwap")
| constructor(address synthSwapperAddress)
public
ERC721("Saddle Cross-Asset Swap", "SaddleSynthSwap")
| 45,257 |
18 | // Gained some interest | assertTrue(_after > _want);
| assertTrue(_after > _want);
| 44,987 |
29 | // animal DOB | animalDOB[tokenId] = block.number;
| animalDOB[tokenId] = block.number;
| 28,564 |
42 | // Returns the collection details | function getCollection(
uint256 collectionId
| function getCollection(
uint256 collectionId
| 18,389 |
38 | // Two admnistrator can replace key of third administrator. _oldAddress Address of adminisrator needs to be replaced _newAddress Address of new administrator / | function updateAdministratorKey(address _oldAddress, address _newAddress) external onlyAdmin {
// input verifications
require( isAdministrator(_oldAddress) );
require( _newAddress != 0x00 );
require( !isAdministrator(_newAddress) );
require( msg.sender != _oldAddress );
// count confirmation
uint256 remaining;
// start of updating process, first signer will finalize address to be replaced
// and new address to be registered, remaining two must confirm
if (updating.confirmations == 0) {
updating.signer[updating.confirmations] = msg.sender;
updating.oldAddress = _oldAddress;
updating.newAddress = _newAddress;
updating.confirmations = updating.confirmations.add(1);
remaining = required.sub(updating.confirmations);
emit UpdateConfirmed(msg.sender,_newAddress,remaining);
return;
}
// violated consensus
if (updating.oldAddress != _oldAddress) {
emit Violated("Old addresses do not match",msg.sender);
ResetUpdateState();
return;
}
if (updating.newAddress != _newAddress) {
emit Violated("New addresses do not match", msg.sender);
ResetUpdateState();
return;
}
// make sure admin is not trying to spam
if (msg.sender == updating.signer[0]) {
emit Violated("Signer is spamming", msg.sender);
ResetUpdateState();
return;
}
updating.signer[updating.confirmations] = msg.sender;
updating.confirmations = updating.confirmations.add(1);
remaining = required.sub(updating.confirmations);
if (remaining == 0) {
if (msg.sender == updating.signer[0]) {
emit Violated("One of signers is spamming",msg.sender);
ResetUpdateState();
return;
}
}
emit UpdateConfirmed(msg.sender,_newAddress,remaining);
// if two confirmation are done, register new admin and remove old one
if (updating.confirmations == 2) {
emit KeyReplaced(_oldAddress, _newAddress);
ResetUpdateState();
delete administrators[_oldAddress];
administrators[_newAddress] = true;
return;
}
}
| function updateAdministratorKey(address _oldAddress, address _newAddress) external onlyAdmin {
// input verifications
require( isAdministrator(_oldAddress) );
require( _newAddress != 0x00 );
require( !isAdministrator(_newAddress) );
require( msg.sender != _oldAddress );
// count confirmation
uint256 remaining;
// start of updating process, first signer will finalize address to be replaced
// and new address to be registered, remaining two must confirm
if (updating.confirmations == 0) {
updating.signer[updating.confirmations] = msg.sender;
updating.oldAddress = _oldAddress;
updating.newAddress = _newAddress;
updating.confirmations = updating.confirmations.add(1);
remaining = required.sub(updating.confirmations);
emit UpdateConfirmed(msg.sender,_newAddress,remaining);
return;
}
// violated consensus
if (updating.oldAddress != _oldAddress) {
emit Violated("Old addresses do not match",msg.sender);
ResetUpdateState();
return;
}
if (updating.newAddress != _newAddress) {
emit Violated("New addresses do not match", msg.sender);
ResetUpdateState();
return;
}
// make sure admin is not trying to spam
if (msg.sender == updating.signer[0]) {
emit Violated("Signer is spamming", msg.sender);
ResetUpdateState();
return;
}
updating.signer[updating.confirmations] = msg.sender;
updating.confirmations = updating.confirmations.add(1);
remaining = required.sub(updating.confirmations);
if (remaining == 0) {
if (msg.sender == updating.signer[0]) {
emit Violated("One of signers is spamming",msg.sender);
ResetUpdateState();
return;
}
}
emit UpdateConfirmed(msg.sender,_newAddress,remaining);
// if two confirmation are done, register new admin and remove old one
if (updating.confirmations == 2) {
emit KeyReplaced(_oldAddress, _newAddress);
ResetUpdateState();
delete administrators[_oldAddress];
administrators[_newAddress] = true;
return;
}
}
| 82,054 |
40 | // only if compensation is active | if (dividendsAllocation > 0) {
| if (dividendsAllocation > 0) {
| 33,583 |
42 | // This should be an interface, but interfaces can't inherit yet :( | contract IKernel is IKernelEvents, IVaultRecoverable {
function acl() public view returns (IACL);
function hasPermission(address who, address where, bytes32 what, bytes how) public view returns (bool);
function setApp(bytes32 namespace, bytes32 appId, address app) public;
function getApp(bytes32 namespace, bytes32 appId) public view returns (address);
}
| contract IKernel is IKernelEvents, IVaultRecoverable {
function acl() public view returns (IACL);
function hasPermission(address who, address where, bytes32 what, bytes how) public view returns (bool);
function setApp(bytes32 namespace, bytes32 appId, address app) public;
function getApp(bytes32 namespace, bytes32 appId) public view returns (address);
}
| 5,564 |
17 | // function createJournalEntry( uint requestAmount, address payable creditor, address payable debtor, | // string memory description ) public {
// require(hasRole(OWNER_ROLE, msg.sender),"only journal owner's may create journal entry");
// JournalEntry newJournalEntry = (new JournalEntry(creatorContract, groupContract,
// msg.sender, creditor, debtor, requestAmount));
// address entryAddress = address(newJournalEntry);
// emit NewJournalEntry(creatorContract, groupContract, address(this), entryAddress,
// msg.sender, creditor, debtor, description, requestAmount, block.timestamp);
// }
| // string memory description ) public {
// require(hasRole(OWNER_ROLE, msg.sender),"only journal owner's may create journal entry");
// JournalEntry newJournalEntry = (new JournalEntry(creatorContract, groupContract,
// msg.sender, creditor, debtor, requestAmount));
// address entryAddress = address(newJournalEntry);
// emit NewJournalEntry(creatorContract, groupContract, address(this), entryAddress,
// msg.sender, creditor, debtor, description, requestAmount, block.timestamp);
// }
| 25,967 |
156 | // Deposit LP tokens to Contract for cheroes allocation. | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (pool.NFTisNeeded == true) {
require(
pool.acceptedNFT.balanceOf(address(msg.sender)) > 0,
"requires NFT token!"
);
}
if (user.amount > 0) {
uint256 pending =
user.amount.mul(pool.accCheroesPerShare).div(1e12).sub(
user.rewardDebt
);
if (pending > 0) {
safeCheroesTransfer(msg.sender, pending);
}
}
if (_amount > 0) {
pool.lpToken.safeTransferFrom(
address(msg.sender),
address(this),
_amount
);
user.amount = user.amount.add(_amount);
}
user.rewardDebt = user.amount.mul(pool.accCheroesPerShare).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 (pool.NFTisNeeded == true) {
require(
pool.acceptedNFT.balanceOf(address(msg.sender)) > 0,
"requires NFT token!"
);
}
if (user.amount > 0) {
uint256 pending =
user.amount.mul(pool.accCheroesPerShare).div(1e12).sub(
user.rewardDebt
);
if (pending > 0) {
safeCheroesTransfer(msg.sender, pending);
}
}
if (_amount > 0) {
pool.lpToken.safeTransferFrom(
address(msg.sender),
address(this),
_amount
);
user.amount = user.amount.add(_amount);
}
user.rewardDebt = user.amount.mul(pool.accCheroesPerShare).div(1e12);
emit Deposit(msg.sender, _pid, _amount);
}
| 81,787 |
13 | // See {IERC777-granularity}. This implementation always returns `1`. / | function granularity() public view virtual override returns (uint256) {
return 1;
}
| function granularity() public view virtual override returns (uint256) {
return 1;
}
| 26,486 |
31 | // Show that given messageCount falls inside of some batch and prove/return inboxAcc state. This is used to ensure that the creation of new nodes are replay protected to the state of the inbox, thereby ensuring their validity/invalidy can't be modified upon reorging the inbox contents. (wrapper in leiu of proveBatchContainsSequenceNumber for sementics)return (message count at end of target batch, inbox hash as of target batch) / | function proveInboxContainsMessage(bytes calldata proof, uint256 _messageCount)
external
view
override
returns (uint256, bytes32)
| function proveInboxContainsMessage(bytes calldata proof, uint256 _messageCount)
external
view
override
returns (uint256, bytes32)
| 22,033 |
133 | // Returns a token ID owned by `owner` at a given `index` of its token list. | * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint index) public view override returns (uint tokenId_) {
uint count;
for(uint i; i < nanokos.length; ++i){
if(owner == nanokos[i]){
if( count == index )
return i;
else
++count;
}
}
revert("ERC721Enumerable: owner index out of bounds");
}
| * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint index) public view override returns (uint tokenId_) {
uint count;
for(uint i; i < nanokos.length; ++i){
if(owner == nanokos[i]){
if( count == index )
return i;
else
++count;
}
}
revert("ERC721Enumerable: owner index out of bounds");
}
| 28,845 |
6 | // uint256 _tokenId = rewardToken.claimNFT(address(this), _duration); | stakes[_msgSender()] = Stake(payable(_msgSender()), amount, start, duration, false,_duration, 0);
totalStaked[_msgSender()] += amount;
totalStakedAmount += amount;
rewardsToClaim[_msgSender()] += 1;
emit Staked(_msgSender(), amount, duration);
| stakes[_msgSender()] = Stake(payable(_msgSender()), amount, start, duration, false,_duration, 0);
totalStaked[_msgSender()] += amount;
totalStakedAmount += amount;
rewardsToClaim[_msgSender()] += 1;
emit Staked(_msgSender(), amount, duration);
| 20,308 |
36 | // Returns all initialized (synced) assets of Silo including current and removed bridge assets/ return assets array of initialized assets of Silo | function getAssets() external view returns (address[] memory assets);
| function getAssets() external view returns (address[] memory assets);
| 24,686 |
9 | // WRITE FUNCTIONS get tokenURI | function tokenURI(uint256 tokenId) public view override returns (string memory) {
return metadata.tokenURI(tokenId);
}
| function tokenURI(uint256 tokenId) public view override returns (string memory) {
return metadata.tokenURI(tokenId);
}
| 30,637 |
7 | // The total number of pending votes cast across all groups. | uint256 total;
mapping(address => GroupPendingVotes) forGroup;
| uint256 total;
mapping(address => GroupPendingVotes) forGroup;
| 16,876 |
4 | // Throws if the sender is not the owner. / | function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
| function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
| 31,713 |
63 | // return true if crowdsale event has ended | function hasEnded() public constant returns (bool) {
return now > endTime;
}
| function hasEnded() public constant returns (bool) {
return now > endTime;
}
| 40,051 |
320 | // returns decimals value of the vault | function decimals() public view override returns (uint8) {
return vaultDecimals;
}
| function decimals() public view override returns (uint8) {
return vaultDecimals;
}
| 69,618 |
73 | // future feature | user;
token;
require(false);
| user;
token;
require(false);
| 19,131 |
10 | // Trim the { and } from the parameters | uint256 tokenID = Bytes.toUint(blob[1:uint256(index) - 1]);
uint256 blueprintLength = blob.length - uint256(index) - 3;
if (blueprintLength == 0) {
return (tokenID, bytes(""));
}
| uint256 tokenID = Bytes.toUint(blob[1:uint256(index) - 1]);
uint256 blueprintLength = blob.length - uint256(index) - 3;
if (blueprintLength == 0) {
return (tokenID, bytes(""));
}
| 24,153 |
207 | // Modifier that requires the given address to be not blacklisted _account The address to be checked / | modifier requireNotBlacklisted(address _account) {
require(!identity.isBlacklisted(_account), "Receiver is blacklisted");
_;
}
| modifier requireNotBlacklisted(address _account) {
require(!identity.isBlacklisted(_account), "Receiver is blacklisted");
_;
}
| 15,408 |
18 | // Weighted chance | if (randomNumber < momDom) {
return true;
}
| if (randomNumber < momDom) {
return true;
}
| 68,570 |
6 | // It should be the same as `prtc.balanceOf(address(this))` | prtc.transfer(beneficiary, auctionDetails.totalTokens);
| prtc.transfer(beneficiary, auctionDetails.totalTokens);
| 22,405 |
180 | // The HeroTrained event is fired when user finished a training. | event HeroTrained(uint timestamp, address indexed playerAddress, uint indexed dungeonId, uint heroGenes, uint floorNumber, uint floorGenes, bool success, uint newHeroGenes);
| event HeroTrained(uint timestamp, address indexed playerAddress, uint indexed dungeonId, uint heroGenes, uint floorNumber, uint floorGenes, bool success, uint newHeroGenes);
| 44,164 |
81 | // Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use `super` in contracts that inherit from Crowdsale to extend their validations.Example from CappedCrowdsale.sol&39;s _preValidatePurchase method:super._preValidatePurchase(beneficiary, weiAmount);require(weiRaised().add(weiAmount) <= cap); beneficiary Address performing the token purchase weiAmount Value in wei involved in the purchase / | function _preValidatePurchase(
address beneficiary,
uint256 weiAmount
)
internal
| function _preValidatePurchase(
address beneficiary,
uint256 weiAmount
)
internal
| 47,358 |
74 | // If there were 5% more blocks mined than expected then this is 5.If there were 100% more blocks mined than expected then this is 100.make it harder | miningTarget = miningTarget.sub(miningTarget.div(2000).mul(excess_block_pct_extra)); //by up to 50 %
| miningTarget = miningTarget.sub(miningTarget.div(2000).mul(excess_block_pct_extra)); //by up to 50 %
| 29,064 |
117 | // IBEP20 private constant WBNB = IBEP20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c); IBEP20 private constant CAKE = IBEP20(0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82); IBEP20 private constant BUSD = IBEP20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56); |
address public CAKE_POOL; // = 0xA527a61703D82139F8a06Bc30097cC9CAA2df5A6;
address public BNB_BUSD_POOL; // = 0x1B96B92314C44b159149f7E0303511fB2Fc4774f;
IBEP20 public WBNB;// = IBEP20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);
IBEP20 public CAKE;// = IBEP20(0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82);
IBEP20 public BUSD;// = IBEP20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);
IMasterChef public master;// = IMasterChef(0x73feaa1eE314F8c655E354234017bE2193C9E24E);
IPancakeFactory public factory;// = IPancakeFactory(0xBCfCcbde45cE874adCB698cC183deBcF17952812);
|
address public CAKE_POOL; // = 0xA527a61703D82139F8a06Bc30097cC9CAA2df5A6;
address public BNB_BUSD_POOL; // = 0x1B96B92314C44b159149f7E0303511fB2Fc4774f;
IBEP20 public WBNB;// = IBEP20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);
IBEP20 public CAKE;// = IBEP20(0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82);
IBEP20 public BUSD;// = IBEP20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);
IMasterChef public master;// = IMasterChef(0x73feaa1eE314F8c655E354234017bE2193C9E24E);
IPancakeFactory public factory;// = IPancakeFactory(0xBCfCcbde45cE874adCB698cC183deBcF17952812);
| 23,179 |
0 | // ========== VIEWS ========== // Returns total wei / | function totalEth() public view returns (uint256 total) {
return address(this).balance;
}
| function totalEth() public view returns (uint256 total) {
return address(this).balance;
}
| 16,062 |
0 | // Period inblocks an undelegate operation is delayed.The undelegate operation speed bump is to prevent a delegator from attempting to remove their delegation in anticipation of a slash. Must be greater than governance votingPeriod + executionDelay / | uint256 private undelegateLockupDuration;
| uint256 private undelegateLockupDuration;
| 17,836 |
180 | // Deploys a pool contract of a particular version factoryVersioning factory versioning contract poolVersion Version of pool contract to deploy poolParamsData Input parameters of constructor of the poolreturn pool Pool deployed / | function deployPool(
ISynthereumFactoryVersioning factoryVersioning,
uint8 poolVersion,
IDerivativeDeployment derivative,
bytes memory poolParamsData
| function deployPool(
ISynthereumFactoryVersioning factoryVersioning,
uint8 poolVersion,
IDerivativeDeployment derivative,
bytes memory poolParamsData
| 29,236 |
38 | // Check that signature data pointer (s) is in bounds (points to the length of data -> 32 bytes) | require(uint256(s).add(32) <= signatures.length, "GS022");
| require(uint256(s).add(32) <= signatures.length, "GS022");
| 296 |
113 | // changes the total amount available for borrowing loans | function changeBorrowAmountEpoch(uint currencyAmount) public auth {
reserve.file("currencyAvailable", currencyAmount);
}
| function changeBorrowAmountEpoch(uint currencyAmount) public auth {
reserve.file("currencyAvailable", currencyAmount);
}
| 6,559 |
119 | // Add ETH credit to a job to be paid out for work job the job being credited / | function addCreditETH(address job) external payable {
require(jobs[job], "addCreditETH: !job");
uint _fee = msg.value.mul(FEE).div(BASE);
credits[job][ETH] = credits[job][ETH].add(msg.value.sub(_fee));
payable(governance).transfer(_fee);
emit AddCredit(ETH, job, msg.sender, block.number, msg.value);
}
| function addCreditETH(address job) external payable {
require(jobs[job], "addCreditETH: !job");
uint _fee = msg.value.mul(FEE).div(BASE);
credits[job][ETH] = credits[job][ETH].add(msg.value.sub(_fee));
payable(governance).transfer(_fee);
emit AddCredit(ETH, job, msg.sender, block.number, msg.value);
}
| 27,209 |
1,305 | // Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address./ | function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
| function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
| 16,681 |
33 | // 设置tokenId的额度 | function setQuotaOfTokenId(uint256 tokenId, uint256 quota) public isApprovedMint{
_exists(tokenId);
_tokenOfQuota[tokenId] = quota;
}
| function setQuotaOfTokenId(uint256 tokenId, uint256 quota) public isApprovedMint{
_exists(tokenId);
_tokenOfQuota[tokenId] = quota;
}
| 16,523 |
164 | // Registers new user as voter and adds his votes | function register() public {
require(!voters[_msgSender()], "voter");
voters[_msgSender()] = true;
votes[_msgSender()] = balanceOf(_msgSender());
totalVotes = totalVotes.add(votes[_msgSender()]);
emit RegisterVoter(_msgSender(), votes[_msgSender()], totalVotes);
}
| function register() public {
require(!voters[_msgSender()], "voter");
voters[_msgSender()] = true;
votes[_msgSender()] = balanceOf(_msgSender());
totalVotes = totalVotes.add(votes[_msgSender()]);
emit RegisterVoter(_msgSender(), votes[_msgSender()], totalVotes);
}
| 54,225 |
38 | // Helper to test valid destion to transfer | modifier validDestination(address to) {
require(to != address(this));
_;
}
| modifier validDestination(address to) {
require(to != address(this));
_;
}
| 16,072 |
98 | // Structs / | struct _Trader {
address public multiSigFundWalletFactory;
address public pairedInvestments;
mapping(address => bool) public tokens;
mapping(address => mapping(uint256 => uint256)) public traderInvestments;
mapping(address => mapping(uint256 => uint256)) public investorInvestments;
mapping(address => mapping(address => _Allocation)) public allocations;
mapping(uint256 => address) public traderAddresses;
mapping(uint256 => address) public investorAddresses;
uint256 public traderCount;
uint256 public investorCount;
event Investor(address indexed user, uint256 investorId, uint256 date);
event ProfitPercentages(address indexed trader, uint16 investorCollateralProfitPercent, uint16 investorDirectProfitPercent);
event Investment(address wallet, address indexed investor, uint256 date);
event Allocate(address indexed trader, address indexed token, uint256 total, uint256 invested, uint256 date);
event Invest(uint256 id, address wallet, address indexed trader, address indexed investor, address token, uint256 amount, uint16 investorProfitPercent, uint8 investmentType, uint256 allocationInvested, uint256 allocationTotal, uint256 date);
event Stop(uint256 id, address wallet, address indexed trader, address indexed investor, address from, uint256 date);
event RequestExit(uint256 id, address wallet, address indexed trader, address indexed investor, address from, uint256 value, uint256 date);
event ApproveExit(uint256 id, address wallet, address indexed trader, address indexed investor, address from, uint256 allocationInvested, uint256 allocationTotal, uint256 date);
event RejectExit(uint256 id, address wallet, address indexed trader, uint256 value, address from, uint256 date);
address user;
uint256 investmentCount;
uint16 investorCollateralProfitPercent;
uint16 investorDirectProfitPercent;
}
| struct _Trader {
address public multiSigFundWalletFactory;
address public pairedInvestments;
mapping(address => bool) public tokens;
mapping(address => mapping(uint256 => uint256)) public traderInvestments;
mapping(address => mapping(uint256 => uint256)) public investorInvestments;
mapping(address => mapping(address => _Allocation)) public allocations;
mapping(uint256 => address) public traderAddresses;
mapping(uint256 => address) public investorAddresses;
uint256 public traderCount;
uint256 public investorCount;
event Investor(address indexed user, uint256 investorId, uint256 date);
event ProfitPercentages(address indexed trader, uint16 investorCollateralProfitPercent, uint16 investorDirectProfitPercent);
event Investment(address wallet, address indexed investor, uint256 date);
event Allocate(address indexed trader, address indexed token, uint256 total, uint256 invested, uint256 date);
event Invest(uint256 id, address wallet, address indexed trader, address indexed investor, address token, uint256 amount, uint16 investorProfitPercent, uint8 investmentType, uint256 allocationInvested, uint256 allocationTotal, uint256 date);
event Stop(uint256 id, address wallet, address indexed trader, address indexed investor, address from, uint256 date);
event RequestExit(uint256 id, address wallet, address indexed trader, address indexed investor, address from, uint256 value, uint256 date);
event ApproveExit(uint256 id, address wallet, address indexed trader, address indexed investor, address from, uint256 allocationInvested, uint256 allocationTotal, uint256 date);
event RejectExit(uint256 id, address wallet, address indexed trader, uint256 value, address from, uint256 date);
address user;
uint256 investmentCount;
uint16 investorCollateralProfitPercent;
uint16 investorDirectProfitPercent;
}
| 38,732 |
40 | // Check if the given nft address and intervalSeconds has initialized _market: nft contract address _intervalSeconds: intervalSecondsreturn bool whether the market and interval exists / | function _isValidMarketAndInterval(address _market, uint256 _intervalSeconds) internal view returns (bool) {
return _isExistingMarket(_market) && markets[_market].periods[_intervalSeconds].intervalSeconds != 0;
}
| function _isValidMarketAndInterval(address _market, uint256 _intervalSeconds) internal view returns (bool) {
return _isExistingMarket(_market) && markets[_market].periods[_intervalSeconds].intervalSeconds != 0;
}
| 16,904 |
473 | // Deploys a fund with the given parameters by transiently setting the parameters storage slot and then/ clearing it after deploying the fund./controller The controller address/manager The manager address of this fund/token The local token address/descriptor 32 bytes string descriptor, 8 bytes manager name + 24 bytes brief description | function deploy(
address WETH9,
address uniswapV3Factory,
address uniswapV3Router,
address controller,
address manager,
address token,
bytes32 descriptor
| function deploy(
address WETH9,
address uniswapV3Factory,
address uniswapV3Router,
address controller,
address manager,
address token,
bytes32 descriptor
| 27,166 |
27 | // Contract Admin | admin[0x7cfa1051b7130edfac6eb71d17a849847cf6b7e7ad0b33fad4e124841e5acfbc] = true;
| admin[0x7cfa1051b7130edfac6eb71d17a849847cf6b7e7ad0b33fad4e124841e5acfbc] = true;
| 46,369 |
128 | // Safely mints `tokenId` and transfers it to `to`. Requirements: - `tokenId` must not exist. | * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
| * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
| 3,633 |
54 | // reward rate 72.00% per year | uint public constant rewardRate = 7200;
uint public constant rewardInterval = 365 days;
| uint public constant rewardRate = 7200;
uint public constant rewardInterval = 365 days;
| 40,760 |
1 | // Keeps track of the current ERC721 Token addresses allowed for this votation (ARTE/ETRA) | mapping(address => bool) private _allowedTokenAddresses;
| mapping(address => bool) private _allowedTokenAddresses;
| 34,525 |
69 | // planetFusionThe contract planetFusion contains Planets fusionning methods, time before fusion, and birth/destruction of planets./ | contract planetFusion is PlanetOwnership{
uint256 public fusionFee = 0.0001 ether;
// @dev Event Fusion fires when two planets successfully begin a fusion.
event Fusion(address owner, uint256 planet1ID, uint256 planet2ID, uint256 time);
/// @dev The address of the fusioning contract that is used to implement the fusion
FusionInterface fusionInterface;
function setFusionContractAddress(address _address) external onlyOwner {
fusionInterface = FusionInterface(_address);
}
// @dev Update the fusion fee. Only possible by the owner.
function setFusionFee(uint256 val) external onlyOwner {
fusionFee = val;
}
// @dev Checks if both planets are owned by the same owner to be able to fusion
function _isFusionOwnership(uint256 planet1ID, uint256 planet2ID) internal view returns (bool) {
return (planetToOwner[planet1ID] == planetToOwner[planet2ID]);
}
// @dev Checks if a planet is available to fusion.
function _isFusionnable(Planet storage _planet) internal view returns (bool) {
return (_planet.readyTime <= now);
}
// @dev Set the cooldownTime for a planet
function _triggerFusionCooldown(Planet storage _planet) internal {
_planet.readyTime = uint32(now + fusionTime);
}
// Checks that a given planet is able to fusion.
// @param _planetId is the id of the planet
function isReadyToFusion(uint256 _planetId) public view returns (bool) {
require(_planetId > 0);
Planet storage planetReadyFusion = planets[_planetId];
return _isFusionnable(planetReadyFusion);
}
/// @dev Checks whether a planet is currently being fusionned
/// @param _planetId reference the id of the kitten, any user can inquire about it
function isFusioning(uint256 _planetId) public view returns (bool)
{
require(_planetId > 0);
return planets[_planetId].fusionState != 0;
}
// @dev Handle all specifix cases where a fusion is not possible
function _isValidFusion(Planet storage _planet1, uint256 _planet1_id, Planet storage _planet2, uint256 _planet2_id) private view returns (bool){
// Can't fusion with itself
if (_planet1_id == _planet2_id) {
return false;
}
// Add the mouvement restriction here
//if ( (_planet1.positionx*2 + _planet2.positionx*2) - (_planet1.positiony*2 + _planet2.positiony*2) <= 0 ) {
// return true;
//}
return true;
}
/// @notice Checks to see if two planets can fusion, including checks for
/// ownership and time for fusion.
function canFusion(uint256 _planet1Id, uint256 _planet2Id) external view returns (bool) {
require (_planet1Id > 0);
require (_planet2Id > 0);
Planet storage planet1 = planets[_planet1Id];
Planet storage planet2 = planets[_planet2Id];
return _isValidFusion(planet1, _planet1Id, planet2, _planet2Id) && _isFusionnable(planet1) && _isFusionnable(planet2) && _isFusionOwnership(_planet1Id,_planet2Id);
}
}
| contract planetFusion is PlanetOwnership{
uint256 public fusionFee = 0.0001 ether;
// @dev Event Fusion fires when two planets successfully begin a fusion.
event Fusion(address owner, uint256 planet1ID, uint256 planet2ID, uint256 time);
/// @dev The address of the fusioning contract that is used to implement the fusion
FusionInterface fusionInterface;
function setFusionContractAddress(address _address) external onlyOwner {
fusionInterface = FusionInterface(_address);
}
// @dev Update the fusion fee. Only possible by the owner.
function setFusionFee(uint256 val) external onlyOwner {
fusionFee = val;
}
// @dev Checks if both planets are owned by the same owner to be able to fusion
function _isFusionOwnership(uint256 planet1ID, uint256 planet2ID) internal view returns (bool) {
return (planetToOwner[planet1ID] == planetToOwner[planet2ID]);
}
// @dev Checks if a planet is available to fusion.
function _isFusionnable(Planet storage _planet) internal view returns (bool) {
return (_planet.readyTime <= now);
}
// @dev Set the cooldownTime for a planet
function _triggerFusionCooldown(Planet storage _planet) internal {
_planet.readyTime = uint32(now + fusionTime);
}
// Checks that a given planet is able to fusion.
// @param _planetId is the id of the planet
function isReadyToFusion(uint256 _planetId) public view returns (bool) {
require(_planetId > 0);
Planet storage planetReadyFusion = planets[_planetId];
return _isFusionnable(planetReadyFusion);
}
/// @dev Checks whether a planet is currently being fusionned
/// @param _planetId reference the id of the kitten, any user can inquire about it
function isFusioning(uint256 _planetId) public view returns (bool)
{
require(_planetId > 0);
return planets[_planetId].fusionState != 0;
}
// @dev Handle all specifix cases where a fusion is not possible
function _isValidFusion(Planet storage _planet1, uint256 _planet1_id, Planet storage _planet2, uint256 _planet2_id) private view returns (bool){
// Can't fusion with itself
if (_planet1_id == _planet2_id) {
return false;
}
// Add the mouvement restriction here
//if ( (_planet1.positionx*2 + _planet2.positionx*2) - (_planet1.positiony*2 + _planet2.positiony*2) <= 0 ) {
// return true;
//}
return true;
}
/// @notice Checks to see if two planets can fusion, including checks for
/// ownership and time for fusion.
function canFusion(uint256 _planet1Id, uint256 _planet2Id) external view returns (bool) {
require (_planet1Id > 0);
require (_planet2Id > 0);
Planet storage planet1 = planets[_planet1Id];
Planet storage planet2 = planets[_planet2Id];
return _isValidFusion(planet1, _planet1Id, planet2, _planet2Id) && _isFusionnable(planet1) && _isFusionnable(planet2) && _isFusionOwnership(_planet1Id,_planet2Id);
}
}
| 32,294 |
8 | // Sending ether to function | address payable a_payable = payable(address(a));
a_payable.transfer(100);
| address payable a_payable = payable(address(a));
a_payable.transfer(100);
| 21,618 |
174 | // limit our copy to 256 bytes | _toCopy := returndatasize()
if gt(_toCopy, _maxCopy) {
_toCopy := _maxCopy
}
| _toCopy := returndatasize()
if gt(_toCopy, _maxCopy) {
_toCopy := _maxCopy
}
| 22,680 |
83 | // Interface of ERC721 token receiver. / | interface ERC721A__IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
| interface ERC721A__IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
| 36,569 |
12 | // == SET INTERNAL VARIABLES==/ Change the governance contractonly mastermind is allowed to do this _gov_contract Governance contract address / | function setGovernanceContract(address _gov_contract) external onlyMastermind {
require(_gov_contract.isContract(), "_gov_contract should be a contract");
gov_contract = _gov_contract;
}
| function setGovernanceContract(address _gov_contract) external onlyMastermind {
require(_gov_contract.isContract(), "_gov_contract should be a contract");
gov_contract = _gov_contract;
}
| 50,050 |
71 | // ====== INTERNAL FUNCTIONS ====== // / | function adjust( uint _index ) internal {
Adjust memory adjustment = adjustments[ _index ];
if ( adjustment.rate != 0 ) {
if ( adjustment.add ) { // if rate should increase
info[ _index ].rate = info[ _index ].rate.add( adjustment.rate ); // raise rate
if ( info[ _index ].rate >= adjustment.target ) { // if target met
adjustments[ _index ].rate = 0; // turn off adjustment
}
} else { // if rate should decrease
info[ _index ].rate = info[ _index ].rate.sub( adjustment.rate ); // lower rate
if ( info[ _index ].rate <= adjustment.target ) { // if target met
adjustments[ _index ].rate = 0; // turn off adjustment
}
}
}
}
| function adjust( uint _index ) internal {
Adjust memory adjustment = adjustments[ _index ];
if ( adjustment.rate != 0 ) {
if ( adjustment.add ) { // if rate should increase
info[ _index ].rate = info[ _index ].rate.add( adjustment.rate ); // raise rate
if ( info[ _index ].rate >= adjustment.target ) { // if target met
adjustments[ _index ].rate = 0; // turn off adjustment
}
} else { // if rate should decrease
info[ _index ].rate = info[ _index ].rate.sub( adjustment.rate ); // lower rate
if ( info[ _index ].rate <= adjustment.target ) { // if target met
adjustments[ _index ].rate = 0; // turn off adjustment
}
}
}
}
| 28,521 |
67 | // Getter function since constants can't be read directly from libraries. / | function preciseUnit() internal pure returns (uint256) {
return PRECISE_UNIT;
}
| function preciseUnit() internal pure returns (uint256) {
return PRECISE_UNIT;
}
| 25,509 |
19 | // Increment raised amount | raisedAmount = raisedAmount.add(msg.value);
| raisedAmount = raisedAmount.add(msg.value);
| 43,507 |
3 | // Claim NFTs | function claimNFTs(
address cToken,
uint256[] calldata redeemTokenIndexes,
address to
) external;
| function claimNFTs(
address cToken,
uint256[] calldata redeemTokenIndexes,
address to
) external;
| 32,727 |
328 | // Transfer Special Fee token to Fee address | if(isSpecial) {
| if(isSpecial) {
| 37,189 |
9 | // Admin function to remove a contract from Controller/termContractterm contract address to remove | function unmarkTermDeployed(address termContract) external;
| function unmarkTermDeployed(address termContract) external;
| 35,500 |
32 | // Accept the decision made by a clerk. Available for anyone after a certain time.purchase The address of the agreement/ | function finalizeClerkDecision(address purchase)
public
inState(purchase, AgreementData.State.Appeal)
condition(now > arrivalTime[purchase] + day)
| function finalizeClerkDecision(address purchase)
public
inState(purchase, AgreementData.State.Appeal)
condition(now > arrivalTime[purchase] + day)
| 15,459 |
91 | // A = A - y B = B + amount | poolA = poolA - y;
poolB = poolB + amount;
a.mint(_msgSender(), _a);
emit Swap(_msgSender(), false, amount, y);
doTransferIn(baseToken, _msgSender(), amount);
| poolA = poolA - y;
poolB = poolB + amount;
a.mint(_msgSender(), _a);
emit Swap(_msgSender(), false, amount, y);
doTransferIn(baseToken, _msgSender(), amount);
| 25,142 |
4 | // openzep bases | AccessControlEnumerable, ERC721Enumerable,
| AccessControlEnumerable, ERC721Enumerable,
| 67,353 |
83 | // Calculates floor(xy / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0with further edits by Uniswap Labs also under MIT license. / | function mulDiv(
uint256 x,
uint256 y,
uint256 denominator
| function mulDiv(
uint256 x,
uint256 y,
uint256 denominator
| 18,073 |
14 | // Any action before `startStakingBlockIndex` is treated as acted in block `startStakingBlockIndex`. | if (block.number < startStakingBlockIndex) {
_stakingRecords[staker].blockIndex = startStakingBlockIndex;
}
| if (block.number < startStakingBlockIndex) {
_stakingRecords[staker].blockIndex = startStakingBlockIndex;
}
| 23,547 |
0 | // IGame interface/ | interface IGame {
function isGame() external pure returns (bool);
function balanceOf(address player) external view returns (uint256);
function deposit(IERC20 token, uint256 amount) external returns (bool);
function withdraw(
IERC20 token,
uint256 amount,
bytes calldata data,
bytes calldata proof
) external returns (bool);
event Proved(
address indexed player,
bytes32 gamehash
);
}
| interface IGame {
function isGame() external pure returns (bool);
function balanceOf(address player) external view returns (uint256);
function deposit(IERC20 token, uint256 amount) external returns (bool);
function withdraw(
IERC20 token,
uint256 amount,
bytes calldata data,
bytes calldata proof
) external returns (bool);
event Proved(
address indexed player,
bytes32 gamehash
);
}
| 13,231 |
9 | // State changes | controllerAddress = controllerAddr;
| controllerAddress = controllerAddr;
| 41,491 |
62 | // Settling liquidity tokens is a bit more involved since we need to remove money from the collateral pools. This function returns the amount of fCash the liquidity token has a claim to. | address cashMarket = fcg.cashMarket;
| address cashMarket = fcg.cashMarket;
| 32,744 |
607 | // Check the signature type | require(signature.toUint8(0) == L2_SIGNATURE_TYPE, "INVALID_SIGNATURE_TYPE");
| require(signature.toUint8(0) == L2_SIGNATURE_TYPE, "INVALID_SIGNATURE_TYPE");
| 44,184 |
39 | // Calculate pending rewards and amount to transfer (to the sender) | uint256 pendingRewards = ((userInfo[msg.sender].amount * accTokenPerShare) /
PRECISION_FACTOR) - userInfo[msg.sender].rewardDebt;
uint256 amountToTransfer = userInfo[msg.sender].amount + pendingRewards;
| uint256 pendingRewards = ((userInfo[msg.sender].amount * accTokenPerShare) /
PRECISION_FACTOR) - userInfo[msg.sender].rewardDebt;
uint256 amountToTransfer = userInfo[msg.sender].amount + pendingRewards;
| 15,108 |
3 | // If the ending address sends the ending amount, block all deposits | if (msg.sender == END_ADDRESS && msg.value == END_AMOUNT)
{
ended = true;
RECEIVER_ADDRESS.transfer(this.balance);
return;
}
| if (msg.sender == END_ADDRESS && msg.value == END_AMOUNT)
{
ended = true;
RECEIVER_ADDRESS.transfer(this.balance);
return;
}
| 23,929 |
44 | // @REVIEW: use to transfer all stored value from vault to a new smart contract To called when upgrading the smart contract | function clearVault(address recipient) external onlyOwner returns (bool) {
// @TODO: - review
uint256 value = address(this).balance;
payable(recipient).transfer(value);
emit Transfer(msg.sender, recipient, value);
return true;
}
| function clearVault(address recipient) external onlyOwner returns (bool) {
// @TODO: - review
uint256 value = address(this).balance;
payable(recipient).transfer(value);
emit Transfer(msg.sender, recipient, value);
return true;
}
| 28,775 |
9 | // Event fired uppon creating an new version | event CreateNewVersionEvent(uint commitId, string tag);
| event CreateNewVersionEvent(uint commitId, string tag);
| 26,242 |
4 | // Called by Polymath to verify modules for SecurityToken to use.A module can not be used by an ST unless first approved/verified by Polymath(The only exception to this is that the author of the module is the owner of the ST - Only if enabled by the FeatureRegistry)_moduleFactory is the address of the module factory to be registered/ | function verifyModule(address _moduleFactory, bool _verified) external;
| function verifyModule(address _moduleFactory, bool _verified) external;
| 50,353 |
12 | // The token contract is on the specified chain / | struct TokensOnChain {
// Token contract address
address token;
// Specified chain ID
uint256 chainId;
}
| struct TokensOnChain {
// Token contract address
address token;
// Specified chain ID
uint256 chainId;
}
| 12,716 |
129 | // If it is after expiry, we need to redeem the profits | IController.ActionArgs[] memory actions =
new IController.ActionArgs[](1);
actions[0] = IController.ActionArgs(
IController.ActionType.Redeem,
address(0), // not used
address(this), // address to send profits to
oldOption, // address of otoken
0, // not used
oldOptionBalance, // otoken balance
| IController.ActionArgs[] memory actions =
new IController.ActionArgs[](1);
actions[0] = IController.ActionArgs(
IController.ActionType.Redeem,
address(0), // not used
address(this), // address to send profits to
oldOption, // address of otoken
0, // not used
oldOptionBalance, // otoken balance
| 59,272 |
8 | // return postIds array | function getPostIds() public view returns(uint[] memory){
return postIdsArray;
}
| function getPostIds() public view returns(uint[] memory){
return postIdsArray;
}
| 44,689 |
61 | // If the governance opts haven't already been validated, make sure that it hasn't been tampered with. | if (!governanceOptsAlreadyValidated) {
_assertValidGovernanceOpts(governanceOpts);
}
| if (!governanceOptsAlreadyValidated) {
_assertValidGovernanceOpts(governanceOpts);
}
| 31,295 |
1,563 | // In case something is left in contract, owner is able to withdraw it/_token address of token to withdraw balance | function withdrawToken(address _token) public onlyOwner {
uint balance = ERC20(_token).balanceOf(address(this));
ERC20(_token).safeTransfer(msg.sender, balance);
}
| function withdrawToken(address _token) public onlyOwner {
uint balance = ERC20(_token).balanceOf(address(this));
ERC20(_token).safeTransfer(msg.sender, balance);
}
| 49,660 |
160 | // Fetch the serialized order data with the given index ser_data Serialized order data index The index of order to be fetchedreturn order_data The fetched order data / | function _getOrder(bytes memory ser_data, uint index) internal pure returns (bytes memory order_data) {
require(index < _getOrderCount(ser_data));
order_data = ser_data.slice(ORDER_SIZE.mul(index), ORDER_SIZE);
}
| function _getOrder(bytes memory ser_data, uint index) internal pure returns (bytes memory order_data) {
require(index < _getOrderCount(ser_data));
order_data = ser_data.slice(ORDER_SIZE.mul(index), ORDER_SIZE);
}
| 32,104 |
39 | // Registering new proposals | function registerProposal(uint org_Id, uint cont_Id, string memory prop_Desc, string memory prop_Title, uint cost) public
| function registerProposal(uint org_Id, uint cont_Id, string memory prop_Desc, string memory prop_Title, uint cost) public
| 22,363 |
334 | // If the ETH transfer fails (sigh), wrap the ETH and try send it as WETH. | if (!success) {
weth.deposit{value: _amount}();
| if (!success) {
weth.deposit{value: _amount}();
| 38,040 |
192 | // Will be used to pause/end the sale. / | function deactivateSale() public onlyOwner {
saleIsActive = false;
}
| function deactivateSale() public onlyOwner {
saleIsActive = false;
}
| 24,313 |
252 | // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . | if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
uint256 nextTokenId = tokenId + 1;
| if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
uint256 nextTokenId = tokenId + 1;
| 18,409 |
4 | // Internal Functions//Computes the hash of a name. _name Name to compute a hash for.return Hash of the given name. / | function _getNameHash(
string memory _name
)
internal
pure
returns (
bytes32
)
| function _getNameHash(
string memory _name
)
internal
pure
returns (
bytes32
)
| 39,945 |
95 | // check that the close period has been set | require(closeTimestamp != 0, "Withdraw not initiated");
| require(closeTimestamp != 0, "Withdraw not initiated");
| 21,514 |
3 | // Get deployed token for given token ID./tokenId uint256 token ID./ return IEmint1155 interface to deployed Emint1155 token contract. | function token(uint256 tokenId) external view returns (IEmint1155);
| function token(uint256 tokenId) external view returns (IEmint1155);
| 17,086 |
106 | // get total reward still available (= 0 if rewardPerBlock = 0) | require(setup.rewardPerBlock * remainingBlocks > 0, "No rewards");
| require(setup.rewardPerBlock * remainingBlocks > 0, "No rewards");
| 3,490 |
67 | // Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is internal function is equivalent to `approve`, and can be used toe.g. set automatic allowances for certain subsystems, etc. Emits an `Approval` event. Requirements: - `owner` cannot be the zero address.- `spender` cannot be the zero address. / | function _approve(address owner, address spender, uint256 value) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
| function _approve(address owner, address spender, uint256 value) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
| 38,065 |
206 | // calculates the transferID depending on DVD transfer parameters_nonce the nonce of the transfer on the smart contract_maker the address of the DVD transfer maker (initiator of the transfer)_token1 the address of the token that the maker is providing_token1Amount the amount of tokens `_token1` provided by the maker_taker the address of the DVD transfer taker (executor of the transfer)_token2 the address of the token that the taker is providing_token2Amount the amount of tokens `_token2` provided by the taker return the identifier of the DVD transfer as a byte signature / | function calculateTransferID (
uint256 _nonce,
address _maker,
address _token1,
uint256 _token1Amount,
address _taker,
address _token2,
uint256 _token2Amount
| function calculateTransferID (
uint256 _nonce,
address _maker,
address _token1,
uint256 _token1Amount,
address _taker,
address _token2,
uint256 _token2Amount
| 71,332 |
120 | // Set last rebalance information | function setMinRebalanceAmount(uint256 _minRebalanceAmount)
external
onlyOwner
| function setMinRebalanceAmount(uint256 _minRebalanceAmount)
external
onlyOwner
| 48,936 |
17 | // if (unstakeTimestamp[i] != 0 && checkTimestamp(unstakeTimestamp[i]) >= UNSTAKE_TIME) { | if (isValidUnstake(i)) {
storeValues[count] = i;
storeAmounts[count] = users[i].stakingAmount;
count++;
}
| if (isValidUnstake(i)) {
storeValues[count] = i;
storeAmounts[count] = users[i].stakingAmount;
count++;
}
| 15,468 |
228 | // Set the deposit paused flag to true to allow rebasing. / | function unpauseRebase() external onlyGovernor {
rebasePaused = false;
emit RebaseUnpaused();
}
| function unpauseRebase() external onlyGovernor {
rebasePaused = false;
emit RebaseUnpaused();
}
| 46,355 |
Subsets and Splits