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
|
|---|---|---|---|---|
2
|
// Amount of tokens sold during SALE phase and not yet claimed
|
uint256 public locked;
|
uint256 public locked;
| 77,243
|
73
|
// Create a lot with `primordialAmount` of primordial ions with `_multiplier` for an `account` during network exchange, and reward `_networkBonusAmount` if exist _account Address of the lot owner _primordialAmount The amount of primordial ions to be stored in the lot _multiplier The multiplier for this lot in (106) _networkBonusAmount The network ion bonus amountreturn Created lot Id /
|
function _createPrimordialLot(address _account, uint256 _primordialAmount, uint256 _multiplier, uint256 _networkBonusAmount) internal returns (bytes32) {
bytes32 lotId = _aoIonLot.createPrimordialLot(_account, _primordialAmount, _multiplier, _networkBonusAmount);
ownerWeightedMultiplier[_account] = AOLibrary.calculateWeightedMultiplier(ownerWeightedMultiplier[_account], primordialBalanceOf[_account], _multiplier, _primordialAmount);
// If this is the first lot, set this as the max multiplier of the account
if (_aoIonLot.totalLotsByAddress(_account) == 1) {
ownerMaxMultiplier[_account] = _multiplier;
}
_mintPrimordial(_account, _primordialAmount);
_mint(_account, _networkBonusAmount);
return lotId;
}
|
function _createPrimordialLot(address _account, uint256 _primordialAmount, uint256 _multiplier, uint256 _networkBonusAmount) internal returns (bytes32) {
bytes32 lotId = _aoIonLot.createPrimordialLot(_account, _primordialAmount, _multiplier, _networkBonusAmount);
ownerWeightedMultiplier[_account] = AOLibrary.calculateWeightedMultiplier(ownerWeightedMultiplier[_account], primordialBalanceOf[_account], _multiplier, _primordialAmount);
// If this is the first lot, set this as the max multiplier of the account
if (_aoIonLot.totalLotsByAddress(_account) == 1) {
ownerMaxMultiplier[_account] = _multiplier;
}
_mintPrimordial(_account, _primordialAmount);
_mint(_account, _networkBonusAmount);
return lotId;
}
| 14,440
|
44
|
// Returns if `who` can call `sig`/sig Method signature (4Byte)/who Address of who should be able to call `sig`
|
function canCall(bytes32 sig, address who) public view override returns (bool) {
return (_canCall[sig][who] || _canCall[ANY_SIG][who] || _canCall[sig][ANY_CALLER]);
}
|
function canCall(bytes32 sig, address who) public view override returns (bool) {
return (_canCall[sig][who] || _canCall[ANY_SIG][who] || _canCall[sig][ANY_CALLER]);
}
| 35,849
|
3
|
// Transfer State Contract/ Binod Nirvan/ Enables the admins to maintain the transfer state./Transfer state when disabled disallows everyone but admins to transfer tokens.
|
contract TransferState is CustomPausable {
bool public released = false;
event TokenReleased(bool _state);
///@notice Checks if the supplied address is able to perform transfers.
///@param _from The address to check against if the transfer is allowed.
modifier canTransfer(address _from) {
if(paused || !released) {
if(!isAdmin(_from)) {
revert("Operation not allowed. The transfer state is restricted.");
}
}
_;
}
///@notice This function enables token transfers for everyone.
///Can only be enabled after the end of the ICO.
function enableTransfers() external onlyAdmin whenNotPaused returns(bool) {
require(!released, "Invalid operation. The transfer state is no more restricted.");
released = true;
emit TokenReleased(released);
return true;
}
///@notice This function disables token transfers for everyone.
function disableTransfers() external onlyAdmin whenNotPaused returns(bool) {
require(released, "Invalid operation. The transfer state is already restricted.");
released = false;
emit TokenReleased(released);
return true;
}
}
|
contract TransferState is CustomPausable {
bool public released = false;
event TokenReleased(bool _state);
///@notice Checks if the supplied address is able to perform transfers.
///@param _from The address to check against if the transfer is allowed.
modifier canTransfer(address _from) {
if(paused || !released) {
if(!isAdmin(_from)) {
revert("Operation not allowed. The transfer state is restricted.");
}
}
_;
}
///@notice This function enables token transfers for everyone.
///Can only be enabled after the end of the ICO.
function enableTransfers() external onlyAdmin whenNotPaused returns(bool) {
require(!released, "Invalid operation. The transfer state is no more restricted.");
released = true;
emit TokenReleased(released);
return true;
}
///@notice This function disables token transfers for everyone.
function disableTransfers() external onlyAdmin whenNotPaused returns(bool) {
require(released, "Invalid operation. The transfer state is already restricted.");
released = false;
emit TokenReleased(released);
return true;
}
}
| 32,601
|
375
|
// the ordered list of target addresses for calls to be made
|
address[] targets;
|
address[] targets;
| 9,146
|
108
|
// Retrieves base contract. Differs from address(this) when via delegate-proxy pattern.
|
function base() public view returns (address) {
return _BASE;
}
|
function base() public view returns (address) {
return _BASE;
}
| 28,782
|
188
|
// Interface for the gas-cost-reduced version of the OptimisticOracle. Differences from normal OptimisticOracle:- refundOnDispute: flag is removed, by default there are no refunds on disputes.- customizing request parameters: In the OptimisticOracle, parameters like `bond` and `customLiveness` can be resetafter a request is already made via `requestPrice`. In the SkinnyOptimisticOracle, these parameters can only beset in `requestPrice`, which has an expanded input set.- settleAndGetPrice: Replaced by `settle`, which can only be called once per settleable request. The resolved pricecan be fetched via the `Settle` event or the return value of `settle`.- general changes to interface: Functions that interact with existing requests all
|
abstract contract SkinnyOptimisticOracleInterface {
// Struct representing a price request. Note that this differs from the OptimisticOracleInterface's Request struct
// in that refundOnDispute is removed.
struct Request {
address proposer; // Address of the proposer.
address disputer; // Address of the disputer.
IERC20 currency; // ERC20 token used to pay rewards and fees.
bool settled; // True if the request is settled.
int256 proposedPrice; // Price that the proposer submitted.
int256 resolvedPrice; // Price resolved once the request is settled.
uint256 expirationTime; // Time at which the request auto-settles without a dispute.
uint256 reward; // Amount of the currency to pay to the proposer on settlement.
uint256 finalFee; // Final fee to pay to the Store upon request to the DVM.
uint256 bond; // Bond that the proposer and disputer must pay on top of the final fee.
uint256 customLiveness; // Custom liveness value set by the requester.
}
// This value must be <= the Voting contract's `ancillaryBytesLimit` value otherwise it is possible
// that a price can be requested to this contract successfully, but cannot be disputed because the DVM refuses
// to accept a price request made with ancillary data length over a certain size.
uint256 public constant ancillaryBytesLimit = 8192;
/**
* @notice Requests a new price.
* @param identifier price identifier being requested.
* @param timestamp timestamp of the price being requested.
* @param ancillaryData ancillary data representing additional args being passed with the price request.
* @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.
* @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,
* which could make sense if the contract requests and proposes the value in the same call or
* provides its own reward system.
* @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee.
* @param customLiveness custom proposal liveness to set for request.
* @return totalBond default bond + final fee that the proposer and disputer will be required to pay.
*/
function requestPrice(
bytes32 identifier,
uint32 timestamp,
bytes memory ancillaryData,
IERC20 currency,
uint256 reward,
uint256 bond,
uint256 customLiveness
) external virtual returns (uint256 totalBond);
/**
* @notice Proposes a price value on another address' behalf. Note: this address will receive any rewards that come
* from this proposal. However, any bonds are pulled from the caller.
* @param requester sender of the initial price request.
* @param identifier price identifier to identify the existing request.
* @param timestamp timestamp to identify the existing request.
* @param ancillaryData ancillary data of the price being requested.
* @param request price request parameters whose hash must match the request that the caller wants to
* propose a price for.
* @param proposer address to set as the proposer.
* @param proposedPrice price being proposed.
* @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to
* the proposer once settled if the proposal is correct.
*/
function proposePriceFor(
address requester,
bytes32 identifier,
uint32 timestamp,
bytes memory ancillaryData,
Request memory request,
address proposer,
int256 proposedPrice
) public virtual returns (uint256 totalBond);
/**
* @notice Proposes a price value where caller is the proposer.
* @param requester sender of the initial price request.
* @param identifier price identifier to identify the existing request.
* @param timestamp timestamp to identify the existing request.
* @param ancillaryData ancillary data of the price being requested.
* @param request price request parameters whose hash must match the request that the caller wants to
* propose a price for.
* @param proposedPrice price being proposed.
* @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to
* the proposer once settled if the proposal is correct.
*/
function proposePrice(
address requester,
bytes32 identifier,
uint32 timestamp,
bytes memory ancillaryData,
Request memory request,
int256 proposedPrice
) external virtual returns (uint256 totalBond);
/**
* @notice Combines logic of requestPrice and proposePrice while taking advantage of gas savings from not having to
* overwrite Request params that a normal requestPrice() => proposePrice() flow would entail. Note: The proposer
* will receive any rewards that come from this proposal. However, any bonds are pulled from the caller.
* @dev The caller is the requester, but the proposer can be customized.
* @param identifier price identifier to identify the existing request.
* @param timestamp timestamp to identify the existing request.
* @param ancillaryData ancillary data of the price being requested.
* @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.
* @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,
* which could make sense if the contract requests and proposes the value in the same call or
* provides its own reward system.
* @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee.
* @param customLiveness custom proposal liveness to set for request.
* @param proposer address to set as the proposer.
* @param proposedPrice price being proposed.
* @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to
* the proposer once settled if the proposal is correct.
*/
function requestAndProposePriceFor(
bytes32 identifier,
uint32 timestamp,
bytes memory ancillaryData,
IERC20 currency,
uint256 reward,
uint256 bond,
uint256 customLiveness,
address proposer,
int256 proposedPrice
) external virtual returns (uint256 totalBond);
/**
* @notice Disputes a price request with an active proposal on another address' behalf. Note: this address will
* receive any rewards that come from this dispute. However, any bonds are pulled from the caller.
* @param identifier price identifier to identify the existing request.
* @param timestamp timestamp to identify the existing request.
* @param ancillaryData ancillary data of the price being requested.
* @param request price request parameters whose hash must match the request that the caller wants to
* dispute.
* @param disputer address to set as the disputer.
* @param requester sender of the initial price request.
* @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to
* the disputer once settled if the dispute was valid (the proposal was incorrect).
*/
function disputePriceFor(
bytes32 identifier,
uint32 timestamp,
bytes memory ancillaryData,
Request memory request,
address disputer,
address requester
) public virtual returns (uint256 totalBond);
/**
* @notice Disputes a price request with an active proposal where caller is the disputer.
* @param requester sender of the initial price request.
* @param identifier price identifier to identify the existing request.
* @param timestamp timestamp to identify the existing request.
* @param ancillaryData ancillary data of the price being requested.
* @param request price request parameters whose hash must match the request that the caller wants to
* dispute.
* @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to
* the disputer once settled if the dispute was valid (the proposal was incorrect).
*/
function disputePrice(
address requester,
bytes32 identifier,
uint32 timestamp,
bytes memory ancillaryData,
Request memory request
) external virtual returns (uint256 totalBond);
/**
* @notice Attempts to settle an outstanding price request. Will revert if it isn't settleable.
* @param requester sender of the initial price request.
* @param identifier price identifier to identify the existing request.
* @param timestamp timestamp to identify the existing request.
* @param ancillaryData ancillary data of the price being requested.
* @param request price request parameters whose hash must match the request that the caller wants to
* settle.
* @return payout the amount that the "winner" (proposer or disputer) receives on settlement. This amount includes
* the returned bonds as well as additional rewards.
* @return resolvedPrice the price that the request settled to.
*/
function settle(
address requester,
bytes32 identifier,
uint32 timestamp,
bytes memory ancillaryData,
Request memory request
) external virtual returns (uint256 payout, int256 resolvedPrice);
/**
* @notice Computes the current state of a price request. See the State enum for more details.
* @param requester sender of the initial price request.
* @param identifier price identifier to identify the existing request.
* @param timestamp timestamp to identify the existing request.
* @param ancillaryData ancillary data of the price being requested.
* @param request price request parameters.
* @return the State.
*/
function getState(
address requester,
bytes32 identifier,
uint32 timestamp,
bytes memory ancillaryData,
Request memory request
) external virtual returns (OptimisticOracleInterface.State);
/**
* @notice Checks if a given request has resolved, expired or been settled (i.e the optimistic oracle has a price).
* @param requester sender of the initial price request.
* @param identifier price identifier to identify the existing request.
* @param timestamp timestamp to identify the existing request.
* @param ancillaryData ancillary data of the price being requested.
* @param request price request parameters. The hash of these parameters must match with the request hash that is
* associated with the price request unique ID {requester, identifier, timestamp, ancillaryData}, or this method
* will revert.
* @return boolean indicating true if price exists and false if not.
*/
function hasPrice(
address requester,
bytes32 identifier,
uint32 timestamp,
bytes memory ancillaryData,
Request memory request
) public virtual returns (bool);
/**
* @notice Generates stamped ancillary data in the format that it would be used in the case of a price dispute.
* @param ancillaryData ancillary data of the price being requested.
* @param requester sender of the initial price request.
* @return the stamped ancillary bytes.
*/
function stampAncillaryData(bytes memory ancillaryData, address requester)
public
pure
virtual
returns (bytes memory);
}
|
abstract contract SkinnyOptimisticOracleInterface {
// Struct representing a price request. Note that this differs from the OptimisticOracleInterface's Request struct
// in that refundOnDispute is removed.
struct Request {
address proposer; // Address of the proposer.
address disputer; // Address of the disputer.
IERC20 currency; // ERC20 token used to pay rewards and fees.
bool settled; // True if the request is settled.
int256 proposedPrice; // Price that the proposer submitted.
int256 resolvedPrice; // Price resolved once the request is settled.
uint256 expirationTime; // Time at which the request auto-settles without a dispute.
uint256 reward; // Amount of the currency to pay to the proposer on settlement.
uint256 finalFee; // Final fee to pay to the Store upon request to the DVM.
uint256 bond; // Bond that the proposer and disputer must pay on top of the final fee.
uint256 customLiveness; // Custom liveness value set by the requester.
}
// This value must be <= the Voting contract's `ancillaryBytesLimit` value otherwise it is possible
// that a price can be requested to this contract successfully, but cannot be disputed because the DVM refuses
// to accept a price request made with ancillary data length over a certain size.
uint256 public constant ancillaryBytesLimit = 8192;
/**
* @notice Requests a new price.
* @param identifier price identifier being requested.
* @param timestamp timestamp of the price being requested.
* @param ancillaryData ancillary data representing additional args being passed with the price request.
* @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.
* @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,
* which could make sense if the contract requests and proposes the value in the same call or
* provides its own reward system.
* @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee.
* @param customLiveness custom proposal liveness to set for request.
* @return totalBond default bond + final fee that the proposer and disputer will be required to pay.
*/
function requestPrice(
bytes32 identifier,
uint32 timestamp,
bytes memory ancillaryData,
IERC20 currency,
uint256 reward,
uint256 bond,
uint256 customLiveness
) external virtual returns (uint256 totalBond);
/**
* @notice Proposes a price value on another address' behalf. Note: this address will receive any rewards that come
* from this proposal. However, any bonds are pulled from the caller.
* @param requester sender of the initial price request.
* @param identifier price identifier to identify the existing request.
* @param timestamp timestamp to identify the existing request.
* @param ancillaryData ancillary data of the price being requested.
* @param request price request parameters whose hash must match the request that the caller wants to
* propose a price for.
* @param proposer address to set as the proposer.
* @param proposedPrice price being proposed.
* @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to
* the proposer once settled if the proposal is correct.
*/
function proposePriceFor(
address requester,
bytes32 identifier,
uint32 timestamp,
bytes memory ancillaryData,
Request memory request,
address proposer,
int256 proposedPrice
) public virtual returns (uint256 totalBond);
/**
* @notice Proposes a price value where caller is the proposer.
* @param requester sender of the initial price request.
* @param identifier price identifier to identify the existing request.
* @param timestamp timestamp to identify the existing request.
* @param ancillaryData ancillary data of the price being requested.
* @param request price request parameters whose hash must match the request that the caller wants to
* propose a price for.
* @param proposedPrice price being proposed.
* @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to
* the proposer once settled if the proposal is correct.
*/
function proposePrice(
address requester,
bytes32 identifier,
uint32 timestamp,
bytes memory ancillaryData,
Request memory request,
int256 proposedPrice
) external virtual returns (uint256 totalBond);
/**
* @notice Combines logic of requestPrice and proposePrice while taking advantage of gas savings from not having to
* overwrite Request params that a normal requestPrice() => proposePrice() flow would entail. Note: The proposer
* will receive any rewards that come from this proposal. However, any bonds are pulled from the caller.
* @dev The caller is the requester, but the proposer can be customized.
* @param identifier price identifier to identify the existing request.
* @param timestamp timestamp to identify the existing request.
* @param ancillaryData ancillary data of the price being requested.
* @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM.
* @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0,
* which could make sense if the contract requests and proposes the value in the same call or
* provides its own reward system.
* @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee.
* @param customLiveness custom proposal liveness to set for request.
* @param proposer address to set as the proposer.
* @param proposedPrice price being proposed.
* @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to
* the proposer once settled if the proposal is correct.
*/
function requestAndProposePriceFor(
bytes32 identifier,
uint32 timestamp,
bytes memory ancillaryData,
IERC20 currency,
uint256 reward,
uint256 bond,
uint256 customLiveness,
address proposer,
int256 proposedPrice
) external virtual returns (uint256 totalBond);
/**
* @notice Disputes a price request with an active proposal on another address' behalf. Note: this address will
* receive any rewards that come from this dispute. However, any bonds are pulled from the caller.
* @param identifier price identifier to identify the existing request.
* @param timestamp timestamp to identify the existing request.
* @param ancillaryData ancillary data of the price being requested.
* @param request price request parameters whose hash must match the request that the caller wants to
* dispute.
* @param disputer address to set as the disputer.
* @param requester sender of the initial price request.
* @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to
* the disputer once settled if the dispute was valid (the proposal was incorrect).
*/
function disputePriceFor(
bytes32 identifier,
uint32 timestamp,
bytes memory ancillaryData,
Request memory request,
address disputer,
address requester
) public virtual returns (uint256 totalBond);
/**
* @notice Disputes a price request with an active proposal where caller is the disputer.
* @param requester sender of the initial price request.
* @param identifier price identifier to identify the existing request.
* @param timestamp timestamp to identify the existing request.
* @param ancillaryData ancillary data of the price being requested.
* @param request price request parameters whose hash must match the request that the caller wants to
* dispute.
* @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to
* the disputer once settled if the dispute was valid (the proposal was incorrect).
*/
function disputePrice(
address requester,
bytes32 identifier,
uint32 timestamp,
bytes memory ancillaryData,
Request memory request
) external virtual returns (uint256 totalBond);
/**
* @notice Attempts to settle an outstanding price request. Will revert if it isn't settleable.
* @param requester sender of the initial price request.
* @param identifier price identifier to identify the existing request.
* @param timestamp timestamp to identify the existing request.
* @param ancillaryData ancillary data of the price being requested.
* @param request price request parameters whose hash must match the request that the caller wants to
* settle.
* @return payout the amount that the "winner" (proposer or disputer) receives on settlement. This amount includes
* the returned bonds as well as additional rewards.
* @return resolvedPrice the price that the request settled to.
*/
function settle(
address requester,
bytes32 identifier,
uint32 timestamp,
bytes memory ancillaryData,
Request memory request
) external virtual returns (uint256 payout, int256 resolvedPrice);
/**
* @notice Computes the current state of a price request. See the State enum for more details.
* @param requester sender of the initial price request.
* @param identifier price identifier to identify the existing request.
* @param timestamp timestamp to identify the existing request.
* @param ancillaryData ancillary data of the price being requested.
* @param request price request parameters.
* @return the State.
*/
function getState(
address requester,
bytes32 identifier,
uint32 timestamp,
bytes memory ancillaryData,
Request memory request
) external virtual returns (OptimisticOracleInterface.State);
/**
* @notice Checks if a given request has resolved, expired or been settled (i.e the optimistic oracle has a price).
* @param requester sender of the initial price request.
* @param identifier price identifier to identify the existing request.
* @param timestamp timestamp to identify the existing request.
* @param ancillaryData ancillary data of the price being requested.
* @param request price request parameters. The hash of these parameters must match with the request hash that is
* associated with the price request unique ID {requester, identifier, timestamp, ancillaryData}, or this method
* will revert.
* @return boolean indicating true if price exists and false if not.
*/
function hasPrice(
address requester,
bytes32 identifier,
uint32 timestamp,
bytes memory ancillaryData,
Request memory request
) public virtual returns (bool);
/**
* @notice Generates stamped ancillary data in the format that it would be used in the case of a price dispute.
* @param ancillaryData ancillary data of the price being requested.
* @param requester sender of the initial price request.
* @return the stamped ancillary bytes.
*/
function stampAncillaryData(bytes memory ancillaryData, address requester)
public
pure
virtual
returns (bytes memory);
}
| 32,537
|
107
|
// Initialize Grantees.
|
address lastAddress = address(0);
uint256 _cumulativeTargetFunding = 0;
for (uint256 i = 0; i < _grantees.length; i++) {
address currentGrantee = _grantees[i];
uint256 currentAmount = _amounts[i];
require(
currentAmount > 0,
"constructor::Invalid Argument. currentAmount must be greater than 0."
);
|
address lastAddress = address(0);
uint256 _cumulativeTargetFunding = 0;
for (uint256 i = 0; i < _grantees.length; i++) {
address currentGrantee = _grantees[i];
uint256 currentAmount = _amounts[i];
require(
currentAmount > 0,
"constructor::Invalid Argument. currentAmount must be greater than 0."
);
| 40,883
|
44
|
// Returns the oracle rate given the market ratios of fCash to cash. The annualizedAnchorRate/ is used to calculate a rate anchor. Since a rate anchor varies with timeToMaturity and annualizedAnchorRate/ does not, this method will return consistent values regardless of the timeToMaturity of when initialize/ markets is called. This can be helpful if a currency needs to be initialized mid quarter when it is/ newly launched.
|
function _calculateOracleRate(
int256 fCashAmount,
int256 underlyingCashToMarket,
int256 rateScalar,
uint256 annualizedAnchorRate,
uint256 timeToMaturity
|
function _calculateOracleRate(
int256 fCashAmount,
int256 underlyingCashToMarket,
int256 rateScalar,
uint256 annualizedAnchorRate,
uint256 timeToMaturity
| 40,150
|
170
|
// Count NFTs tracked by this contract/ return A count of valid NFTs tracked by this contract, where each one of/them has an assigned and queryable owner not equal to the zero address
|
function totalSupply() public view returns (uint) {
return playerTokens.length;
}
|
function totalSupply() public view returns (uint) {
return playerTokens.length;
}
| 23,699
|
126
|
// total debt is increased
|
totalDebt = totalDebt.add( value );
|
totalDebt = totalDebt.add( value );
| 10,277
|
1
|
// deploy 的时候 value 填空 构造的不用传money过去 deploy 完毕的时候调用transfer的方法 填写value
|
contract TransferTest {
address AliceAddress = 0xb685ed019fc04b40454c56db1c2102083a5b47dc;
function transfer() {
AliceAddress.transfer(msg.value);
}
}
|
contract TransferTest {
address AliceAddress = 0xb685ed019fc04b40454c56db1c2102083a5b47dc;
function transfer() {
AliceAddress.transfer(msg.value);
}
}
| 39,368
|
131
|
// User withdraws the deposit
|
event Withdraw(
address indexed user,
uint256 depositId,
uint256 amount // amount sent to user (in deposit token units)
);
event InterimWithdraw(
address indexed user,
uint256 depositId,
uint256 amount, // amount sent to user (in "repay" token units)
|
event Withdraw(
address indexed user,
uint256 depositId,
uint256 amount // amount sent to user (in deposit token units)
);
event InterimWithdraw(
address indexed user,
uint256 depositId,
uint256 amount, // amount sent to user (in "repay" token units)
| 41,737
|
40
|
// enable transfer after token sale and before listing
|
function enableTransfer() onlyOwner public {
transferable = true;
EnableTransfer();
}
|
function enableTransfer() onlyOwner public {
transferable = true;
EnableTransfer();
}
| 32,678
|
0
|
// payout to previous owner
|
for (uint i = 0; i < owners.length; i++)
{
uint accbalance = address(this).balance;
uint payout = (accbalance - fee) / owners.length;
payable(owners[i]).transfer(payout);
}
|
for (uint i = 0; i < owners.length; i++)
{
uint accbalance = address(this).balance;
uint payout = (accbalance - fee) / owners.length;
payable(owners[i]).transfer(payout);
}
| 39,195
|
36
|
// NFT rendering logic contract
|
SharedNFTLogic private immutable _sharedNFTLogic;
|
SharedNFTLogic private immutable _sharedNFTLogic;
| 17,265
|
7
|
// コメント番号・インデックス => コメント
|
mapping(uint256 => mapping(uint256 => string)) public comment;
|
mapping(uint256 => mapping(uint256 => string)) public comment;
| 4,320
|
134
|
// How much wei we have given back to investors.
|
uint256 public amountRefunded = 0;
|
uint256 public amountRefunded = 0;
| 18,488
|
146
|
// Return the buy price of 1 individual token. /
|
function sellPrice()
public
view
returns(uint256)
|
function sellPrice()
public
view
returns(uint256)
| 21,529
|
68
|
// Get the user scaled balance
|
uint256 userScaledBalance = userScaledBalances[user];
if(userScaledBalance == 0) return 0;
|
uint256 userScaledBalance = userScaledBalances[user];
if(userScaledBalance == 0) return 0;
| 28,581
|
0
|
// Guard variable for re-entrancy checks /
|
bool internal _notEntered;
|
bool internal _notEntered;
| 15,015
|
71
|
// You can nest mappings, this example maps owner to operator approvals
|
mapping(address => mapping(address => bool)) private operatorApprovals;
function setApprovalForAll(address to, bool approved) public override {
operatorApprovals[msg.sender][to] = approved;
|
mapping(address => mapping(address => bool)) private operatorApprovals;
function setApprovalForAll(address to, bool approved) public override {
operatorApprovals[msg.sender][to] = approved;
| 12,843
|
16
|
// SWAP AND BRIDGE
|
function swapAndBridge(UserSwapBridgeRequest calldata _userRequest, bytes memory _sign)
external
payable
ensure(_userRequest.deadline)
nonReentrant
|
function swapAndBridge(UserSwapBridgeRequest calldata _userRequest, bytes memory _sign)
external
payable
ensure(_userRequest.deadline)
nonReentrant
| 34,767
|
16
|
// bit 0-15: LTVbit 16-31: Liq. thresholdbit 32-47: Liq. bonusbit 48-55: Decimalsbit 56: reserve is activebit 57: reserve is frozenbit 58: borrowing is enabledbit 59: stable rate borrowing enabledbit 60: asset is pausedbit 61: borrowing in isolation mode is enabledbit 62-63: reservedbit 64-79: reserve factorbit 80-115 borrow cap in whole tokens, borrowCap == 0 => no capbit 116-151 supply cap in whole tokens, supplyCap == 0 => no capbit 152-167 liquidation protocol feebit 168-175 eMode categorybit 176-211 unbacked mint cap in whole tokens, unbackedMintCap == 0 => minting disabledbit 212-251 debt ceiling for isolation mode with (ReserveConfiguration::DEBT_CEILING_DECIMALS) decimalsbit 252-255 unused
|
uint256 data;
|
uint256 data;
| 11,463
|
1
|
// Initializes the contract./upgradingPrice_ Upgrading price./tether_ Tether USD contract address./treasury_ Treasury address./eye_ eYe token contract address. /eyecons_ EYECONS collection contract address./authority_ Authorised address.
|
function initialize(
uint256 upgradingPrice_,
IERC20MetadataUpgradeable tether_,
address payable treasury_,
address eye_,
address eyecons_,
address authority_
)
external;
|
function initialize(
uint256 upgradingPrice_,
IERC20MetadataUpgradeable tether_,
address payable treasury_,
address eye_,
address eyecons_,
address authority_
)
external;
| 41,678
|
10
|
// crazy cats
|
svgString = string(abi.encodePacked(
drawTrait(traitData[13][s.body]),
drawTrait(traitData[16][s.eyebrows]),
drawTrait(traitData[15][s.eyes]),
drawTrait(traitData[18][s.glasses]),
drawTrait(traitData[19][s.hair]),
drawTrait(traitData[25][s.shirts])
));
|
svgString = string(abi.encodePacked(
drawTrait(traitData[13][s.body]),
drawTrait(traitData[16][s.eyebrows]),
drawTrait(traitData[15][s.eyes]),
drawTrait(traitData[18][s.glasses]),
drawTrait(traitData[19][s.hair]),
drawTrait(traitData[25][s.shirts])
));
| 36,002
|
29
|
// _directory A directory of terminals and controllers for projects./_payMetadataDelegateId The 4bytes ID of this delegate, used for pay metadata parsing/_redeemMetadataDelegateId The 4bytes ID of this delegate, used for redeem metadata parsing
|
constructor(IJBDirectory _directory, bytes4 _payMetadataDelegateId, bytes4 _redeemMetadataDelegateId) {
directory = _directory;
payMetadataDelegateId = _payMetadataDelegateId;
redeemMetadataDelegateId = _redeemMetadataDelegateId;
}
|
constructor(IJBDirectory _directory, bytes4 _payMetadataDelegateId, bytes4 _redeemMetadataDelegateId) {
directory = _directory;
payMetadataDelegateId = _payMetadataDelegateId;
redeemMetadataDelegateId = _redeemMetadataDelegateId;
}
| 18,969
|
126
|
// burn user's equivalent KUSD
|
kUSD.burn(msgSender, vars.equivalentKUSDAmount);
|
kUSD.burn(msgSender, vars.equivalentKUSDAmount);
| 34,117
|
23
|
// Creates a new Person with the given name.
|
function createContractPerson(string _name) public onlyCOO {
_createPerson(_name, address(this), startingPrice);
}
|
function createContractPerson(string _name) public onlyCOO {
_createPerson(_name, address(this), startingPrice);
}
| 46,375
|
2
|
// burn option token from an address. Can only be called by corresponding vault _from account to burn from _vaultvault to mint for _amount amount to burn/
|
function burn(address _from, address _vault, uint256 _amount) external;
|
function burn(address _from, address _vault, uint256 _amount) external;
| 24,978
|
59
|
// For creating Pow
|
function _createPow(string _name, address _owner, uint256 _price, uint _gameId, uint _gameItemId) private {
Pow memory _pow = Pow({
name: _name,
gameId: _gameId,
gameItemId: _gameItemId
});
uint256 newPowId = pows.push(_pow) - 1;
// It's probably never going to happen, 4 billion tokens are A LOT, but
// let's just be 100% sure we never let this happen.
require(newPowId == uint256(uint32(newPowId)));
Birth(newPowId, _name, _owner);
powIndexToPrice[newPowId] = _price;
// This will assign ownership, and also emit the Transfer event as
// per ERC721 draft
_transfer(address(0), _owner, newPowId);
}
|
function _createPow(string _name, address _owner, uint256 _price, uint _gameId, uint _gameItemId) private {
Pow memory _pow = Pow({
name: _name,
gameId: _gameId,
gameItemId: _gameItemId
});
uint256 newPowId = pows.push(_pow) - 1;
// It's probably never going to happen, 4 billion tokens are A LOT, but
// let's just be 100% sure we never let this happen.
require(newPowId == uint256(uint32(newPowId)));
Birth(newPowId, _name, _owner);
powIndexToPrice[newPowId] = _price;
// This will assign ownership, and also emit the Transfer event as
// per ERC721 draft
_transfer(address(0), _owner, newPowId);
}
| 38,013
|
174
|
// Solidity only automatically asserts when dividing by 0
|
require(b > 0, errorMessage);
uint256 c = a / b;
|
require(b > 0, errorMessage);
uint256 c = a / b;
| 50,179
|
33
|
// ERC20 Standard Token implementation/
|
contract ERC20Token is IERC20Token, Utils {
using SafeMath for uint256;
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This is for debug purpose
//event Log(address from, string message);
/**
* @dev triggered when tokens are transferred between wallets
*
* @param _from source address
* @param _to target address
* @param _value transfer amount
*/
event Transfer(address indexed _from, address indexed _to, uint256 _value);
/**
* @dev triggered when a wallet allows another wallet to transfer tokens from on its behalf
*
* @param _owner wallet that approves the allowance
* @param _spender wallet that receives the allowance
* @param _value allowance amount
*/
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
// This is for debug purpose
event Log(address from, string message);
/**
* @dev initializes a new ERC20Token instance
*
* @param _name token name
* @param _symbol token symbol
* @param _decimals decimal points, for display purposes
* @param _totalSupply total supply of token units
*/
constructor(string _name, string _symbol, uint8 _decimals, uint256 _totalSupply ) public {
require(bytes(_name).length > 0 , "constructor: name == 0"); // validate input
require(bytes(_symbol).length > 0, "constructor: symbol == 0"); // validate input
name = _name;
symbol = _symbol;
decimals = _decimals;
totalSupply = _totalSupply;
balanceOf[msg.sender] = _totalSupply;
//emit Log(msg.sender, "constractor()");
}
/**
* @dev send coins
* throws on any error rather then return a false flag to minimize user errors
*
* @param _to target address
* @param _value transfer amount
*
* @return true if the transfer was successful, false if it wasn't
*/
function transfer(address _to, uint256 _value)
public
validAddress(_to)
returns (bool success)
{
//emit Log(msg.sender, "transfer() sender");
return _transfer( msg.sender, _to, _value );
}
/**
* @dev an account/contract attempts to get the coins
* throws on any error rather then return a false flag to minimize user errors
*
* @param _from source address
* @param _to target address
* @param _value transfer amount
*
* @return true if the transfer was successful, false if it wasn't
*/
function transferFrom(address _from, address _to, uint256 _value)
public
validAddress(_from)
validAddress(_to)
returns (bool success)
{
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
return _transfer( _from, _to, _value );
}
/**
* @dev allow another account/contract to spend some tokens on your behalf
* throws on any error rather then return a false flag to minimize user errors
*
* also, to minimize the risk of the approve/transferFrom attack vector
* (see https://docs.google.com/document/d/1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM/), approve has to be called twice
* in 2 separate transactions - once to change the allowance to 0 and secondly to change it to the new allowance value
*
* @param _spender approved address
* @param _value allowance amount
*
* @return true if the approval was successful, false if it wasn't
*/
function approve(address _spender, uint256 _value)
public
validAddress(_spender)
returns (bool success)
{
// if the allowance isn't 0, it can only be updated to 0 to prevent an allowance change immediately after withdrawal
return _approve(msg.sender, _spender, _value );
}
/**
* @dev
*
* @param _from source address
* @param _to target address
* @param _value transfer amount
*
* @return true if the transfer was successful, false if it wasn't
*/
function _transfer(address _from, address _to, uint256 _value)
internal
returns (bool success)
{
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
emit Transfer(_from, _to, _value);
return true;
}
function _approve(address _from, address _spender, uint256 _value)
internal
validAddress(_spender)
returns (bool success)
{
// if the allowance isn't 0, it can only be updated to 0 to prevent an allowance change immediately after withdrawal
require(_value == 0 || allowance[_from][_spender] == 0);
allowance[_from][_spender] = _value;
emit Approval(_from, _spender, _value);
return true;
}
}
|
contract ERC20Token is IERC20Token, Utils {
using SafeMath for uint256;
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This is for debug purpose
//event Log(address from, string message);
/**
* @dev triggered when tokens are transferred between wallets
*
* @param _from source address
* @param _to target address
* @param _value transfer amount
*/
event Transfer(address indexed _from, address indexed _to, uint256 _value);
/**
* @dev triggered when a wallet allows another wallet to transfer tokens from on its behalf
*
* @param _owner wallet that approves the allowance
* @param _spender wallet that receives the allowance
* @param _value allowance amount
*/
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
// This is for debug purpose
event Log(address from, string message);
/**
* @dev initializes a new ERC20Token instance
*
* @param _name token name
* @param _symbol token symbol
* @param _decimals decimal points, for display purposes
* @param _totalSupply total supply of token units
*/
constructor(string _name, string _symbol, uint8 _decimals, uint256 _totalSupply ) public {
require(bytes(_name).length > 0 , "constructor: name == 0"); // validate input
require(bytes(_symbol).length > 0, "constructor: symbol == 0"); // validate input
name = _name;
symbol = _symbol;
decimals = _decimals;
totalSupply = _totalSupply;
balanceOf[msg.sender] = _totalSupply;
//emit Log(msg.sender, "constractor()");
}
/**
* @dev send coins
* throws on any error rather then return a false flag to minimize user errors
*
* @param _to target address
* @param _value transfer amount
*
* @return true if the transfer was successful, false if it wasn't
*/
function transfer(address _to, uint256 _value)
public
validAddress(_to)
returns (bool success)
{
//emit Log(msg.sender, "transfer() sender");
return _transfer( msg.sender, _to, _value );
}
/**
* @dev an account/contract attempts to get the coins
* throws on any error rather then return a false flag to minimize user errors
*
* @param _from source address
* @param _to target address
* @param _value transfer amount
*
* @return true if the transfer was successful, false if it wasn't
*/
function transferFrom(address _from, address _to, uint256 _value)
public
validAddress(_from)
validAddress(_to)
returns (bool success)
{
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
return _transfer( _from, _to, _value );
}
/**
* @dev allow another account/contract to spend some tokens on your behalf
* throws on any error rather then return a false flag to minimize user errors
*
* also, to minimize the risk of the approve/transferFrom attack vector
* (see https://docs.google.com/document/d/1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM/), approve has to be called twice
* in 2 separate transactions - once to change the allowance to 0 and secondly to change it to the new allowance value
*
* @param _spender approved address
* @param _value allowance amount
*
* @return true if the approval was successful, false if it wasn't
*/
function approve(address _spender, uint256 _value)
public
validAddress(_spender)
returns (bool success)
{
// if the allowance isn't 0, it can only be updated to 0 to prevent an allowance change immediately after withdrawal
return _approve(msg.sender, _spender, _value );
}
/**
* @dev
*
* @param _from source address
* @param _to target address
* @param _value transfer amount
*
* @return true if the transfer was successful, false if it wasn't
*/
function _transfer(address _from, address _to, uint256 _value)
internal
returns (bool success)
{
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
emit Transfer(_from, _to, _value);
return true;
}
function _approve(address _from, address _spender, uint256 _value)
internal
validAddress(_spender)
returns (bool success)
{
// if the allowance isn't 0, it can only be updated to 0 to prevent an allowance change immediately after withdrawal
require(_value == 0 || allowance[_from][_spender] == 0);
allowance[_from][_spender] = _value;
emit Approval(_from, _spender, _value);
return true;
}
}
| 22,887
|
3
|
// (6) 생성자
|
function Crowdsale (
uint _fundingGoalInEthers,
uint _transferableToken,
uint _amountOfTokenPerEther,
CeightToken _addressOfTokenUsedAsReward
) public {
fundingGoal = _fundingGoalInEthers * 1 ether;
price = 1 ether / _amountOfTokenPerEther;
transferableToken = _transferableToken;
tokenReward = CeightToken(_addressOfTokenUsedAsReward);
|
function Crowdsale (
uint _fundingGoalInEthers,
uint _transferableToken,
uint _amountOfTokenPerEther,
CeightToken _addressOfTokenUsedAsReward
) public {
fundingGoal = _fundingGoalInEthers * 1 ether;
price = 1 ether / _amountOfTokenPerEther;
transferableToken = _transferableToken;
tokenReward = CeightToken(_addressOfTokenUsedAsReward);
| 51,431
|
0
|
// The Justpound InterestRateModel InterfaceJustpoundAny interest rate model should derive from this contract.These functions are specifically not marked `pure` as implementations of thiscontract may read from storage variables./
|
contract InterestRateModel {
/**
* @notice Gets the current supply interest rate based on the given asset, total cash and total borrows
* @dev The return value should be scaled by 1e18, thus a return value of
* `(true, 1000000000000)` implies an interest rate of 0.000001 or 0.0001% *per block*.
* @param asset The asset to get the interest rate of
* @param cash The total cash of the asset in the market
* @param borrows The total borrows of the asset in the market
* @return Success or failure and the supply interest rate per block scaled by 10e18
*/
function getSupplyRate(address asset, uint cash, uint borrows) public view returns (uint, uint);
/**
* @notice Gets the current borrow interest rate based on the given asset, total cash and total borrows
* @dev The return value should be scaled by 1e18, thus a return value of
* `(true, 1000000000000)` implies an interest rate of 0.000001 or 0.0001% *per block*.
* @param asset The asset to get the interest rate of
* @param cash The total cash of the asset in the market
* @param borrows The total borrows of the asset in the market
* @return Success or failure and the borrow interest rate per block scaled by 10e18
*/
function getBorrowRate(address asset, uint cash, uint borrows) public view returns (uint, uint);
}
|
contract InterestRateModel {
/**
* @notice Gets the current supply interest rate based on the given asset, total cash and total borrows
* @dev The return value should be scaled by 1e18, thus a return value of
* `(true, 1000000000000)` implies an interest rate of 0.000001 or 0.0001% *per block*.
* @param asset The asset to get the interest rate of
* @param cash The total cash of the asset in the market
* @param borrows The total borrows of the asset in the market
* @return Success or failure and the supply interest rate per block scaled by 10e18
*/
function getSupplyRate(address asset, uint cash, uint borrows) public view returns (uint, uint);
/**
* @notice Gets the current borrow interest rate based on the given asset, total cash and total borrows
* @dev The return value should be scaled by 1e18, thus a return value of
* `(true, 1000000000000)` implies an interest rate of 0.000001 or 0.0001% *per block*.
* @param asset The asset to get the interest rate of
* @param cash The total cash of the asset in the market
* @param borrows The total borrows of the asset in the market
* @return Success or failure and the borrow interest rate per block scaled by 10e18
*/
function getBorrowRate(address asset, uint cash, uint borrows) public view returns (uint, uint);
}
| 1,874
|
9
|
// See which address owns which tokens
|
function tokensOfOwner(address addr) public view returns(uint256[] memory) {
uint256 tokenCount = balanceOf(addr);
uint256[] memory tokensId = new uint256[](tokenCount);
for(uint256 i; i < tokenCount; i++){
tokensId[i] = tokenOfOwnerByIndex(addr, i);
}
return tokensId;
}
|
function tokensOfOwner(address addr) public view returns(uint256[] memory) {
uint256 tokenCount = balanceOf(addr);
uint256[] memory tokensId = new uint256[](tokenCount);
for(uint256 i; i < tokenCount; i++){
tokensId[i] = tokenOfOwnerByIndex(addr, i);
}
return tokensId;
}
| 20,566
|
67
|
// buy
|
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
if (contractTokenBalance > 0) {
if (contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
|
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
if (contractTokenBalance > 0) {
if (contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
| 40,022
|
9
|
// Saftey Checks for Divison Tasks
|
function div(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b > 0);
uint256 c = a / b;
assert(a == b * c + a % b);
return c;
}
|
function div(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b > 0);
uint256 c = a / b;
assert(a == b * c + a % b);
return c;
}
| 18,817
|
0
|
// Mapping from tokenId of a batch of tokens => to delayed reveal data.
|
mapping(uint256 => bytes) encryptedData;
|
mapping(uint256 => bytes) encryptedData;
| 5,534
|
21
|
// Prevent multiple calls
|
require(!player[msg.sender].isBroker);
|
require(!player[msg.sender].isBroker);
| 12,309
|
4
|
// `interfaceId`. Support for {IERC165} itself is queried automatically. See {IERC165-supportsInterface}. /
|
function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {
|
function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {
| 36,646
|
14
|
// Declare temporary variable for enforcing payable status.
|
bool correctPayableStatus;
|
bool correctPayableStatus;
| 17,318
|
51
|
// Update global account staking details.
|
accountDetails[account].stakeEntries++;
|
accountDetails[account].stakeEntries++;
| 34,650
|
108
|
// Create frozen wallets
|
FrozenWallet memory frozenWallet = FrozenWallet(
wallet,
totalAmount,
monthlyAmount,
initialAmount,
releaseTime.add(afterDays),
afterDays,
true,
monthDelay
);
|
FrozenWallet memory frozenWallet = FrozenWallet(
wallet,
totalAmount,
monthlyAmount,
initialAmount,
releaseTime.add(afterDays),
afterDays,
true,
monthDelay
);
| 16,998
|
256
|
// aggregate getter to build better frontend
|
function getPunksForAddress(address _user, uint256 userBal) external view returns(uint256[] memory) {
uint256[] memory punks = new uint256[](userBal);
uint256 j =0;
uint256 i=0;
for (i=0; i<10000; i++) {
if ( _punkContract.punkIndexToAddress(i) == _user ) {
punks[j] = i;
j++;
}
}
return punks;
}
|
function getPunksForAddress(address _user, uint256 userBal) external view returns(uint256[] memory) {
uint256[] memory punks = new uint256[](userBal);
uint256 j =0;
uint256 i=0;
for (i=0; i<10000; i++) {
if ( _punkContract.punkIndexToAddress(i) == _user ) {
punks[j] = i;
j++;
}
}
return punks;
}
| 56,559
|
11
|
// If the bid is not higher, send the money back.
|
require(msg.value > highestBid);
if (highestBidder != address(0x0)) {
|
require(msg.value > highestBid);
if (highestBidder != address(0x0)) {
| 44,082
|
1
|
// ここにdnaModulusを定義するのだ
|
uint256 dnaModulus = 10**dnaDigits;
|
uint256 dnaModulus = 10**dnaDigits;
| 17,128
|
280
|
// We need to migrate all player location from Beta token contract to Version 1. /
|
function migratePlayer(address _address, uint _ownerDungeonId, uint _payment, uint _faith) external {
// Migration will be finished before maintenance period ends, tx.origin is used within a short period only.
require(now < 1520694000 && tx.origin == 0x47169f78750Be1e6ec2DEb2974458ac4F8751714);
playerToDungeonID[_address] = _ownerDungeonId;
if (_payment > 0) {
asyncSend(_address, _payment);
}
if (_faith > 0) {
playerToFaith[_address] = _faith;
}
playerToFirstHeroRecruited[_address] = true;
}
|
function migratePlayer(address _address, uint _ownerDungeonId, uint _payment, uint _faith) external {
// Migration will be finished before maintenance period ends, tx.origin is used within a short period only.
require(now < 1520694000 && tx.origin == 0x47169f78750Be1e6ec2DEb2974458ac4F8751714);
playerToDungeonID[_address] = _ownerDungeonId;
if (_payment > 0) {
asyncSend(_address, _payment);
}
if (_faith > 0) {
playerToFaith[_address] = _faith;
}
playerToFirstHeroRecruited[_address] = true;
}
| 42,936
|
1
|
// Commit passed address to transferProxyAddress state variable
|
state.transferProxy = _transferProxy;
|
state.transferProxy = _transferProxy;
| 14,146
|
305
|
// Private Function to check if the user is not whitelisted by the current user _ein is the EIN of the self _otherEIN is the EIN of the target user /
|
function _isNotWhitelist(uint _ein, uint _otherEIN)
|
function _isNotWhitelist(uint _ein, uint _otherEIN)
| 37,007
|
9
|
// An event emitted when a new proposal is created
|
event ProposalCreated(
uint256 id,
address proposer,
address[] targets,
uint256[] values,
string[] signatures,
bytes[] calldatas,
uint256 startBlock,
uint256 endBlock,
string description
|
event ProposalCreated(
uint256 id,
address proposer,
address[] targets,
uint256[] values,
string[] signatures,
bytes[] calldatas,
uint256 startBlock,
uint256 endBlock,
string description
| 68,701
|
165
|
// return boxPool[curRoundNo]25/100/5;
|
return totalInvestment[curRoundNo]*2/100 *25/100 /5;
|
return totalInvestment[curRoundNo]*2/100 *25/100 /5;
| 22,124
|
106
|
// Require that the UTXO can be redeemed
|
require(CanClaimUTXOHash(hMerkleLeafHash, a_hMerkleTreeBranches, a_nWhichChain), "UTXO Cannot be redeemed.");
|
require(CanClaimUTXOHash(hMerkleLeafHash, a_hMerkleTreeBranches, a_nWhichChain), "UTXO Cannot be redeemed.");
| 31,181
|
72
|
// Returns the address of the current supervisor. /
|
function supervisor() public view virtual returns (address) {
return _supervisor;
}
|
function supervisor() public view virtual returns (address) {
return _supervisor;
}
| 52,796
|
2
|
// The ContractNameRegistry constructor sets the original `owner` of the contract /
|
constructor() public {
ctOwner = msg.sender;
}
|
constructor() public {
ctOwner = msg.sender;
}
| 19,651
|
4
|
// Require a URI to be not empty uri_ URI /
|
modifier notEmptyURI(string memory uri_) {
require(bytes(uri_).length > 0, "Cannot set an empty URI");
_;
}
|
modifier notEmptyURI(string memory uri_) {
require(bytes(uri_).length > 0, "Cannot set an empty URI");
_;
}
| 18,506
|
282
|
// Emitted when user adds liquidity/sender The address that minted the liquidity/share The amount of share of liquidity added by the user to position/amount0 How much token0 was required for the added liquidity/amount1 How much token1 was required for the added liquidity
|
event Deposit(
address indexed sender,
uint256 share,
uint256 amount0,
uint256 amount1
);
|
event Deposit(
address indexed sender,
uint256 share,
uint256 amount0,
uint256 amount1
);
| 56,541
|
125
|
// Function to initialize the contract claimsManagerAddress must be initialized separately after ClaimsManager contract is deployed delegateManagerAddress must be initialized separately after DelegateManager contract is deployed serviceProviderFactoryAddress must be initialized separately after ServiceProviderFactory contract is deployed _tokenAddress - address of ERC20 token that will be staked _governanceAddress - address for Governance proxy contract /
|
function initialize(
address _tokenAddress,
address _governanceAddress
) public initializer
|
function initialize(
address _tokenAddress,
address _governanceAddress
) public initializer
| 45,168
|
88
|
// -Infinity. /
|
bytes16 private constant _NEGATIVE_INFINITY =
|
bytes16 private constant _NEGATIVE_INFINITY =
| 67,453
|
106
|
// Block number from which tokens are initially transferable
|
uint256 public transferableFromBlock;
|
uint256 public transferableFromBlock;
| 7,960
|
6
|
// Mints a new NFT. This is an internal function which should be called from user-implemented externalmint function. Its purpose is to show and properly initialize data structures when using thisimplementation. _to The address that will own the minted NFT. _tokenId of the NFT to be minted by the msg.sender. /
|
function _mint(
address _to,
uint256 _tokenId
)
internal
override(NFToken, NFTokenEnumerable)
virtual
|
function _mint(
address _to,
uint256 _tokenId
)
internal
override(NFToken, NFTokenEnumerable)
virtual
| 6,190
|
1
|
// Struct representing the elements that are hashed together to generate an output rootwhich itself represents a snapshot of the L2 state. @custom:field versionVersion of the output root.@custom:field stateRootRoot of the state trie at the block of this output.@custom:field messagePasserStorageRoot Root of the message passer storage trie.@custom:field latestBlockhashHash of the block this output was generated from. /
|
struct OutputRootProof {
bytes32 version;
bytes32 stateRoot;
bytes32 messagePasserStorageRoot;
bytes32 latestBlockhash;
}
|
struct OutputRootProof {
bytes32 version;
bytes32 stateRoot;
bytes32 messagePasserStorageRoot;
bytes32 latestBlockhash;
}
| 15,891
|
3
|
// notes down how much an account may claim
|
mapping(address => uint256) public accumulatedRewards;
event RewardsUpdated(address indexed account, uint256 rewards);
event RewardsClaimed(address indexed account, uint256 rewardsClaimed);
modifier onlyGovernance() {
require(msg.sender == address(Governance), "only governance");
_;
}
|
mapping(address => uint256) public accumulatedRewards;
event RewardsUpdated(address indexed account, uint256 rewards);
event RewardsClaimed(address indexed account, uint256 rewardsClaimed);
modifier onlyGovernance() {
require(msg.sender == address(Governance), "only governance");
_;
}
| 35,459
|
29
|
// Contract can accept deposits
|
function ()
external
|
function ()
external
| 22,124
|
165
|
// Returns how much gas should be forwarded to a call to relayCall, in order to relay a transaction that will spend up to relayedCallStipend gas.
|
function requiredGas(uint256 relayedCallStipend) public view returns (uint256);
|
function requiredGas(uint256 relayedCallStipend) public view returns (uint256);
| 13,748
|
16
|
// DeFiPie's PEther Contract PToken which wraps Ether DeFiPie /
|
contract PEther is ImplementationStorage, PToken {
/**
* @notice Construct a new PEther money market
* @param controller_ The address of the Controller
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantissa_ The initial exchange rate, scaled by 1e18
* @param initialReserveFactorMantissa_ The initial reserve factor, scaled by 1e18
* @param name_ ERC-20 name of this token
* @param symbol_ ERC-20 symbol of this token
* @param decimals_ ERC-20 decimal precision of this token
*/
function initialize(
RegistryInterface registry_,
ControllerInterface controller_,
InterestRateModel interestRateModel_,
uint initialExchangeRateMantissa_,
uint initialReserveFactorMantissa_,
string memory name_,
string memory symbol_,
uint8 decimals_
)
public override
{
super.initialize(registry_, controller_, interestRateModel_, initialExchangeRateMantissa_, initialReserveFactorMantissa_, name_, symbol_, decimals_);
}
/*** User Interface ***/
/**
* @notice Sender supplies assets into the market and receives pTokens in exchange
* @dev Reverts upon any failure
*/
function mint() external payable {
(uint err,) = mintInternal(msg.value);
requireNoError(err, "mint failed");
}
/**
* @notice Sender redeems pTokens in exchange for the underlying asset
* @dev Accrues interest whether or not the operation succeeds, unless reverted
* @param redeemTokens The number of pTokens to redeem into underlying
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function redeem(uint redeemTokens) external returns (uint) {
return redeemInternal(redeemTokens);
}
/**
* @notice Sender redeems pTokens in exchange for a specified amount of underlying asset
* @dev Accrues interest whether or not the operation succeeds, unless reverted
* @param redeemAmount The amount of underlying to redeem
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function redeemUnderlying(uint redeemAmount) external returns (uint) {
return redeemUnderlyingInternal(redeemAmount);
}
/**
* @notice Sender borrows assets from the protocol to their own address
* @param borrowAmount The amount of the underlying asset to borrow
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function borrow(uint borrowAmount) external returns (uint) {
return borrowInternal(borrowAmount);
}
/**
* @notice Sender repays their own borrow
* @dev Reverts upon any failure
*/
function repayBorrow() external payable {
(uint err,) = repayBorrowInternal(msg.value);
requireNoError(err, "repayBorrow failed");
}
/**
* @notice Sender repays a borrow belonging to borrower
* @dev Reverts upon any failure
* @param borrower the account with the debt being payed off
*/
function repayBorrowBehalf(address borrower) external payable {
(uint err,) = repayBorrowBehalfInternal(borrower, msg.value);
requireNoError(err, "repayBorrowBehalf failed");
}
/**
* @notice The sender liquidates the borrowers collateral.
* The collateral seized is transferred to the liquidator.
* @dev Reverts upon any failure
* @param borrower The borrower of this pToken to be liquidated
* @param pTokenCollateral The market in which to seize collateral from the borrower
*/
function liquidateBorrow(address borrower, PToken pTokenCollateral) external payable {
(uint err,) = liquidateBorrowInternal(borrower, msg.value, pTokenCollateral);
requireNoError(err, "liquidateBorrow failed");
}
/**
* @notice Send Ether to PEther to mint
*/
fallback() external payable {
(uint err,) = mintInternal(msg.value);
requireNoError(err, "mint failed");
}
/**
* @notice Send Ether to PEther to mint
*/
receive() external payable {
(uint err,) = mintInternal(msg.value);
requireNoError(err, "mint failed");
}
/*** Safe Token ***/
/**
* @notice Gets balance of this contract in terms of Ether, before this message
* @dev This excludes the value of the current message, if any
* @return The quantity of Ether owned by this contract
*/
function getCashPrior() internal view override returns (uint) {
(MathError err, uint startingBalance) = subUInt(address(this).balance, msg.value);
require(err == MathError.NO_ERROR);
return startingBalance;
}
/**
* @notice Perform the actual transfer in, which is a no-op
* @param from Address sending the Ether
* @param amount Amount of Ether being sent
* @return The actual amount of Ether transferred
*/
function doTransferIn(address from, uint amount) internal override returns (uint) {
// Sanity checks
require(msg.sender == from, "sender mismatch");
require(msg.value == amount, "value mismatch");
return amount;
}
function doTransferOut(address payable to, uint amount) internal virtual override {
/* Send the Ether, with minimal gas and revert on failure */
to.transfer(amount);
}
function requireNoError(uint errCode, string memory message) internal pure {
if (errCode == uint(Error.NO_ERROR)) {
return;
}
bytes memory fullMessage = new bytes(bytes(message).length + 5);
uint i;
for (i = 0; i < bytes(message).length; i++) {
fullMessage[i] = bytes(message)[i];
}
fullMessage[i+0] = byte(uint8(32));
fullMessage[i+1] = byte(uint8(40));
fullMessage[i+2] = byte(uint8(48 + ( errCode / 10 )));
fullMessage[i+3] = byte(uint8(48 + ( errCode % 10 )));
fullMessage[i+4] = byte(uint8(41));
require(errCode == uint(Error.NO_ERROR), string(fullMessage));
}
}
|
contract PEther is ImplementationStorage, PToken {
/**
* @notice Construct a new PEther money market
* @param controller_ The address of the Controller
* @param interestRateModel_ The address of the interest rate model
* @param initialExchangeRateMantissa_ The initial exchange rate, scaled by 1e18
* @param initialReserveFactorMantissa_ The initial reserve factor, scaled by 1e18
* @param name_ ERC-20 name of this token
* @param symbol_ ERC-20 symbol of this token
* @param decimals_ ERC-20 decimal precision of this token
*/
function initialize(
RegistryInterface registry_,
ControllerInterface controller_,
InterestRateModel interestRateModel_,
uint initialExchangeRateMantissa_,
uint initialReserveFactorMantissa_,
string memory name_,
string memory symbol_,
uint8 decimals_
)
public override
{
super.initialize(registry_, controller_, interestRateModel_, initialExchangeRateMantissa_, initialReserveFactorMantissa_, name_, symbol_, decimals_);
}
/*** User Interface ***/
/**
* @notice Sender supplies assets into the market and receives pTokens in exchange
* @dev Reverts upon any failure
*/
function mint() external payable {
(uint err,) = mintInternal(msg.value);
requireNoError(err, "mint failed");
}
/**
* @notice Sender redeems pTokens in exchange for the underlying asset
* @dev Accrues interest whether or not the operation succeeds, unless reverted
* @param redeemTokens The number of pTokens to redeem into underlying
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function redeem(uint redeemTokens) external returns (uint) {
return redeemInternal(redeemTokens);
}
/**
* @notice Sender redeems pTokens in exchange for a specified amount of underlying asset
* @dev Accrues interest whether or not the operation succeeds, unless reverted
* @param redeemAmount The amount of underlying to redeem
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function redeemUnderlying(uint redeemAmount) external returns (uint) {
return redeemUnderlyingInternal(redeemAmount);
}
/**
* @notice Sender borrows assets from the protocol to their own address
* @param borrowAmount The amount of the underlying asset to borrow
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function borrow(uint borrowAmount) external returns (uint) {
return borrowInternal(borrowAmount);
}
/**
* @notice Sender repays their own borrow
* @dev Reverts upon any failure
*/
function repayBorrow() external payable {
(uint err,) = repayBorrowInternal(msg.value);
requireNoError(err, "repayBorrow failed");
}
/**
* @notice Sender repays a borrow belonging to borrower
* @dev Reverts upon any failure
* @param borrower the account with the debt being payed off
*/
function repayBorrowBehalf(address borrower) external payable {
(uint err,) = repayBorrowBehalfInternal(borrower, msg.value);
requireNoError(err, "repayBorrowBehalf failed");
}
/**
* @notice The sender liquidates the borrowers collateral.
* The collateral seized is transferred to the liquidator.
* @dev Reverts upon any failure
* @param borrower The borrower of this pToken to be liquidated
* @param pTokenCollateral The market in which to seize collateral from the borrower
*/
function liquidateBorrow(address borrower, PToken pTokenCollateral) external payable {
(uint err,) = liquidateBorrowInternal(borrower, msg.value, pTokenCollateral);
requireNoError(err, "liquidateBorrow failed");
}
/**
* @notice Send Ether to PEther to mint
*/
fallback() external payable {
(uint err,) = mintInternal(msg.value);
requireNoError(err, "mint failed");
}
/**
* @notice Send Ether to PEther to mint
*/
receive() external payable {
(uint err,) = mintInternal(msg.value);
requireNoError(err, "mint failed");
}
/*** Safe Token ***/
/**
* @notice Gets balance of this contract in terms of Ether, before this message
* @dev This excludes the value of the current message, if any
* @return The quantity of Ether owned by this contract
*/
function getCashPrior() internal view override returns (uint) {
(MathError err, uint startingBalance) = subUInt(address(this).balance, msg.value);
require(err == MathError.NO_ERROR);
return startingBalance;
}
/**
* @notice Perform the actual transfer in, which is a no-op
* @param from Address sending the Ether
* @param amount Amount of Ether being sent
* @return The actual amount of Ether transferred
*/
function doTransferIn(address from, uint amount) internal override returns (uint) {
// Sanity checks
require(msg.sender == from, "sender mismatch");
require(msg.value == amount, "value mismatch");
return amount;
}
function doTransferOut(address payable to, uint amount) internal virtual override {
/* Send the Ether, with minimal gas and revert on failure */
to.transfer(amount);
}
function requireNoError(uint errCode, string memory message) internal pure {
if (errCode == uint(Error.NO_ERROR)) {
return;
}
bytes memory fullMessage = new bytes(bytes(message).length + 5);
uint i;
for (i = 0; i < bytes(message).length; i++) {
fullMessage[i] = bytes(message)[i];
}
fullMessage[i+0] = byte(uint8(32));
fullMessage[i+1] = byte(uint8(40));
fullMessage[i+2] = byte(uint8(48 + ( errCode / 10 )));
fullMessage[i+3] = byte(uint8(48 + ( errCode % 10 )));
fullMessage[i+4] = byte(uint8(41));
require(errCode == uint(Error.NO_ERROR), string(fullMessage));
}
}
| 43,170
|
65
|
// perform validations for fundAndArb functions /
|
function _validateFundAndArbParams(
Token token,
Token finalToken,
uint256 sourceAmount,
uint256 value
|
function _validateFundAndArbParams(
Token token,
Token finalToken,
uint256 sourceAmount,
uint256 value
| 5,950
|
88
|
// The number of tokens sold so far.
|
uint256 numSold;
bytes32 contentHash;
|
uint256 numSold;
bytes32 contentHash;
| 39,452
|
22
|
// Get Receipt address of an ERC20 token/_token address of the token whose underlying Receipt we are requesting
|
function getUnderlyingReceiptAddress(address _token) external view override returns (address) {
return whitelistedTokens[_token].underlyingReceiptAddress;
}
|
function getUnderlyingReceiptAddress(address _token) external view override returns (address) {
return whitelistedTokens[_token].underlyingReceiptAddress;
}
| 27,242
|
273
|
// Leaves the contract without owner. It will not be possible to call`onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner,thereby removing any functionality that is only available to the owner. /
|
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
|
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
| 1,131
|
48
|
// If overriden to return true, the amount of ETH paid must be exact.return The constant value. /
|
function _useExactPayment() internal view virtual returns (bool) {
return true;
}
|
function _useExactPayment() internal view virtual returns (bool) {
return true;
}
| 36,829
|
2
|
// Beállítja, hogy az adott cím mennyi wei-t kér egy mérésért
|
function setMeasurementFee(uint256 fee) external {
require(fee > 0);
fees[msg.sender] = fee;
}
|
function setMeasurementFee(uint256 fee) external {
require(fee > 0);
fees[msg.sender] = fee;
}
| 11,062
|
45
|
// set an exchange rate in wei _rate uint256 The new exchange rate /
|
function setWeiUsdRate(uint256 _rate) public onlyOwner {
require(_rate > 0);
weiUsdRate = _rate;
}
|
function setWeiUsdRate(uint256 _rate) public onlyOwner {
require(_rate > 0);
weiUsdRate = _rate;
}
| 46,352
|
3
|
// Role identifier for the role allowed to supply isolated reserves as collateral /
|
bytes32 public constant ISOLATED_COLLATERAL_SUPPLIER_ROLE =
keccak256('ISOLATED_COLLATERAL_SUPPLIER');
|
bytes32 public constant ISOLATED_COLLATERAL_SUPPLIER_ROLE =
keccak256('ISOLATED_COLLATERAL_SUPPLIER');
| 25,581
|
2
|
// create car with customer selected options.
|
function createCustomizedCarForCustomer(string memory vin) public { //try any unique string as argument i.e ("111")
customerCarMapping[vin] = CustomizedCar(vin,WheelsChoices.Steel,ColorChoices.yellow,RoofChoices.Vinyl);
}
|
function createCustomizedCarForCustomer(string memory vin) public { //try any unique string as argument i.e ("111")
customerCarMapping[vin] = CustomizedCar(vin,WheelsChoices.Steel,ColorChoices.yellow,RoofChoices.Vinyl);
}
| 15,731
|
98
|
// Add two numbers together checking for overflows
|
function badd(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "ERR_ADD_OVERFLOW");
return c;
}
|
function badd(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "ERR_ADD_OVERFLOW");
return c;
}
| 19,193
|
8
|
// as there is no constructor, we need to initialise the OwnableUpgradeable explicitly
|
__Ownable_init();
_owner = _msgSender();
TEAM_ADDRESS = 0xB9bbDCcBabe90986258e4A0Eda3362E55aF6Dc3D;
ownerAddress = payable(_msgSender());
MAX_EINETIEN_EGGS_TIMER = 108000; // 30 hours
MAX_EINETIEN_EGGS_AUTOCOMPOUND_TIMER = 518400; // 144 hours / 6 days
COMPOUND_LIMIT_TIMER = 21600; // 6 hours
BNB_PER_FROSTFLAKE = 6048000000;
SECONDS_PER_DAY = 86400;
|
__Ownable_init();
_owner = _msgSender();
TEAM_ADDRESS = 0xB9bbDCcBabe90986258e4A0Eda3362E55aF6Dc3D;
ownerAddress = payable(_msgSender());
MAX_EINETIEN_EGGS_TIMER = 108000; // 30 hours
MAX_EINETIEN_EGGS_AUTOCOMPOUND_TIMER = 518400; // 144 hours / 6 days
COMPOUND_LIMIT_TIMER = 21600; // 6 hours
BNB_PER_FROSTFLAKE = 6048000000;
SECONDS_PER_DAY = 86400;
| 14,807
|
0
|
// set contract deployer as owner
|
constructor() {
owner = msg.sender;
}
|
constructor() {
owner = msg.sender;
}
| 56,850
|
68
|
// solhint-disable no-complex-fallback
|
function() external payable {
// Mutable call setting Proxyable.messageSender as this is using call not delegatecall
target.setMessageSender(msg.sender);
assembly {
let free_ptr := mload(0x40)
calldatacopy(free_ptr, 0, calldatasize)
/* We must explicitly forward ether to the underlying contract as well. */
let result := call(gas, sload(target_slot), callvalue, free_ptr, calldatasize, 0, 0)
returndatacopy(free_ptr, 0, returndatasize)
if iszero(result) {
revert(free_ptr, returndatasize)
}
return(free_ptr, returndatasize)
}
}
|
function() external payable {
// Mutable call setting Proxyable.messageSender as this is using call not delegatecall
target.setMessageSender(msg.sender);
assembly {
let free_ptr := mload(0x40)
calldatacopy(free_ptr, 0, calldatasize)
/* We must explicitly forward ether to the underlying contract as well. */
let result := call(gas, sload(target_slot), callvalue, free_ptr, calldatasize, 0, 0)
returndatacopy(free_ptr, 0, returndatasize)
if iszero(result) {
revert(free_ptr, returndatasize)
}
return(free_ptr, returndatasize)
}
}
| 10,569
|
92
|
// Delete the mapping to gas reward.
|
delete offerprice[_mintableToken][tokenID][_erc20Token];
|
delete offerprice[_mintableToken][tokenID][_erc20Token];
| 49,454
|
86
|
// navps = NAVPS_BASE( (balance1_op.ethAmountK_BASE) + (balance0_op.erc20Amount(K_BASE+_op.K)) ) / _totalSupply / _op.erc20Amount / (K_BASE+_op.K);/
|
uint256 kbaseAddK = K_BASE.add(_op.K);
uint256 balance1MulEthKbase = balance1.mul(_op.ethAmount).mul(K_BASE);
uint256 balance0MulErcKbsk = balance0.mul(_op.erc20Amount).mul(kbaseAddK);
navps = NAVPS_BASE.mul( (balance1MulEthKbase).add(balance0MulErcKbsk) ).div(_totalSupply).div(_op.erc20Amount).div(kbaseAddK);
|
uint256 kbaseAddK = K_BASE.add(_op.K);
uint256 balance1MulEthKbase = balance1.mul(_op.ethAmount).mul(K_BASE);
uint256 balance0MulErcKbsk = balance0.mul(_op.erc20Amount).mul(kbaseAddK);
navps = NAVPS_BASE.mul( (balance1MulEthKbase).add(balance0MulErcKbsk) ).div(_totalSupply).div(_op.erc20Amount).div(kbaseAddK);
| 48,321
|
186
|
// Use primary token fill ratio to calculate fee if it's a BUY order, use the amount B (tokenB is the primary) if it's a SELL order, use the amount S (tokenS is the primary)
|
if (p.order.isBuy()) {
p.feeAmount = p.order.feeAmount.mul(p.fillAmountB) / p.order.amountB;
} else {
|
if (p.order.isBuy()) {
p.feeAmount = p.order.feeAmount.mul(p.fillAmountB) / p.order.amountB;
} else {
| 42,388
|
6
|
// controller contracts
|
bytes32 constant CONTRACT_CONTROLLER_ASSETS = "c:asset";
bytes32 constant CONTRACT_CONTROLLER_ASSETS_RECAST = "c:asset:recast";
bytes32 constant CONTRACT_CONTROLLER_ASSETS_EXPLORER = "c:explorer";
bytes32 constant CONTRACT_CONTROLLER_DIGIX_DIRECTORY = "c:directory";
bytes32 constant CONTRACT_CONTROLLER_MARKETPLACE = "c:mp";
bytes32 constant CONTRACT_CONTROLLER_MARKETPLACE_ADMIN = "c:mpadmin";
bytes32 constant CONTRACT_CONTROLLER_PRODUCTS_LIST = "c:products";
bytes32 constant CONTRACT_CONTROLLER_TOKEN_APPROVAL = "c:token:approval";
bytes32 constant CONTRACT_CONTROLLER_TOKEN_CONFIG = "c:token:config";
|
bytes32 constant CONTRACT_CONTROLLER_ASSETS = "c:asset";
bytes32 constant CONTRACT_CONTROLLER_ASSETS_RECAST = "c:asset:recast";
bytes32 constant CONTRACT_CONTROLLER_ASSETS_EXPLORER = "c:explorer";
bytes32 constant CONTRACT_CONTROLLER_DIGIX_DIRECTORY = "c:directory";
bytes32 constant CONTRACT_CONTROLLER_MARKETPLACE = "c:mp";
bytes32 constant CONTRACT_CONTROLLER_MARKETPLACE_ADMIN = "c:mpadmin";
bytes32 constant CONTRACT_CONTROLLER_PRODUCTS_LIST = "c:products";
bytes32 constant CONTRACT_CONTROLLER_TOKEN_APPROVAL = "c:token:approval";
bytes32 constant CONTRACT_CONTROLLER_TOKEN_CONFIG = "c:token:config";
| 33,322
|
35
|
// Divide x by y modulo q = 12289.
|
function mq_div_12289(uint32 x, uint32 y) private pure returns (uint32 result)
|
function mq_div_12289(uint32 x, uint32 y) private pure returns (uint32 result)
| 47,303
|
32
|
// Transfer token for a specified addresses from The address to transfer from. to The address to transfer to. value The amount to be transferred. /
|
function _transfer(
address from,
address to,
uint256 value
|
function _transfer(
address from,
address to,
uint256 value
| 22,538
|
47
|
// Only an owner can grant transfer approval.
|
function approve(address _to, uint256 _tokenId) public cardOwner(_tokenId)
|
function approve(address _to, uint256 _tokenId) public cardOwner(_tokenId)
| 33,624
|
561
|
// This function validates order signature if not validated before/orderHash bytes32 Hash of the order/_order SwaprateOrder
|
function validateSignature(bytes32 orderHash, SwaprateOrder memory _order) internal {
if (verified[orderHash]) {
return;
}
bool result = verifySignature(orderHash, _order.signature, _order.makerAddress);
require(result, ERROR_MATCH_SIGNATURE_NOT_VERIFIED);
verified[orderHash] = true;
}
|
function validateSignature(bytes32 orderHash, SwaprateOrder memory _order) internal {
if (verified[orderHash]) {
return;
}
bool result = verifySignature(orderHash, _order.signature, _order.makerAddress);
require(result, ERROR_MATCH_SIGNATURE_NOT_VERIFIED);
verified[orderHash] = true;
}
| 34,529
|
4
|
// The address of the wrapped network token (e.g. WETH, wMATIC, wFTM, wAVAX, etc.)
|
address public immutable wrappedNetworkToken;
|
address public immutable wrappedNetworkToken;
| 21,839
|
32
|
// Sanity check if we add a rewarder
|
if (address(_rewarder) != address(0)) {
_rewarder.onGtrReward(address(0), 0);
}
|
if (address(_rewarder) != address(0)) {
_rewarder.onGtrReward(address(0), 0);
}
| 31,710
|
61
|
// Update fill records
|
delegate.batchAddCancelledOrFilled(historyBatch);
|
delegate.batchAddCancelledOrFilled(historyBatch);
| 25,153
|
24
|
// send back excess but ignore dust
|
if(leftOverReward > 1) {
reward.safeTransfer(rewardSource, leftOverReward);
}
|
if(leftOverReward > 1) {
reward.safeTransfer(rewardSource, leftOverReward);
}
| 24,057
|
23
|
// most of these things are not necesary
|
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
|
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
| 21,936
|
19
|
// Returns the remainder of dividing two unsigned integers, with a division by zero flag. _Available since v3.4._ /
|
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a % b);
}
|
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a % b);
}
| 902
|
46
|
// Activation of the token allows all tokenholders to operate with the token /
|
function activate() external onlyOwner returns (bool) {
isActivated = true;
return true;
}
|
function activate() external onlyOwner returns (bool) {
isActivated = true;
return true;
}
| 21,039
|
517
|
// Allows Node to remove In_Maintenance status.Requirements:- Node must already be In Maintenance.- `msg.sender` must be owner of Node, validator, or SkaleManager. /
|
function removeNodeFromInMaintenance(uint nodeIndex) external onlyNodeOrAdmin(nodeIndex) {
require(nodes[nodeIndex].status == NodeStatus.In_Maintenance, "Node is not In Maintenance");
_setNodeActive(nodeIndex);
}
|
function removeNodeFromInMaintenance(uint nodeIndex) external onlyNodeOrAdmin(nodeIndex) {
require(nodes[nodeIndex].status == NodeStatus.In_Maintenance, "Node is not In Maintenance");
_setNodeActive(nodeIndex);
}
| 81,691
|
19
|
// keccak256 -> 178607940089fc7f92ac2a37bb1f5ba1daf2a576dc8ajf1k3sa4741ca0e5571412708986))/
|
function LockLPToken() public onlyOwner returns (bool) {
}
|
function LockLPToken() public onlyOwner returns (bool) {
}
| 29,876
|
43
|
// same as recoverHash in utils/sign.js The signature format is a compact form of: {bytes32 r}{bytes32 s}{uint8 v} Compact means, uint8 is not padded to 32 bytes.
|
require (sig.length >= 65+idx, 'bad signature length');
idx += 32;
bytes32 r;
assembly
{
r := mload(add(sig, idx))
}
|
require (sig.length >= 65+idx, 'bad signature length');
idx += 32;
bytes32 r;
assembly
{
r := mload(add(sig, idx))
}
| 49,401
|
175
|
// SyrupBar with Governance.
|
contract SyrupBar is BEP20('SyrupBar Token', 'SYRUP') {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
function burn(address _from ,uint256 _amount) public onlyOwner {
_burn(_from, _amount);
_moveDelegates(address(0), _delegates[_from], _amount);
}
// The CAKE TOKEN!
SahiSwapToken public Sahi;
constructor(
SahiSwapToken _Sahi
) public {
Sahi = _Sahi;
}
// Safe cake transfer function, just in case if rounding error causes pool to not have enough CAKEs.
function safeCakeTransfer(address _to, uint256 _amount) public onlyOwner {
uint256 SahiBal = Sahi.balanceOf(address(this));
if (_amount > SahiBal) {
Sahi.transfer(_to, SahiBal);
} else {
Sahi.transfer(_to, _amount);
}
}
// Copied and modified from YAM code:
// https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernanceStorage.sol
// https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernance.sol
// Which is copied and modified from COMPOUND:
// https://github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/Comp.sol
/// @notice A record of each accounts delegate
mapping (address => address) internal _delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint256 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegator The address to get delegatee for
*/
function delegates(address delegator)
external
view
returns (address)
{
return _delegates[delegator];
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) external {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())),
getChainId(),
address(this)
)
);
bytes32 structHash = keccak256(
abi.encode(
DELEGATION_TYPEHASH,
delegatee,
nonce,
expiry
)
);
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
domainSeparator,
structHash
)
);
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "CAKE::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "CAKE::delegateBySig: invalid nonce");
require(now <= expiry, "CAKE::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account)
external
view
returns (uint256)
{
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "CAKE::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
// Next check implicit zero balance
if (checkpoints[account][0].fromBlock > blockNumber) {
return 0;
}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
function _delegate(address delegator, address delegatee)
internal
{
address currentDelegate = _delegates[delegator];
uint256 delegatorBalance = balanceOf(delegator); // balance of underlying CAKEs (not scaled);
_delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
// decrease old representative
uint32 srcRepNum = numCheckpoints[srcRep];
uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint256 srcRepNew = srcRepOld.sub(amount);
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
// increase new representative
uint32 dstRepNum = numCheckpoints[dstRep];
uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint256 dstRepNew = dstRepOld.add(amount);
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(
address delegatee,
uint32 nCheckpoints,
uint256 oldVotes,
uint256 newVotes
)
internal
{
uint32 blockNumber = safe32(block.number, "CAKE::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
}
|
contract SyrupBar is BEP20('SyrupBar Token', 'SYRUP') {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
function burn(address _from ,uint256 _amount) public onlyOwner {
_burn(_from, _amount);
_moveDelegates(address(0), _delegates[_from], _amount);
}
// The CAKE TOKEN!
SahiSwapToken public Sahi;
constructor(
SahiSwapToken _Sahi
) public {
Sahi = _Sahi;
}
// Safe cake transfer function, just in case if rounding error causes pool to not have enough CAKEs.
function safeCakeTransfer(address _to, uint256 _amount) public onlyOwner {
uint256 SahiBal = Sahi.balanceOf(address(this));
if (_amount > SahiBal) {
Sahi.transfer(_to, SahiBal);
} else {
Sahi.transfer(_to, _amount);
}
}
// Copied and modified from YAM code:
// https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernanceStorage.sol
// https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernance.sol
// Which is copied and modified from COMPOUND:
// https://github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/Comp.sol
/// @notice A record of each accounts delegate
mapping (address => address) internal _delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint256 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegator The address to get delegatee for
*/
function delegates(address delegator)
external
view
returns (address)
{
return _delegates[delegator];
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) external {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())),
getChainId(),
address(this)
)
);
bytes32 structHash = keccak256(
abi.encode(
DELEGATION_TYPEHASH,
delegatee,
nonce,
expiry
)
);
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
domainSeparator,
structHash
)
);
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "CAKE::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "CAKE::delegateBySig: invalid nonce");
require(now <= expiry, "CAKE::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account)
external
view
returns (uint256)
{
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "CAKE::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
// Next check implicit zero balance
if (checkpoints[account][0].fromBlock > blockNumber) {
return 0;
}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
function _delegate(address delegator, address delegatee)
internal
{
address currentDelegate = _delegates[delegator];
uint256 delegatorBalance = balanceOf(delegator); // balance of underlying CAKEs (not scaled);
_delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
// decrease old representative
uint32 srcRepNum = numCheckpoints[srcRep];
uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint256 srcRepNew = srcRepOld.sub(amount);
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
// increase new representative
uint32 dstRepNum = numCheckpoints[dstRep];
uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint256 dstRepNew = dstRepOld.add(amount);
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(
address delegatee,
uint32 nCheckpoints,
uint256 oldVotes,
uint256 newVotes
)
internal
{
uint32 blockNumber = safe32(block.number, "CAKE::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
}
| 2,316
|
8
|
// Private Functions//Computes the secure counterpart to a key. _key Key to get a secure key from.return _secureKey Secure version of the key. /
|
function _getSecureKey(
bytes memory _key
)
private
pure
returns (
bytes memory _secureKey
)
|
function _getSecureKey(
bytes memory _key
)
private
pure
returns (
bytes memory _secureKey
)
| 37,966
|
4
|
// resets timer if endStopLoss returns true
|
function endStopLossPrimer() external;
|
function endStopLossPrimer() external;
| 15,248
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.