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 |
|---|---|---|---|---|
38 | // guild kick proposal | } else if (proposal.flags[5] == 1) {
| } else if (proposal.flags[5] == 1) {
| 23,649 |
1 | // Creates a new claim of a Radicle Link identity./ Every new claim invalidates previous ones made with the same account./ The claims have no expiration date and don't need to be renewed./ If either `format` is unsupported or `payload` is malformed as per `format`,/ the previous claim is revoked, but a new one isn't cr... | function claim(uint256 format, bytes calldata payload) public {
format;
payload;
emit Claimed(msg.sender);
}
| function claim(uint256 format, bytes calldata payload) public {
format;
payload;
emit Claimed(msg.sender);
}
| 47,546 |
5 | // solium-disable-next-line | emit AssetCreated(msg.sender, uuid, block.timestamp, _assetDataHash);
| emit AssetCreated(msg.sender, uuid, block.timestamp, _assetDataHash);
| 3,343 |
206 | // Functions// Constructor - sets values for token name and token supply, as well as the factory_contract, the swap. _factory / | function startToken(TokenStorage storage self,address _factory) public {
self.factory_contract = _factory;
}
| function startToken(TokenStorage storage self,address _factory) public {
self.factory_contract = _factory;
}
| 23,969 |
46 | // This is an alternative to {approve} that can be used as a mitigation forproblems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address.- `spender` must have allowance for the caller of at least`subtractedValue`. / | function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
| function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
| 36 |
2 | // Extension that only uses a single creator contract instance / | abstract contract SingleCreatorExtensionBase {
address internal _creator;
/**
* @dev Override with appropriate interface checks if necessary
*/
function _setCreator(address creator) internal virtual {
_creator = creator;
}
function creatorContract() public view returns(address) {
... | abstract contract SingleCreatorExtensionBase {
address internal _creator;
/**
* @dev Override with appropriate interface checks if necessary
*/
function _setCreator(address creator) internal virtual {
_creator = creator;
}
function creatorContract() public view returns(address) {
... | 18,182 |
163 | // res += valcoefficients[15]. | res := addmod(res,
mulmod(val, /*coefficients[15]*/ mload(0x5e0), PRIME),
PRIME)
| res := addmod(res,
mulmod(val, /*coefficients[15]*/ mload(0x5e0), PRIME),
PRIME)
| 58,889 |
2 | // sender and receiver state update | if (from != address(future) && to != address(future) && from != address(0x0) && to != address(0x0)) {
| if (from != address(future) && to != address(future) && from != address(0x0) && to != address(0x0)) {
| 52,483 |
81 | // Add support NFT interface in Exchange Only Exchange owner can do tihs interface_id Support NFT interface's interface_id / | function addSupportNFTInterface(
bytes4 interface_id
)
external
onlyOwner()
| function addSupportNFTInterface(
bytes4 interface_id
)
external
onlyOwner()
| 30,966 |
194 | // Upgrade Mining Pool. Can only be called by the owner | function upgrade(address _address) public onlyOwner {
erc20.transferOwnership(_address);
}
| function upgrade(address _address) public onlyOwner {
erc20.transferOwnership(_address);
}
| 30,703 |
315 | // The Clerk module used by the Master and its Safes. | TurboClerk public clerk;
| TurboClerk public clerk;
| 30,329 |
13 | // if there is no authority, that means that contract doesn't have permission | if (currAuthority == address(0)) {
return;
}
| if (currAuthority == address(0)) {
return;
}
| 25,191 |
51 | // YearnFinanceMoneyTokenContract to preform crowd sale with token / | contract YearnFinanceMoneyToken is StandardToken, Configurable, Ownable {
/**
* @dev enum of current crowd sale state
**/
enum Stages {
none,
presale1Start,
presale1End,
presale2Start,
presale2End,
presale3Start,
presale3End
}
St... | contract YearnFinanceMoneyToken is StandardToken, Configurable, Ownable {
/**
* @dev enum of current crowd sale state
**/
enum Stages {
none,
presale1Start,
presale1End,
presale2Start,
presale2End,
presale3Start,
presale3End
}
St... | 33,271 |
6 | // Get the document id that relates to the document number of a given address | mapping (address => mapping (uint32 => uint128)) userdocid; // author => (userdocid => docid)
| mapping (address => mapping (uint32 => uint128)) userdocid; // author => (userdocid => docid)
| 33,165 |
108 | // What is this hero&39;s type? ex) John, Sally, Mark... | uint32 heroClassId;
| uint32 heroClassId;
| 18,051 |
400 | // internal function for setting bot on a token | function setHasBot(uint256 _tokenId) internal {
require(!hasBot[_tokenId], "already_has_bot");
hasBot[_tokenId] = true;
}
| function setHasBot(uint256 _tokenId) internal {
require(!hasBot[_tokenId], "already_has_bot");
hasBot[_tokenId] = true;
}
| 48,089 |
6 | // If the first argument of 'require' evaluates to 'false', execution terminates and all changes to the state and to Ether balances are reverted. This used to consume all gas in old EVM versions, but not anymore. It is often a good idea to use 'require' to check if functions are called correctly. As a second argument, ... | require(msg.sender == owner, "Caller is not owner");
_;
| require(msg.sender == owner, "Caller is not owner");
_;
| 468 |
11 | // Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes. / | function unsubscribe(address registrant, bool copyExistingEntries) external;
| function unsubscribe(address registrant, bool copyExistingEntries) external;
| 24,544 |
15 | // Calculates the amount of tokens that has already vested. Default implementation is a linear vesting curve. / | function vestedAmount(address token, uint64 timestamp) public view virtual returns (uint256) {
return _vestingSchedule(IERC20(token).balanceOf(address(this)) + released(token), timestamp);
}
| function vestedAmount(address token, uint64 timestamp) public view virtual returns (uint256) {
return _vestingSchedule(IERC20(token).balanceOf(address(this)) + released(token), timestamp);
}
| 41,447 |
95 | // This is an in-place update. Return the prev node of the node being updated | nodeID = dllMap[_voter].getPrev(nodeID);
| nodeID = dllMap[_voter].getPrev(nodeID);
| 49,018 |
279 | // Decode the revert reason in the event one was returned. | string memory revertReason = _decodeRevertReason(data);
emit ExternalError(
account,
string(
abi.encodePacked(
name,
" reverted calling ",
functionName,
": ",
| string memory revertReason = _decodeRevertReason(data);
emit ExternalError(
account,
string(
abi.encodePacked(
name,
" reverted calling ",
functionName,
": ",
| 7,976 |
24 | // Create the token. | _tokens[tokenId] = Token(
tokenId,
_spaceCakesTxn.steemTxn,
_spaceCakesTxn.steemImages[i]
);
| _tokens[tokenId] = Token(
tokenId,
_spaceCakesTxn.steemTxn,
_spaceCakesTxn.steemImages[i]
);
| 19,926 |
13 | // Returns a Project at _id from the projects array | function returnProjectAtId(
uint256 _id
| function returnProjectAtId(
uint256 _id
| 986 |
79 | // Configure multiple properties at a time. Note: The individual configure methods should be usedto unset or reset any properties to zero, as this methodwill ignore zero-value properties in the config struct.config The configuration struct. / | function multiConfigure(MultiConfigureStruct calldata config)
external
onlyOwner
| function multiConfigure(MultiConfigureStruct calldata config)
external
onlyOwner
| 17,687 |
13 | // Proceed buy | address target = MyItem.Owner;
| address target = MyItem.Owner;
| 40,816 |
8 | // Burn the fuel of a `boostedSend` / | function _burnBoostedSendFuel(
address from,
BoosterFuel memory fuel,
UnpackedData memory unpacked
| function _burnBoostedSendFuel(
address from,
BoosterFuel memory fuel,
UnpackedData memory unpacked
| 35,990 |
117 | // else if it's the first stake for user, set stakerIndex as current miningStateIndex | if(stakerIndex == 0){
stakerIndex = miningStateIndex;
}
| if(stakerIndex == 0){
stakerIndex = miningStateIndex;
}
| 7,192 |
9 | // solhint-disable-next-line no-call-value | (bool success, ) = to.call{ value: value }(new bytes(0));
| (bool success, ) = to.call{ value: value }(new bytes(0));
| 39,138 |
11 | // receive eth for royalties./ | receive() external payable {
uint256 value = msg.value;
if(msg.sender == owner())
gameFunds += value;
else {
gameFunds += value * 75 / 100;
claimFunds += value * 25 / 100;
}
emit Receive(msg.sender, value);
}
| receive() external payable {
uint256 value = msg.value;
if(msg.sender == owner())
gameFunds += value;
else {
gameFunds += value * 75 / 100;
claimFunds += value * 25 / 100;
}
emit Receive(msg.sender, value);
}
| 31,000 |
79 | // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF proof. rawFulfillRandomness then calls fulfillRandomness, after validating the origin of the call | function rawFulfillRandomness(bytes32 requestId, uint256 randomness) external {
require(msg.sender == vrfCoordinator, "Only VRFCoordinator can fulfill");
fulfillRandomness(requestId, randomness);
}
| function rawFulfillRandomness(bytes32 requestId, uint256 randomness) external {
require(msg.sender == vrfCoordinator, "Only VRFCoordinator can fulfill");
fulfillRandomness(requestId, randomness);
}
| 2,684 |
32 | // WFTM -> SPOOKY_ROUTER | uint256 wftmAllowance = type(uint256).max -
IERC20Upgradeable(WFTM).allowance(address(this), SPOOKY_ROUTER);
IERC20Upgradeable(WFTM).safeIncreaseAllowance(
SPOOKY_ROUTER,
wftmAllowance
);
| uint256 wftmAllowance = type(uint256).max -
IERC20Upgradeable(WFTM).allowance(address(this), SPOOKY_ROUTER);
IERC20Upgradeable(WFTM).safeIncreaseAllowance(
SPOOKY_ROUTER,
wftmAllowance
);
| 17,517 |
25 | // Burn the tokens. | balances[holder] -= burnAmount;
| balances[holder] -= burnAmount;
| 33,915 |
22 | // Possible states that a proposal may be in | enum ProposalState {
Active, // 0
Defeated, // 1
PendingExecution, // 2
ReadyForExecution, // 3
Executed // 4
}
| enum ProposalState {
Active, // 0
Defeated, // 1
PendingExecution, // 2
ReadyForExecution, // 3
Executed // 4
}
| 48,945 |
52 | // earned is an estimation, it won't be exact till the supply > rewardPerToken calculations have run | function earned(address token, address account) public view returns (uint) {
uint _startTimestamp = Math.max(lastEarn[token][account], rewardPerTokenCheckpoints[token][0].timestamp);
if (numCheckpoints[account] == 0) {
return 0;
}
uint _startIndex = getPriorBalanceIndex(... | function earned(address token, address account) public view returns (uint) {
uint _startTimestamp = Math.max(lastEarn[token][account], rewardPerTokenCheckpoints[token][0].timestamp);
if (numCheckpoints[account] == 0) {
return 0;
}
uint _startIndex = getPriorBalanceIndex(... | 34,225 |
178 | // MasterChef is the master of BLZD. He can make BLZD and he is a fair guy. Note that it's ownable and the owner wields tremendous power. The ownership will be transferred to a governance smart contract once BLZD is sufficiently distributed and the community can show to govern itself. Have fun reading it. Hopefully it'... | contract MasterChefV2 is Ownable, ReentrancyGuard {
using SafeMath for uint256;
using SafeBEP20 for IBEP20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
... | contract MasterChefV2 is Ownable, ReentrancyGuard {
using SafeMath for uint256;
using SafeBEP20 for IBEP20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
... | 20,412 |
53 | // Set allowance for other address and notify Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it_spender The address authorized to spend _value the max amount they can spend _extraData some extra information to send to the approved contract / | function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
onlyWhenValidAddress(_spender)
| function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
onlyWhenValidAddress(_spender)
| 32,032 |
109 | // Reverts if the auction is not complete. Auction is complete if there was a bid, and the time has run out. | modifier auctionComplete(bytes32 tokenId) {
require(
// Auction is complete if there has been a bid, and the current time
// is greater than the auction's end time.
auctions[tokenId].firstBidTime > 0 &&
block.timestamp >= auctionEnds(tokenId),
... | modifier auctionComplete(bytes32 tokenId) {
require(
// Auction is complete if there has been a bid, and the current time
// is greater than the auction's end time.
auctions[tokenId].firstBidTime > 0 &&
block.timestamp >= auctionEnds(tokenId),
... | 27,753 |
31 | // >0: found exchangeId/ ==0 : not found | function pickExchange(ERC20Extended _token, uint _amount, uint _rate, bool _isBuying) public view returns (bytes32 exchangeId) {
int maxRate = -1;
for (uint i = 0; i < exchanges.length; i++) {
bytes32 id = exchanges[i];
OlympusExchangeAdapterInterface adapter = exchangeAdap... | function pickExchange(ERC20Extended _token, uint _amount, uint _rate, bool _isBuying) public view returns (bytes32 exchangeId) {
int maxRate = -1;
for (uint i = 0; i < exchanges.length; i++) {
bytes32 id = exchanges[i];
OlympusExchangeAdapterInterface adapter = exchangeAdap... | 24,067 |
88 | // true: deposit open. false: deposit close 1. in allowed period, 2. before rebased / | function hedgeCoreStatus() public view override returns (bool isUnlocked_) {
bool isInAllowedPriod;
bool isRebased;
isInAllowedPriod = (block.timestamp <= hedgeInfo.rebaseEndTime - resctrictedPeriod) ? true : false;
isRebased = _isSTokenRebased(epoch());
isUnlocked_ = isInAllowedPriod && (!isRebased);
}
| function hedgeCoreStatus() public view override returns (bool isUnlocked_) {
bool isInAllowedPriod;
bool isRebased;
isInAllowedPriod = (block.timestamp <= hedgeInfo.rebaseEndTime - resctrictedPeriod) ? true : false;
isRebased = _isSTokenRebased(epoch());
isUnlocked_ = isInAllowedPriod && (!isRebased);
}
| 22,346 |
431 | // add x^06(33! / 06!) | xi = (xi * _x) >> _precision;
res += xi * 0x00054f1cf12bd04e516b6da88000000;
| xi = (xi * _x) >> _precision;
res += xi * 0x00054f1cf12bd04e516b6da88000000;
| 33,223 |
21 | // Retrieve the funds of the sale / | function retrieveFunds() external {
// Only the Piano King Wallet or the owner can withraw the funds
require(
msg.sender == pianoKingWallet || msg.sender == owner(),
"Not allowed"
);
payable(pianoKingWallet).sendValue(address(this).balance);
}
| function retrieveFunds() external {
// Only the Piano King Wallet or the owner can withraw the funds
require(
msg.sender == pianoKingWallet || msg.sender == owner(),
"Not allowed"
);
payable(pianoKingWallet).sendValue(address(this).balance);
}
| 53,872 |
48 | // Function called by the sender, when he has a closing signature from the receiver;/ channel is closed immediately./_receiver_address The address that receives tokens./_open_block_number The block number at which a channel between the/ sender and receiver was created./_balance The amount of tokens owed by the sender t... | function cooperativeClose(
address _receiver_address,
uint32 _open_block_number,
uint192 _balance,
bytes _balance_msg_sig,
bytes _closing_sig)
external
| function cooperativeClose(
address _receiver_address,
uint32 _open_block_number,
uint192 _balance,
bytes _balance_msg_sig,
bytes _closing_sig)
external
| 4,472 |
7 | // to support receiving ETH by default | receive() external payable {}
fallback() external payable {}
}
| receive() external payable {}
fallback() external payable {}
}
| 34,919 |
121 | // initialise the next claim if it was the first stake for this staker or if the next claim was re-initialised (ie. rewards were claimed until the last staker snapshot and the last staker snapshot has no stake) | if (nextClaims[tokenOwner].period == 0) {
uint16 currentPeriod = _getPeriod(currentCycle, periodLengthInCycles_);
nextClaims[tokenOwner] = NextClaim(currentPeriod, uint64(globalHistory.length - 1), 0);
}
| if (nextClaims[tokenOwner].period == 0) {
uint16 currentPeriod = _getPeriod(currentCycle, periodLengthInCycles_);
nextClaims[tokenOwner] = NextClaim(currentPeriod, uint64(globalHistory.length - 1), 0);
}
| 68,114 |
47 | // Escrows the CCToken, assigning ownership to this contract./ Throws if the escrow fails./_tokenId - ID of token whose approval to verify. | function _escrow(uint256 _tokenId) internal {
// it will throw if transfer fails
ccContract.takeOwnership(_tokenId);
}
| function _escrow(uint256 _tokenId) internal {
// it will throw if transfer fails
ccContract.takeOwnership(_tokenId);
}
| 48,264 |
54 | // Destroy some token amount Amount of destroyed token / | function destroyToken(uint amount) public onlyOwner {
token.destroy(amount.mul(1000000000000000000), msg.sender);
}
| function destroyToken(uint amount) public onlyOwner {
token.destroy(amount.mul(1000000000000000000), msg.sender);
}
| 20,854 |
66 | // burn shares and loot | member.shares = member.shares.sub(sharesToBurn);
member.loot = member.loot.sub(lootToBurn);
totalShares = totalShares.sub(sharesToBurn);
totalLoot = totalLoot.sub(lootToBurn);
for (uint256 i = 0; i < approvedTokens.length; i++) {
uint256 amountToRagequit = fairShare(... | member.shares = member.shares.sub(sharesToBurn);
member.loot = member.loot.sub(lootToBurn);
totalShares = totalShares.sub(sharesToBurn);
totalLoot = totalLoot.sub(lootToBurn);
for (uint256 i = 0; i < approvedTokens.length; i++) {
uint256 amountToRagequit = fairShare(... | 14,725 |
15 | // Withdraws money from the pool-> change the BEEFY token to UST/USDC pool token to UST and USDC tokens to USDC token-> give back the USDC to the userreducing the total supply emits a message on success with the address and the amount withdrawnuseraddrspecifies the address of the user wanting to withdraw amountspecifie... | function withdraw(
address useraddr,
uint256 amount,
uint256 amountMinUST,
uint256 amountMinUSDC,
uint256 minAmountUSDCTradeEND
| function withdraw(
address useraddr,
uint256 amount,
uint256 amountMinUST,
uint256 amountMinUSDC,
uint256 minAmountUSDCTradeEND
| 19,560 |
181 | // Constructor sets the regulator contract and the address of the CarbonUSD meta-token contract. The latter is necessary in order to make transactions with the CarbonDollar smart contract./ | constructor(address _regulator, address _cusd) public PermissionedToken(_regulator) {
// base class fields
regulator = WhitelistedTokenRegulator(_regulator);
cusdAddress = _cusd;
}
| constructor(address _regulator, address _cusd) public PermissionedToken(_regulator) {
// base class fields
regulator = WhitelistedTokenRegulator(_regulator);
cusdAddress = _cusd;
}
| 24,898 |
11 | // Deposits a given amount of rHEGIC to the contract. amount Amount of rHEGIC to be deposited / | function deposit(uint amount) external {
require(allowDeposit, "deposit/NOT_ALLOWED");
require(amount > 0, "deposit/AMOUNT_TOO_LOW");
rHEGIC.safeTransferFrom(msg.sender, address(this), amount);
amountDeposited[msg.sender] = amountDeposited[msg.sender].add(amount);
totalDepo... | function deposit(uint amount) external {
require(allowDeposit, "deposit/NOT_ALLOWED");
require(amount > 0, "deposit/AMOUNT_TOO_LOW");
rHEGIC.safeTransferFrom(msg.sender, address(this), amount);
amountDeposited[msg.sender] = amountDeposited[msg.sender].add(amount);
totalDepo... | 36,991 |
16 | // Exclude or include an address from transfer fee.Can only be called by the current operator. / | function setExcludedFromTransferFee(address _account, bool _excluded) public onlyOperator {
_excludedFromTransferFee[_account] = _excluded;
}
| function setExcludedFromTransferFee(address _account, bool _excluded) public onlyOperator {
_excludedFromTransferFee[_account] = _excluded;
}
| 28,499 |
152 | // Get current amount for main contract change event | original = stakeDetails.initialTokenAmount - stakeDetails.withdrawnAmount;
| original = stakeDetails.initialTokenAmount - stakeDetails.withdrawnAmount;
| 13,586 |
73 | // Transfer tokens to a specified address. to The address to transfer to. value The amount to be transferred.return True on success, false otherwise. / |
function transfer(address to, uint256 value)
public
validRecipient(to)
returns (bool)
|
function transfer(address to, uint256 value)
public
validRecipient(to)
returns (bool)
| 38,599 |
165 | // Returns the address of the current vault. / | function vault() public view returns (address) {
return _vault;
}
| function vault() public view returns (address) {
return _vault;
}
| 33,055 |
320 | // Owner can claim free tokens | function claim(uint256 nTokens, address to) external nonReentrant onlyOwner {
require(nTokens <= reserved, "That would exceed the max reserved.");
reserved = reserved - nTokens;
_mintConsecutive(nTokens, to, 0x0);
}
| function claim(uint256 nTokens, address to) external nonReentrant onlyOwner {
require(nTokens <= reserved, "That would exceed the max reserved.");
reserved = reserved - nTokens;
_mintConsecutive(nTokens, to, 0x0);
}
| 24,634 |
32 | // Allows the owner to pause registration. / | function setRegistrable(bool registrable_) external onlyOwner {
registrable = registrable_;
}
| function setRegistrable(bool registrable_) external onlyOwner {
registrable = registrable_;
}
| 22,260 |
9 | // Adds a user to go-list _member address to add to go-list / | function addToGoList(address _member) public onlyGoListerRole {
goList[_member] = true;
emit GoListed(_member);
}
| function addToGoList(address _member) public onlyGoListerRole {
goList[_member] = true;
emit GoListed(_member);
}
| 34,347 |
9 | // The set of all claim conditions, at any given moment. | ClaimConditionList public claimCondition;
/*///////////////////////////////////////////////////////////////
Mappings
| ClaimConditionList public claimCondition;
/*///////////////////////////////////////////////////////////////
Mappings
| 28,406 |
6 | // Always rounds up | function ceilDiv(uint a, uint b) internal pure returns (uint256) {
require(b > 0, "div by 0"); // Solidity automatically throws for div by 0 but require to emit reason
uint256 z = a / b;
if (a % b != 0) {
z++; // no need for safe add b/c it can happen only if we divided the inpu... | function ceilDiv(uint a, uint b) internal pure returns (uint256) {
require(b > 0, "div by 0"); // Solidity automatically throws for div by 0 but require to emit reason
uint256 z = a / b;
if (a % b != 0) {
z++; // no need for safe add b/c it can happen only if we divided the inpu... | 31,220 |
270 | // user => job => lp => amount | mapping(address => mapping(address => mapping(address => uint256))) public override userJobLiquidityAmount;
| mapping(address => mapping(address => mapping(address => uint256))) public override userJobLiquidityAmount;
| 10,333 |
11 | // Add PaymentToken token_ (address) PaymentToken address aggregator_ (address) Chainlink aggregator address for the PaymentToken:USD pair aggregatorDecimals_ (uint8) Chainlink aggregator decimals native_ (bool) Check if PaymentToken is native token / | function addPaymentToken(
address token_,
address aggregator_,
uint8 aggregatorDecimals_,
bool native_
| function addPaymentToken(
address token_,
address aggregator_,
uint8 aggregatorDecimals_,
bool native_
| 1,682 |
201 | // function _updateCollateralToken( | {
collaterals[_collateral].virtualSupply = _virtualSupply;
collaterals[_collateral].virtualBalance = _virtualBalance;
collaterals[_collateral].reserveRatio = _reserveRatio;
collaterals[_collateral].slippage = _slippage;
emit UpdateCollateralToken(_collateral, _virtualSupply,... | {
collaterals[_collateral].virtualSupply = _virtualSupply;
collaterals[_collateral].virtualBalance = _virtualBalance;
collaterals[_collateral].reserveRatio = _reserveRatio;
collaterals[_collateral].slippage = _slippage;
emit UpdateCollateralToken(_collateral, _virtualSupply,... | 13,222 |
26 | // start the auction process | function startAuctionProcess() public nonReentrant onlyWhitelisted {
require(state == ContractState.PREPARE, "Invalid contract state");
require(auctionEnded > block.timestamp, "auctionEnded has been passed");
state = ContractState.AUCTIONING;
}
| function startAuctionProcess() public nonReentrant onlyWhitelisted {
require(state == ContractState.PREPARE, "Invalid contract state");
require(auctionEnded > block.timestamp, "auctionEnded has been passed");
state = ContractState.AUCTIONING;
}
| 30,006 |
44 | // The mortgage asset is nest,get USDT-NEST price | (, , uint256 avg1, , , , uint256 avg2, ) = _nestPriceFacade
| (, , uint256 avg1, , , , uint256 avg2, ) = _nestPriceFacade
| 50,858 |
127 | // Returns the exact collateral amount withdrawed from yVault | return yToken.withdraw(_convertToShares(_amount));
| return yToken.withdraw(_convertToShares(_amount));
| 62,471 |
16 | // Get bounty with id./_bid Bounty id./ return owner, bid, name, description, amount, status | function getBounty(uint _bid)
public
view
returns (address owner, uint bid, string memory name, string memory description, uint amount, BountyStatus status)
| function getBounty(uint _bid)
public
view
returns (address owner, uint bid, string memory name, string memory description, uint amount, BountyStatus status)
| 22,526 |
169 | // WHITELIST White List also check if the wallet already claim n tokens and its less than _whiteListMaxMint//EVENTS Emit event on every transaction that a state variable is changed or creating a token is procesed/ | constructor(string memory baseURI) ERC721("Appa Village NFT", "APPA") {
setBaseURI(baseURI);
// @dev check function claimTeam
}
| constructor(string memory baseURI) ERC721("Appa Village NFT", "APPA") {
setBaseURI(baseURI);
// @dev check function claimTeam
}
| 41,762 |
110 | // Read pointer to data for array element from head position. | let mPtrTail := mload(mPtrHead)
| let mPtrTail := mload(mPtrHead)
| 17,022 |
49 | // Add a value to a set. O(1).Returns false if the value was already in the set. / | function add(AddressSet storage set, address value)
internal
returns (bool)
| function add(AddressSet storage set, address value)
internal
returns (bool)
| 23,960 |
193 | // Buys a pixel block _x X coordinate of the desired block _y Y coordinate of the desired block _price New price of the pixel block _currentValue Current value of the transaction _contentData Data for the pixel / | function _buyPixelBlock(uint256 _x, uint256 _y, uint256 _price, uint256 _currentValue, bytes32 _contentData)
internal
validRange(_x, _y)
hasPositveBalance(msg.sender)
returns (uint256)
| function _buyPixelBlock(uint256 _x, uint256 _y, uint256 _price, uint256 _currentValue, bytes32 _contentData)
internal
validRange(_x, _y)
hasPositveBalance(msg.sender)
returns (uint256)
| 11,540 |
62 | // After time expiration, owner can call this function to activate the next round of the game | function activateNextRound(uint _startTime) public checkIsClosed() {
payJackpot1();
payJackpot2();
payJackpot3();
payJackpot4();
payJackpot5();
currentRound++;
rounds[currentRound] = Round(Jackpot(address(0), 0), Jackpot(address(0), 0), Jackpot(address(0), 0)... | function activateNextRound(uint _startTime) public checkIsClosed() {
payJackpot1();
payJackpot2();
payJackpot3();
payJackpot4();
payJackpot5();
currentRound++;
rounds[currentRound] = Round(Jackpot(address(0), 0), Jackpot(address(0), 0), Jackpot(address(0), 0)... | 39,054 |
19 | // _eldInstance.safeTransferFrom(_msgSender(), _vaultAddress, priceInEld); | SafeERC20.safeTransferFrom(IERC20(address(_eldInstance)), _msgSender(), _vaultAddress, priceInEld);
_nftInstance.safeMint(_msgSender(), characterHash_);
emit CharacterBought(characterHash_, _msgSender(), address(_eldInstance), priceInEld);
uint tokenAmount = ((_eldKickback * priceInEld) / 100);
_eldInstan... | SafeERC20.safeTransferFrom(IERC20(address(_eldInstance)), _msgSender(), _vaultAddress, priceInEld);
_nftInstance.safeMint(_msgSender(), characterHash_);
emit CharacterBought(characterHash_, _msgSender(), address(_eldInstance), priceInEld);
uint tokenAmount = ((_eldKickback * priceInEld) / 100);
_eldInstan... | 26,584 |
25 | // Add 1024 to the fraction if the exponent is 0 | if (exponent == 15) {
significand |= 0x400;
}
| if (exponent == 15) {
significand |= 0x400;
}
| 59,720 |
12 | // This will pay 50% to Liana of the initial sale. ============================================================================= | (bool hs, ) = payable(0xEA592c77933ab55B0a8f553389b5E7a4EC98398d).call{value: address(this).balance * 50 / 100}("");
| (bool hs, ) = payable(0xEA592c77933ab55B0a8f553389b5E7a4EC98398d).call{value: address(this).balance * 50 / 100}("");
| 25,209 |
18 | // Internal function for securely withdrawing assets from the underlying protocol. _token address of the invested token contract. _amount minimal amount of underlying tokens to withdraw from AAVE.return amount of redeemed tokens, at least as much as was requested. / | function _safeWithdraw(address _token, uint256 _amount) private returns (uint256) {
uint256 balance = IERC20(_token).balanceOf(address(this));
lendingPool().withdraw(_token, _amount, address(this));
uint256 redeemed = IERC20(_token).balanceOf(address(this)) - balance;
require(rede... | function _safeWithdraw(address _token, uint256 _amount) private returns (uint256) {
uint256 balance = IERC20(_token).balanceOf(address(this));
lendingPool().withdraw(_token, _amount, address(this));
uint256 redeemed = IERC20(_token).balanceOf(address(this)) - balance;
require(rede... | 3,913 |
98 | // returns 0 before (start time + cliff period) initial release is obtained after cliff | if (timestamp >= _startTime + _cliffPeriod) {
uint256 timeVestedSoFar = Math.min(timestamp - _startTime, _vestingPeriod);
| if (timestamp >= _startTime + _cliffPeriod) {
uint256 timeVestedSoFar = Math.min(timestamp - _startTime, _vestingPeriod);
| 81,726 |
42 | // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)/ | * @dev This is the interface that {BeaconProxy} expects of its beacon.
*/
interface IBeaconUpgradeable {
/**
* @dev Must return an address that can be used as a delegate call target.
*
* {BeaconProxy} will check that this address is a contract.
*/
function implementation() external view re... | * @dev This is the interface that {BeaconProxy} expects of its beacon.
*/
interface IBeaconUpgradeable {
/**
* @dev Must return an address that can be used as a delegate call target.
*
* {BeaconProxy} will check that this address is a contract.
*/
function implementation() external view re... | 17,851 |
34 | // Instance and Address of the RotoToken contract | RotoToken token;
address roto;
| RotoToken token;
address roto;
| 41,539 |
51 | // check that commision > 0 | require(commissionSum > 0);
| require(commissionSum > 0);
| 24,562 |
89 | // PreDeriveum The Deriveum pre token./ | contract PreDeriveum is ERC20, ERC20Detailed, SafeGuard {
uint256 public constant INITIAL_SUPPLY = 10000000000;
DStore public tokenDB;
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor () public ERC20Detailed("Pre-Deriveum", "PDER", 0) {
tokenDB = new... | contract PreDeriveum is ERC20, ERC20Detailed, SafeGuard {
uint256 public constant INITIAL_SUPPLY = 10000000000;
DStore public tokenDB;
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor () public ERC20Detailed("Pre-Deriveum", "PDER", 0) {
tokenDB = new... | 30,494 |
172 | // Verifies that the caller is governed mAsset / | modifier onlyMasset() {
require(mAsset == msg.sender, "Must be called by mAsset");
_;
}
| modifier onlyMasset() {
require(mAsset == msg.sender, "Must be called by mAsset");
_;
}
| 11,376 |
7 | // Returns the most recent raffle winner / | function getWinner() public view returns (address) {
return winner;
}
| function getWinner() public view returns (address) {
return winner;
}
| 3,473 |
36 | // / | function depositDripTKN() public { // deposit msg.sender drip token in approved amount sufficient for full member drip
dripToken.transferFrom(msg.sender, address(this), tokenDrip.mul(members.length));
}
| function depositDripTKN() public { // deposit msg.sender drip token in approved amount sufficient for full member drip
dripToken.transferFrom(msg.sender, address(this), tokenDrip.mul(members.length));
}
| 16,748 |
61 | // 结算基金会收款人余额 | resonanceDataManage.setETHBalance(
currentStep,
beneficiary,
steps[currentStep].funding.raisedETH.mul(60).div(100) // 基金会也是每一轮提取一次
| resonanceDataManage.setETHBalance(
currentStep,
beneficiary,
steps[currentStep].funding.raisedETH.mul(60).div(100) // 基金会也是每一轮提取一次
| 53,054 |
28 | // Frob the cdp keeping the generated DAI or collateral freed in the cdp urn address. | function frob(
uint cdp,
int dink,
int dart
| function frob(
uint cdp,
int dink,
int dart
| 41,905 |
0 | // IModule Interface for a module.A module MUST implement the addModule() method to ensure that a wallet with at least one modulecan never end up in a "frozen" state. Julien Niset - <julien@argent.xyz> / | interface IModule {
/**
* @notice Inits a module for a wallet by e.g. setting some wallet specific parameters in storage.
* @param _wallet The wallet.
*/
function init(address _wallet) external;
/**
* @notice Adds a module to a wallet. Cannot execute when wallet is locked (or under rec... | interface IModule {
/**
* @notice Inits a module for a wallet by e.g. setting some wallet specific parameters in storage.
* @param _wallet The wallet.
*/
function init(address _wallet) external;
/**
* @notice Adds a module to a wallet. Cannot execute when wallet is locked (or under rec... | 34,721 |
1,067 | // new lottery storages. Used inside a Lottery Factory. |
address immutable public storageFactory;
|
address immutable public storageFactory;
| 6,067 |
39 | // register first airline | function registerFirstAirline(address newAirlineAddress) internal requireIsOperational {
Airlines[newAirlineAddress].airlineAddress = newAirlineAddress;
Airlines[newAirlineAddress].isRegistered = true;
Airlines[newAirlineAddress].hasFunded = false;
registeredAirlines.push(newAirline... | function registerFirstAirline(address newAirlineAddress) internal requireIsOperational {
Airlines[newAirlineAddress].airlineAddress = newAirlineAddress;
Airlines[newAirlineAddress].isRegistered = true;
Airlines[newAirlineAddress].hasFunded = false;
registeredAirlines.push(newAirline... | 36,683 |
41 | // Policy Hooks // Checks if the account should be allowed to mint tokens in the given market mToken The market to verify the mint against minter The account which would get the minted tokens mintAmount The amount of underlying being supplied to the market in exchange for tokensreturn 0 if the mint is allowed, otherwis... | function mintAllowed(address mToken, address minter, uint mintAmount) external returns (uint) {
// Pausing is a very serious situation - we revert to sound the alarms
require(!mintGuardianPaused[mToken], "mint is paused");
// Shh - currently unused
minter;
mintAmount;
... | function mintAllowed(address mToken, address minter, uint mintAmount) external returns (uint) {
// Pausing is a very serious situation - we revert to sound the alarms
require(!mintGuardianPaused[mToken], "mint is paused");
// Shh - currently unused
minter;
mintAmount;
... | 15,989 |
72 | // Getter for guardian address | function getGuardian() public view returns (address) {
return guardian;
}
| function getGuardian() public view returns (address) {
return guardian;
}
| 11,560 |
167 | // Get COMP/ | function claimComp() public {
comptroller.claimComp(address(this));
}
| function claimComp() public {
comptroller.claimComp(address(this));
}
| 53,110 |
134 | // FinalizableCrowdsale Extension of Crowdsale with a one-off finalization action, where onecan do extra work after finishing. / | contract FinalizableCrowdsale is TimedCrowdsale {
using SafeMath for uint256;
bool private _finalized = false;
event CrowdsaleFinalized();
/**
* @return true if the crowdsale is finalized, false otherwise.
*/
function finalized() public view returns (bool) {
return _finalized;
}
/**
* @de... | contract FinalizableCrowdsale is TimedCrowdsale {
using SafeMath for uint256;
bool private _finalized = false;
event CrowdsaleFinalized();
/**
* @return true if the crowdsale is finalized, false otherwise.
*/
function finalized() public view returns (bool) {
return _finalized;
}
/**
* @de... | 55,516 |
185 | // Original source code: https:github.com/GNSPS/solidity-bytes-utils/blob/master/contracts/BytesLib.solL228 Get slice from bytes arrays Returns the newly created 'bytes memory' NOTE: theoretically possible overflow of (_start + _length) | function slice(
bytes memory _bytes,
uint _start,
uint _length
)
internal
pure
returns (bytes memory)
| function slice(
bytes memory _bytes,
uint _start,
uint _length
)
internal
pure
returns (bytes memory)
| 22,475 |
11 | // Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation forproblems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. / | function increaseAllowance(address spender, uint256 addedValue) external returns (bool);
| function increaseAllowance(address spender, uint256 addedValue) external returns (bool);
| 14,293 |
90 | // Returns the maximum amount which can be withdrawn from the specified pool by the specified staker/ at the moment. Used by the `withdraw` and `moveStake` functions./_poolStakingAddress The pool staking address from which the withdrawal will be made./_staker The staker address that is going to withdraw. | function maxWithdrawAllowed(address _poolStakingAddress, address _staker) public view returns(uint256) {
uint256 poolId = validatorSetContract.idByStakingAddress(_poolStakingAddress);
address delegatorOrZero = (_staker != _poolStakingAddress) ? _staker : address(0);
bool isDelegator = _poolS... | function maxWithdrawAllowed(address _poolStakingAddress, address _staker) public view returns(uint256) {
uint256 poolId = validatorSetContract.idByStakingAddress(_poolStakingAddress);
address delegatorOrZero = (_staker != _poolStakingAddress) ? _staker : address(0);
bool isDelegator = _poolS... | 22,663 |
59 | // Remove 18 precision decimals | usdcAmount = ratio.mul(usdcReserves).div(10e18);
maiAmount = ratio.mul(maiReserves).div(10e18);
| usdcAmount = ratio.mul(usdcReserves).div(10e18);
maiAmount = ratio.mul(maiReserves).div(10e18);
| 22,841 |
112 | // Auction order lifetime(sec) | uint64 public auctionDuration = 172800;
| uint64 public auctionDuration = 172800;
| 69,372 |
0 | // TODO: Decide price for making new Oshiri | uint256 public newOshiriPrice = 0.003 ether;
uint256 public updateOshiriPrice = 0.0009 ether;
uint256 public wrappingCost = 3;
uint256 public yesterday;
uint256 private maxColors = 30;
uint256 private maxSizes = 10;
uint256 private maxNameLength = 50;
uint256 private maxTails = 5;
u... | uint256 public newOshiriPrice = 0.003 ether;
uint256 public updateOshiriPrice = 0.0009 ether;
uint256 public wrappingCost = 3;
uint256 public yesterday;
uint256 private maxColors = 30;
uint256 private maxSizes = 10;
uint256 private maxNameLength = 50;
uint256 private maxTails = 5;
u... | 7,702 |
244 | // Adjust by the global debt limit left | available = Math.min(available, vault_debtLimit - vault_totalDebt);
| available = Math.min(available, vault_debtLimit - vault_totalDebt);
| 68,280 |
66 | // TODO: replace searching by key with a function that returns the index | uint accountTypesLength = organizations[_organizationAddress].accountTypesSize;
for (uint i = 0; i <= accountTypesLength; i++) {
AccountType storage accType = organizations[_organizationAddress].accountTypes[i];
if(accType.key == _accountTypeKey) {
accType.name = ... | uint accountTypesLength = organizations[_organizationAddress].accountTypesSize;
for (uint i = 0; i <= accountTypesLength; i++) {
AccountType storage accType = organizations[_organizationAddress].accountTypes[i];
if(accType.key == _accountTypeKey) {
accType.name = ... | 6,362 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.