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 |
|---|---|---|---|---|
111 | // Claims the claimable rewards for the specified maximum number of past periods, starting at the next claimable period.Claims can be done only for periods which have already ended.The maximum number of periods to claim can be calibrated to chunk down claims in several transactions to accomodate gas constraints. Revert... | function claimRewards(uint16 maxPeriods) external isEnabled hasStarted {
NextClaim memory nextClaim = nextClaims[msg.sender];
(ComputedClaim memory claim, NextClaim memory newNextClaim) = _computeRewards(msg.sender, maxPeriods);
// free up memory on already processed staker snapshots
... | function claimRewards(uint16 maxPeriods) external isEnabled hasStarted {
NextClaim memory nextClaim = nextClaims[msg.sender];
(ComputedClaim memory claim, NextClaim memory newNextClaim) = _computeRewards(msg.sender, maxPeriods);
// free up memory on already processed staker snapshots
... | 46,452 |
4 | // Each operator / verifier submits an encrypted proposal, where each proposal/is a unique (per cycle) to avoid propsal peeking. When we start proposing,/we need one of the following:/1. a clear state (counters must be cleared)/2. OR, if nobody revealed in previous cycle, we continue previous state/ with all previous g... | function propose(bytes32 _blindedProposal, uint256 _blockHeight)
external
whenProposePhase
| function propose(bytes32 _blindedProposal, uint256 _blockHeight)
external
whenProposePhase
| 38,352 |
16 | // metadata | string public constant name = "User Experience";
string public constant symbol = "UEC";
uint256 public constant decimals = 18;
string public version = "1.0";
| string public constant name = "User Experience";
string public constant symbol = "UEC";
uint256 public constant decimals = 18;
string public version = "1.0";
| 39,649 |
188 | // require(_strategy != address(0), "V:10");require(IStrategy(_strategy).underlying() == address(underlying()), "V:11");require(IStrategy(_strategy).vault() == address(this), "V:12"); | _setStrategy(_strategy);
| _setStrategy(_strategy);
| 31,392 |
70 | // vest the sale contributor tokens 100% release after 1 year | function vestCmd1YearInstantInt(address _beneficiary, uint256 _tokensAmountInt) external onlyOwner {
vestTokensFromNowInt(_beneficiary, _tokensAmountInt, 0, lock365Days, lock365Days);
}
| function vestCmd1YearInstantInt(address _beneficiary, uint256 _tokensAmountInt) external onlyOwner {
vestTokensFromNowInt(_beneficiary, _tokensAmountInt, 0, lock365Days, lock365Days);
}
| 5,414 |
25 | // These external functions trigger accrual on the dToken and backing cToken. | function mint(uint256 underlyingToSupply) external returns (uint256 dTokensMinted);
function redeem(uint256 dTokensToBurn) external returns (uint256 underlyingReceived);
function redeemUnderlying(uint256 underlyingToReceive) external returns (uint256 dTokensBurned);
| function mint(uint256 underlyingToSupply) external returns (uint256 dTokensMinted);
function redeem(uint256 dTokensToBurn) external returns (uint256 underlyingReceived);
function redeemUnderlying(uint256 underlyingToReceive) external returns (uint256 dTokensBurned);
| 52,576 |
158 | // Standard token contract with overflow protection | contract StandardToken is Token, StandardTokenData {
using Math for *;
/*
* Public functions
*/
/// @dev Transfers sender's tokens to a given address. Returns success
/// @param to Address of token receiver
/// @param value Number of tokens to transfer
/// @return Was transfer succes... | contract StandardToken is Token, StandardTokenData {
using Math for *;
/*
* Public functions
*/
/// @dev Transfers sender's tokens to a given address. Returns success
/// @param to Address of token receiver
/// @param value Number of tokens to transfer
/// @return Was transfer succes... | 55,165 |
54 | // add by XSwapProxy | function addPoolSig(bytes32 sig) external;
| function addPoolSig(bytes32 sig) external;
| 29,041 |
119 | // Sets Origamasks Address for withdraw(), reserved tokens, and ERC2981 royaltyInfo | address payable public origamasksAddress;
| address payable public origamasksAddress;
| 29,850 |
263 | // Check status | if (position.status) {
int24 middleTick = (position.lowerTick + position.upperTick) / 2;
if (middleTick - tick >= reBalanceThreshold) {
status = true;
lowerRebalance = true;
}else if(tick - middleTick >= reBalanceThreshold){
| if (position.status) {
int24 middleTick = (position.lowerTick + position.upperTick) / 2;
if (middleTick - tick >= reBalanceThreshold) {
status = true;
lowerRebalance = true;
}else if(tick - middleTick >= reBalanceThreshold){
| 28,701 |
195 | // Optimistically get pair | wrappedTokenUniswapPair = IUniswapV2Factory(coreGlobals.UniswapFactory()).getPair(COREToken , wrappedToken);
if(wrappedTokenUniswapPair == address(0)) { // Pair doesn't exist yet
| wrappedTokenUniswapPair = IUniswapV2Factory(coreGlobals.UniswapFactory()).getPair(COREToken , wrappedToken);
if(wrappedTokenUniswapPair == address(0)) { // Pair doesn't exist yet
| 11,333 |
25 | // return deadline for playing | function getDeadlineTime() public view returns(uint256) {
return _launchDay + _GAME_DEADLINE;
}
| function getDeadlineTime() public view returns(uint256) {
return _launchDay + _GAME_DEADLINE;
}
| 786 |
67 | // Copy remaining bytes | uint256 mask = 256 ** (32 - _len) - 1;
assembly {
let srcpart := and(mload(_src), not(mask))
let destpart := and(mload(_dest), mask)
mstore(_dest, or(destpart, srcpart))
}
| uint256 mask = 256 ** (32 - _len) - 1;
assembly {
let srcpart := and(mload(_src), not(mask))
let destpart := and(mload(_dest), mask)
mstore(_dest, or(destpart, srcpart))
}
| 6,883 |
69 | // Function - TotalBurn returns the amount of tokens burned/ | function totalBurn() public view returns (uint256) {
return _tBurnTotal;
}
| function totalBurn() public view returns (uint256) {
return _tBurnTotal;
}
| 27,604 |
107 | // Available to unlock funds for the date. Constant. | function getShare(address _owner, uint256 _date) public view returns(uint256){
uint256 date = groupDates(_date);
return queue[_owner][date];
}
| function getShare(address _owner, uint256 _date) public view returns(uint256){
uint256 date = groupDates(_date);
return queue[_owner][date];
}
| 29,846 |
155 | // ========== ADMIN ========== / | function addSwapStrategy(address _strategy) onlyAdmin external {
strategies.add(_strategy);
}
| function addSwapStrategy(address _strategy) onlyAdmin external {
strategies.add(_strategy);
}
| 7,712 |
28 | // Buys NFTs from the pool, paying with base tokens from the caller. Then transfers the bought NFTs to the/ caller. The net cost depends on the current price, fee rate and assigned NFT weights./DO NOT call this function directly unless you know what you are doing. Instead, use a wrapper contract that/ will check the ma... | function buy(uint256[] calldata tokenIds, uint256[] calldata tokenWeights, MerkleMultiProof calldata proof)
public
payable
returns (uint256 netInputAmount, uint256 feeAmount, uint256 protocolFeeAmount)
| function buy(uint256[] calldata tokenIds, uint256[] calldata tokenWeights, MerkleMultiProof calldata proof)
public
payable
returns (uint256 netInputAmount, uint256 feeAmount, uint256 protocolFeeAmount)
| 24,805 |
51 | // voting window is one day long, starts at deadline and ends at deadline + 1 days | block.timestamp < startTimestamp + 1 days
);
_;
| block.timestamp < startTimestamp + 1 days
);
_;
| 16,415 |
35 | // Transfer tokens when not paused / | function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transfer(_to, _value);
}
| function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transfer(_to, _value);
}
| 7,599 |
164 | // Main entry point, it will move or transform a loan/If the operation doesn't require exchange send empty data | function moveLoan(
LoanShiftData memory _loanShift,
SaverExchangeCore.ExchangeData memory _exchangeData
| function moveLoan(
LoanShiftData memory _loanShift,
SaverExchangeCore.ExchangeData memory _exchangeData
| 31,379 |
274 | // Validate Dharma signing key signature unless it is `msg.sender`. | if (msg.sender != dharmaSigningKey) {
if (dharmaSigningKey != messageHash.RECOVER845(dharmaSignature)) {
revert(_REVERTREASON31(21));
}
| if (msg.sender != dharmaSigningKey) {
if (dharmaSigningKey != messageHash.RECOVER845(dharmaSignature)) {
revert(_REVERTREASON31(21));
}
| 27,382 |
14 | // Possibly need to check max gasprice and usedGas here to limit possibility for abuse. | uint256 gasCost = usedGas * tx.gasprice;
| uint256 gasCost = usedGas * tx.gasprice;
| 28,518 |
12 | // First we need to get the size of the array we want to fill | for (int256 i = 0; i < totalCount; i++) {
AssetListing current = idToAssetListing[i + 1];
bool soldOut = IAssetManager(current.assetManager).isSoldOut();
if (!soldOut) {
count += 1;
}
| for (int256 i = 0; i < totalCount; i++) {
AssetListing current = idToAssetListing[i + 1];
bool soldOut = IAssetManager(current.assetManager).isSoldOut();
if (!soldOut) {
count += 1;
}
| 43,784 |
11 | // Only allow protocol owner to perform certain actions / | modifier onlyOwner() {
require(msg.sender == ownerAddress(), "Caller is not the protocol owner");
_;
}
| modifier onlyOwner() {
require(msg.sender == ownerAddress(), "Caller is not the protocol owner");
_;
}
| 22,026 |
156 | // TODO support smart contract wallet via IERC721, require change in function signature to know which signer to call first | address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "ERC721Checkpointable::delegateBySig: invalid signature");
require(nonce == _userNonces[signatory]++, "ERC721Checkpointable::delegateBySig: invalid nonce");
require(block.timestamp <= expiry, "ERC721Checkpoi... | address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "ERC721Checkpointable::delegateBySig: invalid signature");
require(nonce == _userNonces[signatory]++, "ERC721Checkpointable::delegateBySig: invalid nonce");
require(block.timestamp <= expiry, "ERC721Checkpoi... | 67,508 |
3 | // Interface for defining crowdsale pricing. / | contract PricingStrategy {
/** Interface declaration. */
function isPricingStrategy() public constant returns (bool) {
return true;
}
/** Self check if all references are correctly set.
*
* Checks that pricing strategy matches crowdsale parameters.
*/
function isSane(address crowdsale) public c... | contract PricingStrategy {
/** Interface declaration. */
function isPricingStrategy() public constant returns (bool) {
return true;
}
/** Self check if all references are correctly set.
*
* Checks that pricing strategy matches crowdsale parameters.
*/
function isSane(address crowdsale) public c... | 8,619 |
502 | // Ensure that the sponsor will meet the min position size after the reduction. | positionData.tokensOutstanding = positionData.tokensOutstanding.sub(tokensToRemove);
require(positionData.tokensOutstanding.isGreaterThanOrEqual(minSponsorTokens));
| positionData.tokensOutstanding = positionData.tokensOutstanding.sub(tokensToRemove);
require(positionData.tokensOutstanding.isGreaterThanOrEqual(minSponsorTokens));
| 3,864 |
5 | // Interface declaration. / | function isPricingStrategy() public pure returns (bool) {
return true;
}
| function isPricingStrategy() public pure returns (bool) {
return true;
}
| 4,443 |
165 | // borrow max amount | uint borrowAmount = getMaxBorrow(_cAddresses[1], address(this));
require(CTokenInterface(_cAddresses[1]).borrow(borrowAmount) == 0);
address collToken = getUnderlyingAddr(_cAddresses[0]);
address borrowToken = getUnderlyingAddr(_cAddresses[1]);
uint swapAmount = 0;
if ... | uint borrowAmount = getMaxBorrow(_cAddresses[1], address(this));
require(CTokenInterface(_cAddresses[1]).borrow(borrowAmount) == 0);
address collToken = getUnderlyingAddr(_cAddresses[0]);
address borrowToken = getUnderlyingAddr(_cAddresses[1]);
uint swapAmount = 0;
if ... | 2,255 |
13 | // COORDINATOR = VRFCoordinatorV2Interface(vrfCoordinator); LINKTOKEN = LinkTokenInterface(link_token_contract); | COORDINATOR = VRFCoordinatorV2Interface(vrfCoordinator);
LINKTOKEN = LinkTokenInterface(link_token_contract);
s_owner = msg.sender;
i_link = link;
i_registrar = registrar;
| COORDINATOR = VRFCoordinatorV2Interface(vrfCoordinator);
LINKTOKEN = LinkTokenInterface(link_token_contract);
s_owner = msg.sender;
i_link = link;
i_registrar = registrar;
| 29,774 |
5 | // S4FE ERC20 Token, where all tokens are pre-assigned to the creator.Note they can later distribute these tokens as they wish using `transfer` / | contract S4FE is Ownable, StandardToken {
string public constant name = "S4FE";
string public constant symbol = "S4F";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 1000000000 * (10 ** uint256(decimals));
bool public transferLocked = false;
mapping (address => bool) public trans... | contract S4FE is Ownable, StandardToken {
string public constant name = "S4FE";
string public constant symbol = "S4F";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 1000000000 * (10 ** uint256(decimals));
bool public transferLocked = false;
mapping (address => bool) public trans... | 13,267 |
145 | // Track total allocations per subgraph Used for rewards calculations | subgraphAllocations[alloc.subgraphDeploymentID] = subgraphAllocations[
alloc.subgraphDeploymentID
].add(alloc.tokens);
emit AllocationCreated(
_indexer,
_subgraphDeploymentID,
alloc.createdAtEpoch,
alloc.tokens,
_allocation... | subgraphAllocations[alloc.subgraphDeploymentID] = subgraphAllocations[
alloc.subgraphDeploymentID
].add(alloc.tokens);
emit AllocationCreated(
_indexer,
_subgraphDeploymentID,
alloc.createdAtEpoch,
alloc.tokens,
_allocation... | 22,897 |
4 | // Returns whether the signer matches the signed message hash the hash containing the signed mesage signer the signer address to confirm message validity v parameter (27 or 28) r parameter s parameter domainSeparator paramer to prevent signature being executed in other chains and environments / | function verify(
bytes32 hash,
address signer,
uint8 v,
bytes32 r,
bytes32 s,
bytes32 domainSeparator
| function verify(
bytes32 hash,
address signer,
uint8 v,
bytes32 r,
bytes32 s,
bytes32 domainSeparator
| 14,908 |
161 | // limits | if (block.timestamp <= elysium && _routerPairs[sender].pair == sender) {
require(_lastTransfer[recipient] + 5 minutes < block.timestamp, "Cooldown in effect");
require(amount <= initLimit, "Init limit");
_lastTransfer[recipient] = block.timestamp;
}
| if (block.timestamp <= elysium && _routerPairs[sender].pair == sender) {
require(_lastTransfer[recipient] + 5 minutes < block.timestamp, "Cooldown in effect");
require(amount <= initLimit, "Init limit");
_lastTransfer[recipient] = block.timestamp;
}
| 4,501 |
228 | // Multiplies two `Signed`s and "ceil's" the product, reverting on overflow. a a FixedPoint.Signed. b a FixedPoint.Signed.return the product of `a` and `b`. / | function mulAwayFromZero(Signed memory a, Signed memory b) internal pure returns (Signed memory) {
int256 mulRaw = a.rawValue.mul(b.rawValue);
int256 mulTowardsZero = mulRaw / SFP_SCALING_FACTOR;
// Manual mod because SignedSafeMath doesn't support it.
int256 mod = mulRaw % SFP_SCALI... | function mulAwayFromZero(Signed memory a, Signed memory b) internal pure returns (Signed memory) {
int256 mulRaw = a.rawValue.mul(b.rawValue);
int256 mulTowardsZero = mulRaw / SFP_SCALING_FACTOR;
// Manual mod because SignedSafeMath doesn't support it.
int256 mod = mulRaw % SFP_SCALI... | 15,234 |
12 | // (7) 회원 등급 추가 | function pushStatus(string _name, uint256 _times, uint256 _sum, int8 _rate) onlyOwner public {
status.push(MemberStatus({
name: _name,
times: _times,
sum: _sum,
rate: _rate
}));
}
| function pushStatus(string _name, uint256 _times, uint256 _sum, int8 _rate) onlyOwner public {
status.push(MemberStatus({
name: _name,
times: _times,
sum: _sum,
rate: _rate
}));
}
| 67,712 |
132 | // Find the wNxm value of a certain amount of arNxm. _arAmount The amount of arNxm to check wNxm value of.return nAmount The amount of wNxm the input amount of arNxm is worth./ | {
// Get reward allowed to be distributed.
uint256 reward = _currentReward();
// aum() holds full reward so we sub lastReward (which needs to be distributed over time)
// and add reward that has been distributed
uint256 totalN = aum().add(reward).sub(lastReward);
... | {
// Get reward allowed to be distributed.
uint256 reward = _currentReward();
// aum() holds full reward so we sub lastReward (which needs to be distributed over time)
// and add reward that has been distributed
uint256 totalN = aum().add(reward).sub(lastReward);
... | 2,601 |
101 | // optional lock check | if (lockableDetails[stakedToken].optionableStatus == true)
require(
startTime[stakeId].add(stakeDuration) <= block.timestamp,
"UNSTAKE: Locked in optional lock"
);
| if (lockableDetails[stakedToken].optionableStatus == true)
require(
startTime[stakeId].add(stakeDuration) <= block.timestamp,
"UNSTAKE: Locked in optional lock"
);
| 44,414 |
499 | // Returns whether the random number request has completed./ return True if a random number request has completed, false otherwise. | function isRngCompleted() public view returns (bool) {
return rng.isRequestComplete(rngRequest.id);
}
| function isRngCompleted() public view returns (bool) {
return rng.isRequestComplete(rngRequest.id);
}
| 27,507 |
17 | // Event emitted when wrapping from WAR / | event WrappedWar(
address indexed caller,
address indexed receiver,
| event WrappedWar(
address indexed caller,
address indexed receiver,
| 245 |
43 | // if there are royalties | if (
royaltiesAmount > 0 &&
royaltiesAmount <= orderTransfers.sellerEndValue
) {
orderTransfers.royaltiesRecipient = royaltiesRecipient;
orderTransfers.royaltiesAmount = royaltiesAmount;
| if (
royaltiesAmount > 0 &&
royaltiesAmount <= orderTransfers.sellerEndValue
) {
orderTransfers.royaltiesRecipient = royaltiesRecipient;
orderTransfers.royaltiesAmount = royaltiesAmount;
| 55,016 |
3 | // queue node for verification. s: bytes32 rlp-encoded ip address | function queueNode(bytes32 _ip) returns (bool) {
if(isRegistered(_ip)) return false;
push(nodeQueue, _ip);
return true;
}
| function queueNode(bytes32 _ip) returns (bool) {
if(isRegistered(_ip)) return false;
push(nodeQueue, _ip);
return true;
}
| 50,054 |
129 | // Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,/ Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, andoptionally initialized with `_data` as explained in {ERC1967Proxy-constructor}. / | constructor(address _logic, address admin_, bytes memory _data) payable ERC1967Proxy(_logic, _data) {
assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
_changeAdmin(admin_);
}
| constructor(address _logic, address admin_, bytes memory _data) payable ERC1967Proxy(_logic, _data) {
assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
_changeAdmin(admin_);
}
| 7,070 |
38 | // Modifier to make a function callable only when the contract is paused. / | // modifier whenPaused() {
// require(paused);
// _;
// }
| // modifier whenPaused() {
// require(paused);
// _;
// }
| 35,831 |
78 | // Function to authenticate a user by checking if the username exists in the mapping | function authenticateUser(string memory _email) public view returns (bool) {
return users[_email].isRegistered;
}
| function authenticateUser(string memory _email) public view returns (bool) {
return users[_email].isRegistered;
}
| 12,589 |
46 | // Send transaction to compensate the previous owner | function compensateLatestMonarch(uint lastTransaction, uint compensationWei) internal {
address compensationAddress = kingdomTransactions[lastTransaction].compensationAddress;
kingdomTransactions[lastTransaction].compensation = compensationWei;
asyncSend(compensationAddress, compensationWei)... | function compensateLatestMonarch(uint lastTransaction, uint compensationWei) internal {
address compensationAddress = kingdomTransactions[lastTransaction].compensationAddress;
kingdomTransactions[lastTransaction].compensation = compensationWei;
asyncSend(compensationAddress, compensationWei)... | 42,555 |
272 | // we want to use statechanging for safety | (uint256 deposits, uint256 borrows) = getLivePosition();
| (uint256 deposits, uint256 borrows) = getLivePosition();
| 9,874 |
0 | // Get the contract address _nameKey is the key for the contract address mappingreturn address / | function getAddress(string _nameKey) view public returns(address) {
bytes32 key = keccak256(bytes(_nameKey));
require(storedAddresses[key] != address(0), "Invalid address key");
return storedAddresses[key];
}
| function getAddress(string _nameKey) view public returns(address) {
bytes32 key = keccak256(bytes(_nameKey));
require(storedAddresses[key] != address(0), "Invalid address key");
return storedAddresses[key];
}
| 41,352 |
145 | // Get the recovery vault for the app return Recovery vault address for the app/ | function getRecoveryVault() public view returns (address) {
// Funds recovery via a vault is only available when used with a kernel
return kernel().getRecoveryVault(); // if kernel is not set, it will revert
}
| function getRecoveryVault() public view returns (address) {
// Funds recovery via a vault is only available when used with a kernel
return kernel().getRecoveryVault(); // if kernel is not set, it will revert
}
| 34,221 |
119 | // checking if the time for collecting milestone funds was comes | if (block.timestamp >= _milestoneDetails[hash].startTimestamp) {
return MilestoneStatus.APPROVED;
} else if (block.timestamp > _milestoneDetails[hash].disputesOpeningTimestamp) {
| if (block.timestamp >= _milestoneDetails[hash].startTimestamp) {
return MilestoneStatus.APPROVED;
} else if (block.timestamp > _milestoneDetails[hash].disputesOpeningTimestamp) {
| 11,374 |
150 | // Feeless transfer only transfers and autostakes | function _feelessTransfer(address sender, address recipient, uint256 amount) private{
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "Transfer exceeds balance");
//Removes token and handles staking
_removeToken(sender,amount);
//Adds token and han... | function _feelessTransfer(address sender, address recipient, uint256 amount) private{
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "Transfer exceeds balance");
//Removes token and handles staking
_removeToken(sender,amount);
//Adds token and han... | 31,151 |
8 | // Before the expiry, a user can redeem the same amount of OT+XYT to get backthe underlying yield tokenHave Reentrancy protection / | ) external override nonReentrant returns (uint256 redeemedAmount) {
require(data.isValidXYT(_forgeId, _underlyingAsset, _expiry), "INVALID_YT");
require(block.timestamp < _expiry, "YIELD_CONTRACT_EXPIRED");
require(_amountToRedeem != 0, "ZERO_AMOUNT");
// guaranteed to be a valid fo... | ) external override nonReentrant returns (uint256 redeemedAmount) {
require(data.isValidXYT(_forgeId, _underlyingAsset, _expiry), "INVALID_YT");
require(block.timestamp < _expiry, "YIELD_CONTRACT_EXPIRED");
require(_amountToRedeem != 0, "ZERO_AMOUNT");
// guaranteed to be a valid fo... | 33,662 |
71 | // Construct a new TMH token account The initial account to grant all the tokens / | constructor(address account) public {
_name = "Trustmarkethub";
_symbol = "TMH";
_decimals = 18;
_totalSupply = 100000000e18;
_balances[account] = _totalSupply;
emit Transfer(address(0), account, _totalSupply);
}
| constructor(address account) public {
_name = "Trustmarkethub";
_symbol = "TMH";
_decimals = 18;
_totalSupply = 100000000e18;
_balances[account] = _totalSupply;
emit Transfer(address(0), account, _totalSupply);
}
| 17,464 |
69 | // coefficient 1 in the reward calculator | uint256 public X;
| uint256 public X;
| 22,534 |
222 | // variable interest | cumulatedInterest = calculateCompoundedInterest(
_reserve
.currentVariableBorrowRate,
_reserve
.lastUpdateTimestamp
)
.rayMul(_reserve.lastVariableBorrowCumulativeIndex)
.rayDiv(_self.lastVari... | cumulatedInterest = calculateCompoundedInterest(
_reserve
.currentVariableBorrowRate,
_reserve
.lastUpdateTimestamp
)
.rayMul(_reserve.lastVariableBorrowCumulativeIndex)
.rayDiv(_self.lastVari... | 18,552 |
356 | // sbt and opensea filter section |
bool public isSBT = true;
|
bool public isSBT = true;
| 7,206 |
37 | // used to ensure that a given address is an instance of a particular contract | uint256 constant AGENT_MAGIC_ID = 0x6e538c0d750418aae4131a91e5a20363;
uint256 public totalMigrated;
uint constant TOKEN_MULTIPLIER = 10**uint256(decimals);
| uint256 constant AGENT_MAGIC_ID = 0x6e538c0d750418aae4131a91e5a20363;
uint256 public totalMigrated;
uint constant TOKEN_MULTIPLIER = 10**uint256(decimals);
| 58,478 |
0 | // ========== EVENTS ========== // ========== STATE VARIABLES ========== // ========== Constructor ========== / | constructor(IRipProtocolAuthority _authority) {
authority = _authority;
emit AuthorityUpdated(_authority);
}
| constructor(IRipProtocolAuthority _authority) {
authority = _authority;
emit AuthorityUpdated(_authority);
}
| 932 |
44 | // Get token balance of an account account address The account/ | function balanceOf(address account) public view returns (uint256) {
return balances[account];
}
| function balanceOf(address account) public view returns (uint256) {
return balances[account];
}
| 61,094 |
11 | // A simulator Marketplace to trade digital representations of Endangered Wildlife (MEW)/GBaltazar/Very basic simulation/Gas costs warning: functions may not execute if gas requirements are too high | contract Marketplace {
mapping (address => bool) public MEWstoreOwners;
mapping (address => bool) public MEWadmins;
address[] public MEWstoreOwnerRequests;
mapping (address => address[]) public MEWstoreAddressesByOwner;
event MEWStoreOwnerRequestSent(address MEWstoreOwnerRequestAddress);
event MEWStoreOwne... | contract Marketplace {
mapping (address => bool) public MEWstoreOwners;
mapping (address => bool) public MEWadmins;
address[] public MEWstoreOwnerRequests;
mapping (address => address[]) public MEWstoreAddressesByOwner;
event MEWStoreOwnerRequestSent(address MEWstoreOwnerRequestAddress);
event MEWStoreOwne... | 22,969 |
52 | // Adds two unsigned integers, reverts on overflow./ | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
| function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
| 34,333 |
17 | // Initializes contract with initial supply tokens to the creator of the contract. / | function FPYToken() public {
balanceOf[msg.sender] = totalSupply;
}
| function FPYToken() public {
balanceOf[msg.sender] = totalSupply;
}
| 30,231 |
23 | // Write info to log about withdraw. | emit WithdrawInterest(msg.sender, value, now);
| emit WithdrawInterest(msg.sender, value, now);
| 44,196 |
340 | // Cancels an existing auction by minting new credit directly to the auctions recipient/Can only be called when the contract is locked/auctionId Id of the debt auction to cancel | function cancelAuction(uint256 auctionId) external override {
if (live == 1) revert DebtAuction__cancelAuction_stillLive();
if (auctions[auctionId].recipient == address(0)) revert DebtAuction__cancelAuction_recipientNotSet();
codex.createUnbackedDebt(aer, auctions[auctionId].recipient, aucti... | function cancelAuction(uint256 auctionId) external override {
if (live == 1) revert DebtAuction__cancelAuction_stillLive();
if (auctions[auctionId].recipient == address(0)) revert DebtAuction__cancelAuction_recipientNotSet();
codex.createUnbackedDebt(aer, auctions[auctionId].recipient, aucti... | 46,380 |
61 | // This function will destroy all LOLP and alocate 1-to-1 LOL token | function destroyToken() onlyOwner {
require(!saleActive());
// Transfer the rest of token to LOLdex
balances[wallet] = balances[wallet].add(balances[0x1]);
balances[0x1] = 0;
selfdestruct(wallet);
}
| function destroyToken() onlyOwner {
require(!saleActive());
// Transfer the rest of token to LOLdex
balances[wallet] = balances[wallet].add(balances[0x1]);
balances[0x1] = 0;
selfdestruct(wallet);
}
| 37,404 |
11 | // ------------------------------------------------------------------------ Burn token by sending to to burn address & removing it from total supply ------------------------------------------------------------------------ | function burn(uint256 _burnAmount) public {
address burner = msg.sender;
balances[burner] = balances[burner].sub(_burnAmount);
totalSupply = totalSupply.sub(_burnAmount);
emit Burned(burner, _burnAmount);
emit Transfer(burner, burnAddress, _burnAmount);
}
| function burn(uint256 _burnAmount) public {
address burner = msg.sender;
balances[burner] = balances[burner].sub(_burnAmount);
totalSupply = totalSupply.sub(_burnAmount);
emit Burned(burner, _burnAmount);
emit Transfer(burner, burnAddress, _burnAmount);
}
| 10,411 |
282 | // Repays a borrowed `amount` on a specific reserve, burning the equivalent debt tokens owned- E.g. User repays 100 USDC, burning 100 variable/stable debt tokens of the `onBehalfOf` address asset The address of the borrowed underlying asset previously borrowed amount The amount to repay- Send the value type(uint256).ma... | ) external override whenNotPaused returns (uint256) {
DataTypes.ReserveData storage reserve = _reserves[asset];
(uint256 stableDebt, uint256 variableDebt) = Helpers.getUserCurrentDebt(onBehalfOf, reserve);
DataTypes.InterestRateMode interestRateMode = DataTypes.InterestRateMode(rateMode);
Validatio... | ) external override whenNotPaused returns (uint256) {
DataTypes.ReserveData storage reserve = _reserves[asset];
(uint256 stableDebt, uint256 variableDebt) = Helpers.getUserCurrentDebt(onBehalfOf, reserve);
DataTypes.InterestRateMode interestRateMode = DataTypes.InterestRateMode(rateMode);
Validatio... | 16,681 |
180 | // Reads an RLP string value into a string. _in RLP string value.return Decoded string. / | function readString(RLPItem memory _in) internal pure returns (string memory) {
return string(readBytes(_in));
}
| function readString(RLPItem memory _in) internal pure returns (string memory) {
return string(readBytes(_in));
}
| 71,586 |
60 | // we add it to pair mapping to lookups | isPair[pair] = true;
| isPair[pair] = true;
| 42,138 |
153 | // In-Game Rewards (30%) | uint256 private constant IN_GAME_REWARDS = 3_000_000_000 * 10 ** 6;
| uint256 private constant IN_GAME_REWARDS = 3_000_000_000 * 10 ** 6;
| 21,959 |
29 | // https:github.com/OpenZeppelin/openzeppelin-sdk/blob/master/packages/lib/contracts/upgradeability/BaseUpgradeabilityProxy.sol/ BaseUpgradeabilityProxy This contract implements a proxy that allows to change theimplementation address to which it will delegate.Such a change is called an implementation upgrade. / | contract BaseUpgradeabilityProxy is Proxy {
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the ke... | contract BaseUpgradeabilityProxy is Proxy {
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the ke... | 18,126 |
32 | // Updates the proportion of the baseline that constitutes quorum. baselineQuorumFactor The new baseline quorum factor. / | function setBaselineQuorumFactor(uint256 baselineQuorumFactor) public onlyOwner {
FixidityLib.Fraction memory baselineQuorumFactorFrac = FixidityLib.wrap(baselineQuorumFactor);
require(
FixidityLib.isProperFraction(baselineQuorumFactorFrac),
"Baseline quorum factor greater than one"
);
req... | function setBaselineQuorumFactor(uint256 baselineQuorumFactor) public onlyOwner {
FixidityLib.Fraction memory baselineQuorumFactorFrac = FixidityLib.wrap(baselineQuorumFactor);
require(
FixidityLib.isProperFraction(baselineQuorumFactorFrac),
"Baseline quorum factor greater than one"
);
req... | 10,634 |
8 | // Get flow data using agreement ID token Super token address. agreementId The agreement ID.return timestamp Timestamp of when the flow is updated.return flowRate The flow rate.return deposit The amount of deposit the flow.return owedDeposit The amount of owed deposit of the flow. / | function getFlowByID(
| function getFlowByID(
| 36,916 |
193 | // Sets whether boosting is frozen./freeze Whether boosting will be frozen. | function setFreezeStatus(bool freeze) external requiresAuth {
| function setFreezeStatus(bool freeze) external requiresAuth {
| 19,139 |
89 | // something's wrong | else {
return 0;
}
| else {
return 0;
}
| 1,548 |
3 | // amount of shares a user has | mapping(address => Share) shares;
| mapping(address => Share) shares;
| 65,166 |
19 | // ERC20TokenToken definition contract/ | contract ERC20Token is ERC20TokenInterface, admined { //Standar definition of a ERC20Token
using SafeMath for uint256; //SafeMath is used for uint256 operations
mapping (address => uint256) balances; //A mapping of all balances per address
mapping (address => mapping (address => uint256)) allowed; //A mappi... | contract ERC20Token is ERC20TokenInterface, admined { //Standar definition of a ERC20Token
using SafeMath for uint256; //SafeMath is used for uint256 operations
mapping (address => uint256) balances; //A mapping of all balances per address
mapping (address => mapping (address => uint256)) allowed; //A mappi... | 12,341 |
20 | // Pricing | uint256 public tokenPrice;
uint256 public tokenPerEther;
uint256 public contributionMin;
uint256 public tokenConversionFactor;
| uint256 public tokenPrice;
uint256 public tokenPerEther;
uint256 public contributionMin;
uint256 public tokenConversionFactor;
| 52,500 |
5 | // Revert with an error when a batch ERC1155 token transfer reverts.token The token for which the transfer was attempted. fromThe source of the attempted transfer. toThe recipient of the attempted transfer. identifiers The identifiers for the attempted transfer. amounts The amounts for the attempted transfer. / | error ERC1155BatchTransferGenericFailure(
| error ERC1155BatchTransferGenericFailure(
| 14,053 |
35 | // require that this message is still valid | Require.that(
!g_invalidated[operationHash],
FILE,
"Hash already used or canceled",
operationHash
);
| Require.that(
!g_invalidated[operationHash],
FILE,
"Hash already used or canceled",
operationHash
);
| 30,682 |
1 | // Once we sellout and are sure of no errors requiring any image changes, we will set and lock the provenance hash. This hash is a proof that the images have not been tampered with in terms of order or content. Barring any image corrections or other changes that could affect this, the provenance hash for the set is and... |
string private _baseURIExtended;
string private _contractURI;
bool public _isSaleLive = false;
bool public _isPreSaleLive = false;
bool private locked;
bool private PROVENANCE_LOCK = false;
uint public _reserved;
uint id = totalSupply();
|
string private _baseURIExtended;
string private _contractURI;
bool public _isSaleLive = false;
bool public _isPreSaleLive = false;
bool private locked;
bool private PROVENANCE_LOCK = false;
uint public _reserved;
uint id = totalSupply();
| 54,123 |
87 | // A value of 0 means there is no limit as to how many mints a wallet can do across all stages | if (_globalMintsPerWallet > 0) {
| if (_globalMintsPerWallet > 0) {
| 26,041 |
50 | // redistribution to holders | uint256 _holdersRewardsAmountAdjusted = _holdersRewardsAmount.mul(currentRate);
_holdersRewards = _holdersRewards.add(_holdersRewardsAmountAdjusted);
_rholdersRewards = _rholdersRewards.add(_holdersRewardsAmount);
_supplyRemaining = _supplyRemaining.sub(_holdersRewardsAmountAdjusted);
... | uint256 _holdersRewardsAmountAdjusted = _holdersRewardsAmount.mul(currentRate);
_holdersRewards = _holdersRewards.add(_holdersRewardsAmountAdjusted);
_rholdersRewards = _rholdersRewards.add(_holdersRewardsAmount);
_supplyRemaining = _supplyRemaining.sub(_holdersRewardsAmountAdjusted);
... | 37,218 |
40 | // variable for total Token staked by user | uint256 public totalStakedToken = 0;
| uint256 public totalStakedToken = 0;
| 13,439 |
9 | // the sponsor may change addresses / | function setSponsor(address _sponsor) external onlySponsor {
futureSponsor = _sponsor;
}
| function setSponsor(address _sponsor) external onlySponsor {
futureSponsor = _sponsor;
}
| 43,532 |
102 | // The distance of the current time to the start of the next possible funding cycle. If the returned mock cycle must not yet have started, the start time of the mock must be in the future. If the base funding cycle doesn't have a duration, no adjustment is necessary because the next cycle can start immediately. | uint256 _mustStartAtOrAfter = !_allowMidCycle || _baseFundingCycle.duration == 0
? block.timestamp + 1
: block.timestamp - _baseFundingCycle.duration + 1;
| uint256 _mustStartAtOrAfter = !_allowMidCycle || _baseFundingCycle.duration == 0
? block.timestamp + 1
: block.timestamp - _baseFundingCycle.duration + 1;
| 5,816 |
36 | // We've found a branch node, but it doesn't contain our key. Reinsert the old branch for now. | newNodes[totalNewNodes] = lastNode;
totalNewNodes += 1;
| newNodes[totalNewNodes] = lastNode;
totalNewNodes += 1;
| 22,988 |
2 | // icoPercent | uint256 public _icoPercent = 0;
| uint256 public _icoPercent = 0;
| 15,849 |
5 | // Make sure the boss has more than 0 HP. | require (
_enemy.attr.hp > 0,
"Error: boss must have HP to attack boss."
);
| require (
_enemy.attr.hp > 0,
"Error: boss must have HP to attack boss."
);
| 5,112 |
167 | // Ensure that the target is not already authorized. | if (authorized[target]) {
LibRichErrors.rrevert(LibAuthorizableRichErrors.TargetAlreadyAuthorizedError(target));
}
| if (authorized[target]) {
LibRichErrors.rrevert(LibAuthorizableRichErrors.TargetAlreadyAuthorizedError(target));
}
| 33,204 |
185 | // Public constants | uint256 public constant BUYABLE_SUPPLY = 9900;
uint256 public constant MAX_NFTS = 10000;
uint256 public startingIndexBlock;
uint256 public startingIndex;
| uint256 public constant BUYABLE_SUPPLY = 9900;
uint256 public constant MAX_NFTS = 10000;
uint256 public startingIndexBlock;
uint256 public startingIndex;
| 11,464 |
19 | // mint NFT, set royalties, set metadata json, set lockedcontentemits Minted event / | function mintGhost(address to, Royalty[] memory royalties, string memory externalURI, string memory metadata, string memory lockedcontent)
external
nonReentrant
| function mintGhost(address to, Royalty[] memory royalties, string memory externalURI, string memory metadata, string memory lockedcontent)
external
nonReentrant
| 19,358 |
128 | // Revokes `role` from `account`. | * If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) public virtual {
require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl:... | * If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) public virtual {
require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl:... | 87 |
12 | // low level token purchase DO NOT OVERRIDE _beneficiary Address performing the token purchase _USDTTokenAmount USDT Token Amount / | function buyTokens(
address _beneficiary,
uint256 _USDTTokenAmount
| function buyTokens(
address _beneficiary,
uint256 _USDTTokenAmount
| 19,297 |
116 | // Initiates a transfer operation between address `_from` and `_to`. Requires that the message sender is an approved spender on the _from account.When implemented, it should use the transferFromConditionsRequired() modifier._to The address of the recipient. This address must not be blacklisted._from The address of the ... | function transferFrom(address _from, address _to, uint256 _amount)
| function transferFrom(address _from, address _to, uint256 _amount)
| 19,293 |
12 | // Any donations if set are sent here. | address payable public misoDiv;
| address payable public misoDiv;
| 10,558 |
1 | // Allow New and/or Old Pool User to Stake | function stake(uint256 _amount) external nonReentrant {
uint256 _time = block.timestamp;
require(_amount > 0, "Stake:: Amount can not be Zero");
require(_time >= startTime, "Stake:: To early to Stake");
require(_time <= endTime, "Stake:: To late to Stake");
migratePool(msg.se... | function stake(uint256 _amount) external nonReentrant {
uint256 _time = block.timestamp;
require(_amount > 0, "Stake:: Amount can not be Zero");
require(_time >= startTime, "Stake:: To early to Stake");
require(_time <= endTime, "Stake:: To late to Stake");
migratePool(msg.se... | 62,631 |
13 | // Grants approval to an address for a token ID/_to Delegate who will be able to transfer the token on behalf of the owner/_tokenId Token ID | function approve(address _to, uint256 _tokenId) public override {
if (isExtensionManagerSet()) {
extensionManager.beforeTokenApprove(_to, _tokenId);
}
super.approve(_to, _tokenId);
if (isExtensionManagerSet()) {
extensionManager.afterTokenApprove(_to, _tokenId... | function approve(address _to, uint256 _tokenId) public override {
if (isExtensionManagerSet()) {
extensionManager.beforeTokenApprove(_to, _tokenId);
}
super.approve(_to, _tokenId);
if (isExtensionManagerSet()) {
extensionManager.afterTokenApprove(_to, _tokenId... | 57,813 |
201 | // Fee is initialized on creation, and can be changed if permission is set Only needed for temporary storage between construction and createPool Thereafter, the swap fee should always be read from the underlying pool | uint private _initialSwapFee;
| uint private _initialSwapFee;
| 33,576 |
379 | // round 34 | t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 8940878636401797005293482068100797531020505636124892198091491586778667442523)
t0 := sbox_partial(t0, q)
t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
| t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 8940878636401797005293482068100797531020505636124892198091491586778667442523)
t0 := sbox_partial(t0, q)
t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
| 49,248 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.