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 |
|---|---|---|---|---|
532 | // Function which take ETH, add liquidity with provider and deposit given LP's _pid: pool ID where we want deposit _amountAMin: bounds the extent to which the B/A price can go up before the transaction reverts. _amountBMin: bounds the extent to which the A/B price can go up before the transaction reverts. _minAmountOut... | function speedStake(
uint256 _pid,
uint256 _amountAMin,
uint256 _amountBMin,
uint256 _minAmountOutA,
uint256 _minAmountOutB,
uint256 _deadline
| function speedStake(
uint256 _pid,
uint256 _amountAMin,
uint256 _amountBMin,
uint256 _minAmountOutA,
uint256 _minAmountOutB,
uint256 _deadline
| 43,709 |
4 | // Claim tokens | (bool success,) = address(claimContract).call(_data);
require(success, "Claim failed");
uint256 finalBalance = IERC20(_token).balanceOf(address(this));
require(finalBalance > initialBalance, "Claim did not yield any tokens");
| (bool success,) = address(claimContract).call(_data);
require(success, "Claim failed");
uint256 finalBalance = IERC20(_token).balanceOf(address(this));
require(finalBalance > initialBalance, "Claim did not yield any tokens");
| 27,993 |
11 | // Only allows the `owner` to execute the function. | modifier onlyOwner() {
require(msg.sender == owner, "Ownable: caller is not the owner");
_;
}
| modifier onlyOwner() {
require(msg.sender == owner, "Ownable: caller is not the owner");
_;
}
| 4,985 |
35 | // Triggered when tokens are transferred. MUST trigger when tokens are transferred, including zero value transfers. / | event Transfer(address indexed _from, address indexed _to, uint256 _value);
| event Transfer(address indexed _from, address indexed _to, uint256 _value);
| 6,613 |
24 | // Internal function to get the array of approved tokens from TrustStorage.return approvedTokens The array of approved tokens. / | function _getApprovedTokens() internal view returns (IERC20[] storage approvedTokens) {
approvedTokens = _trustStore().approvedTokens;
}
| function _getApprovedTokens() internal view returns (IERC20[] storage approvedTokens) {
approvedTokens = _trustStore().approvedTokens;
}
| 18,695 |
119 | // ============ Internal Functions ============ //Transfers tokens from an address (that has set allowance on the module). _tokenThe address of the ERC20 token_from The address to transfer from_to The address to transfer to_quantity The number of tokens to transfer / | function transferFrom(IERC20 _token, address _from, address _to, uint256 _quantity) internal {
ExplicitERC20.transferFrom(_token, _from, _to, _quantity);
}
| function transferFrom(IERC20 _token, address _from, address _to, uint256 _quantity) internal {
ExplicitERC20.transferFrom(_token, _from, _to, _quantity);
}
| 47,696 |
18 | // Give a ruling. UNTRUSTED._disputeID ID of the dispute to rule._ruling Ruling given by the arbitrator. Note that 0 means "Not able/wanting to make a decision". / | function _giveRuling(uint _disputeID, uint _ruling) internal {
DisputeStruct storage dispute = disputes[_disputeID];
require(_ruling <= dispute.choices, "Invalid ruling.");
require(dispute.status != DisputeStatus.Solved, "The dispute must not be solved already.");
dispute.ruling = _... | function _giveRuling(uint _disputeID, uint _ruling) internal {
DisputeStruct storage dispute = disputes[_disputeID];
require(_ruling <= dispute.choices, "Invalid ruling.");
require(dispute.status != DisputeStatus.Solved, "The dispute must not be solved already.");
dispute.ruling = _... | 23,646 |
3 | // Emitted when contract is upgraded by system administrator. newContract address of the new version of the contract. / | event ContractUpgrade(address newContract);
bool public paused = true;
bool public upgraded = false;
address public newContractAddress;
| event ContractUpgrade(address newContract);
bool public paused = true;
bool public upgraded = false;
address public newContractAddress;
| 11,298 |
4 | // ``` / | abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
| abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
| 33,638 |
9 | // Contract-level metadata for OpenSea. / Update for collection-specific metadata. | function contractURI() public pure returns (string memory) {
return
"ipfs://QmYjmj6AgVxGvWUck4ufmVCt8FSKPcyPRydAkqmZZA21T3/asteroids.json"; // Contract-level metadata
}
| function contractURI() public pure returns (string memory) {
return
"ipfs://QmYjmj6AgVxGvWUck4ufmVCt8FSKPcyPRydAkqmZZA21T3/asteroids.json"; // Contract-level metadata
}
| 50,355 |
3 | // Invalid redemption status / | error InvalidRedemptionStatus();
| error InvalidRedemptionStatus();
| 16,560 |
20 | // store the failed message into the nonblockingLzApp | _storeFailedMessage(srcChainId, srcAddress, nonce, payload, reason);
| _storeFailedMessage(srcChainId, srcAddress, nonce, payload, reason);
| 17,087 |
26 | // Return Oasis Address / | function getOasisAddr() internal pure returns (address) {
return 0x794e6e91555438aFc3ccF1c5076A74F42133d08D;
}
| function getOasisAddr() internal pure returns (address) {
return 0x794e6e91555438aFc3ccF1c5076A74F42133d08D;
}
| 33,647 |
329 | // Update endpoint mapping | serviceProviderEndpointToId[keccak256(bytes(_endpoint))] = newServiceProviderID;
| serviceProviderEndpointToId[keccak256(bytes(_endpoint))] = newServiceProviderID;
| 7,493 |
0 | // A mapping is a key-value store that lets us keep data in our contract. Here, the key is the token ID, and the value is the power level for that NFT. | mapping(uint256 => uint256) public powerLevel;
constructor(
string memory _name,
string memory _symbol,
address _royaltyRecipient,
uint128 _royaltyBps
| mapping(uint256 => uint256) public powerLevel;
constructor(
string memory _name,
string memory _symbol,
address _royaltyRecipient,
uint128 _royaltyBps
| 7,288 |
35 | // Checks if the given address is used for depositing ETH or not./Is used while depositing to send the correct ETH amount to the deposit contract.//Note that 0x0 is always registered for deposting ETH when the exchange is created!/This function allows additional addresses to be used for depositing ETH, the deposit/cont... | function isETH(address addr)
external
view
returns (bool);
| function isETH(address addr)
external
view
returns (bool);
| 43,958 |
0 | // KIP-17 Non-Fungible Token Standard, full implementation interface / | contract IKIP17Full is IKIP17, IKIP17Enumerable, IKIP17Metadata {
// solhint-disable-previous-line no-empty-blocks
}
| contract IKIP17Full is IKIP17, IKIP17Enumerable, IKIP17Metadata {
// solhint-disable-previous-line no-empty-blocks
}
| 15,494 |
34 | // Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist IMPORTANT: Any overrides to this function that add ownership of tokens not tracked by the | * core ERC721 logic MUST be matched with the use of {_increaseBalance} to keep balances
* consistent with ownership. The invariant to preserve is that for any address `a` the value returned by
* `balanceOf(a)` must be equal to the number of tokens such that `_ownerOf(tokenId)` is `a`.
*/
functio... | * core ERC721 logic MUST be matched with the use of {_increaseBalance} to keep balances
* consistent with ownership. The invariant to preserve is that for any address `a` the value returned by
* `balanceOf(a)` must be equal to the number of tokens such that `_ownerOf(tokenId)` is `a`.
*/
functio... | 373 |
11 | // Add mint receiverreceiver is account to receive mint rewarddeciPercents deci-percent (1000 = 100%) | function addMintReceiver(
address receiver,
uint16 deciPercents
| function addMintReceiver(
address receiver,
uint16 deciPercents
| 28,411 |
80 | // Get the data | IBasketManager basketManager = IBasketManager(
IMasset(_mAsset).getBasketManager()
);
Basket memory basket = basketManager.getBasket();
uint256 totalSupply = IMasset(_mAsset).totalSupply();
| IBasketManager basketManager = IBasketManager(
IMasset(_mAsset).getBasketManager()
);
Basket memory basket = basketManager.getBasket();
uint256 totalSupply = IMasset(_mAsset).totalSupply();
| 29,879 |
99 | // Collects tokens owed to a position/Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity./ Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or/ amount1Requested may be set to zero. To withdraw all tokens owed, calle... | function collect(
address recipient,
int24 tickLower,
int24 tickUpper,
uint128 amount0Requested,
uint128 amount1Requested
) external returns (uint128 amount0, uint128 amount1);
| function collect(
address recipient,
int24 tickLower,
int24 tickUpper,
uint128 amount0Requested,
uint128 amount1Requested
) external returns (uint128 amount0, uint128 amount1);
| 10,277 |
111 | // The MAR TOKEN! | MARToken public mar;
| MARToken public mar;
| 30,739 |
27 | // Fail if redeem not allowed // Verify market's block number equals current block number // Fail gracefully if protocol has insufficient cash // EFFECTS & INTERACTIONS (No safe failures beyond this point)/We invoke doTransferOut for the redeemer and the redeemAmount. Note: The cToken must handle variations between ERC... | doTransferOut(redeemer, redeemAmount);
| doTransferOut(redeemer, redeemAmount);
| 21,204 |
171 | // Check for profits and losses | uint256 total = estimatedTotalAssets();
| uint256 total = estimatedTotalAssets();
| 3,527 |
1 | // Request a random number._block Block linked to the request. / | function requestRN(uint _block) public payable {
contribute(_block);
}
| function requestRN(uint _block) public payable {
contribute(_block);
}
| 2,773 |
5 | // Assumes SpendAssetsHandleType.Transfer unless otherwise specified | function __getSpendAssetsHandleTypeForSelector(bytes4 _selector)
private
pure
returns (IIntegrationManager.SpendAssetsHandleType spendAssetsHandleType_)
| function __getSpendAssetsHandleTypeForSelector(bytes4 _selector)
private
pure
returns (IIntegrationManager.SpendAssetsHandleType spendAssetsHandleType_)
| 44,002 |
60 | // 创建待签名的交易/This function can only be called by owner/to 目标地址/value eth数量/data 调用目标方法的msg.data/ return txId 交易号 | function execute(address to, uint value, bytes memory data) external returns (uint txId);
| function execute(address to, uint value, bytes memory data) external returns (uint txId);
| 78,619 |
81 | // Cancel an operation. Requirements: - the caller must have the 'proposer' role. / | function cancel(bytes32 id) public virtual onlyRole(PROPOSER_ROLE) {
require(isOperationPending(id), "TimelockController: operation cannot be cancelled");
delete _timestamps[id];
emit Cancelled(id);
}
| function cancel(bytes32 id) public virtual onlyRole(PROPOSER_ROLE) {
require(isOperationPending(id), "TimelockController: operation cannot be cancelled");
delete _timestamps[id];
emit Cancelled(id);
}
| 35,102 |
32 | // Set the sales max purchase limit / | function setSalesMaxPurchase(uint256 maxPurchase) public onlyOwner {
SALES_MAX_PURCHASE = maxPurchase;
}
| function setSalesMaxPurchase(uint256 maxPurchase) public onlyOwner {
SALES_MAX_PURCHASE = maxPurchase;
}
| 53,904 |
84 | // This is an alternative to {approve} that can be used as a mitigation forproblems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. / | function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
| function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
| 772 |
9 | // function that checks whether the contract is paused | function onlyUnpaused() internal view {
require(!paused(), Errors.CP_PAUSED_CONTRACT);
}
| function onlyUnpaused() internal view {
require(!paused(), Errors.CP_PAUSED_CONTRACT);
}
| 6,651 |
16 | // Event to notify listeners about pause.unpauseReasonstring Reason the token was unpaused for./ | event Unpause(string unpauseReason);
bool public isPaused;
string public pauseNotice;
| event Unpause(string unpauseReason);
bool public isPaused;
string public pauseNotice;
| 9,284 |
35 | // ---------------------------/ ----- LongTerm Orders -----/ --------------------------- |
uint112 internal constant SELL_RATE_ADDITIONAL_PRECISION = 1000000;
uint256 internal constant Q112 = 2**112;
uint256 internal constant orderTimeInterval = 3600; // sync with FraxswapPair.sol
|
uint112 internal constant SELL_RATE_ADDITIONAL_PRECISION = 1000000;
uint256 internal constant Q112 = 2**112;
uint256 internal constant orderTimeInterval = 3600; // sync with FraxswapPair.sol
| 26,477 |
69 | // Fallback function must be declared as external. | fallback() external payable {
emit Log("receive", gasleft());
}
| fallback() external payable {
emit Log("receive", gasleft());
}
| 9,078 |
240 | // Calculates the largest possible `amount0` and `amount1` such that/ they're in the same proportion as total amounts, but not greater than/ `amount0Desired` and `amount1Desired` respectively. | function _calcSharesAndAmounts(uint256 amount0Desired, uint256 amount1Desired)
internal
view
returns (
uint256 shares,
uint256 amount0,
uint256 amount1
)
| function _calcSharesAndAmounts(uint256 amount0Desired, uint256 amount1Desired)
internal
view
returns (
uint256 shares,
uint256 amount0,
uint256 amount1
)
| 2,082 |
70 | // Decode multi-asset data from the format described in the AssetProxy contract specification./assetData AssetProxy-compliant data describing a multi-asset basket./ return The Multi-Asset AssetProxy identifier, an array of the amounts/ of the assets to be traded, and an array of the/ AssetProxy-compliant data describin... | function decodeMultiAssetData(bytes memory assetData)
public
pure
returns (
bytes4 assetProxyId,
uint256[] memory amounts,
bytes[] memory nestedAssetData
)
| function decodeMultiAssetData(bytes memory assetData)
public
pure
returns (
bytes4 assetProxyId,
uint256[] memory amounts,
bytes[] memory nestedAssetData
)
| 551 |
188 | // ===== ERC20Upgradeable Overrides =====/ | * @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balan... | * @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balan... | 57,683 |
166 | // Get the spread / | function getSpread(uint16 index)
private
pure
returns (string memory)
| function getSpread(uint16 index)
private
pure
returns (string memory)
| 63,099 |
0 | // CONSTANTS | mapping(address => bool) public isMaster;
| mapping(address => bool) public isMaster;
| 17,271 |
56 | // Internal function to burn a specific token. Reverts if the token does not exist.tokenId uint256 ID of the token being burned/ | function _burn(uint256 tokenId) internal {
_burn(ownerOf(tokenId), tokenId);
}
| function _burn(uint256 tokenId) internal {
_burn(ownerOf(tokenId), tokenId);
}
| 19,954 |
30 | // Unpause registry. Requirements:- The contract must not be unpaused.- The function must called by the owner. / | function unpauseRegistry() public onlyOwner {
_unpause();
emit PauseRegistry(msg.sender, false);
}
| function unpauseRegistry() public onlyOwner {
_unpause();
emit PauseRegistry(msg.sender, false);
}
| 22,443 |
26 | // Allows allowed third party to transfer tokens from one address to another. Returns success./from Address from where tokens are withdrawn./to Address to where tokens are sent./value Number of tokens to transfer. | function transferFrom(address from, address to, uint256 value)
returns (bool)
| function transferFrom(address from, address to, uint256 value)
returns (bool)
| 22,486 |
24 | // Basic ERC23 token, backward compatible with ERC20 transfer function.Based in part on code by open-zeppelin: https:github.com/OpenZeppelin/zeppelin-solidity.git | contract ERC23BasicToken {
using SafeMath for uint256;
uint256 public totalSupply;
mapping(address => uint256) balances;
event Transfer(address indexed from, address indexed to, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value, bytes data);
function tokenFa... | contract ERC23BasicToken {
using SafeMath for uint256;
uint256 public totalSupply;
mapping(address => uint256) balances;
event Transfer(address indexed from, address indexed to, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value, bytes data);
function tokenFa... | 22,145 |
135 | // Sets the buy tax, out of 100000. Only callable by owner. Max of 20000./amount the tax out of 100000. | function setBuyInfl(uint32 amount) external onlyOwner {
require(amount <= 20000, "SSH: Max 20%.");
buyInfl = amount;
}
| function setBuyInfl(uint32 amount) external onlyOwner {
require(amount <= 20000, "SSH: Max 20%.");
buyInfl = amount;
}
| 23,007 |
460 | // Transfer payout | if (payout > 0) {
IERC20(_derivatives[i].token).safeTransfer(_tokenOwner, payout);
}
| if (payout > 0) {
IERC20(_derivatives[i].token).safeTransfer(_tokenOwner, payout);
}
| 29,532 |
6 | // Sell some ETH and get refund | function ethToTokenSwapOutput(uint256 tokens_bought, uint256 deadline)
external
payable
returns (uint256);
function ethToTokenTransferOutput(
uint256 tokens_bought,
uint256 deadline,
address recipient
) external payable returns (uint256);
| function ethToTokenSwapOutput(uint256 tokens_bought, uint256 deadline)
external
payable
returns (uint256);
function ethToTokenTransferOutput(
uint256 tokens_bought,
uint256 deadline,
address recipient
) external payable returns (uint256);
| 28,450 |
91 | // Set a promo configuration/The Owner can change the promo pack contents/_newPromoPack Promo pack configuration/_numberOfPacks Max number of promo packs to be given before using the default config | function changePromoPack(Pack memory _newPromoPack, uint _numberOfPacks) public onlyOwner {
require(_newPromoPack.tokens.length == _newPromoPack.tokenAmounts.length, "Mismatch with Tokens & Amounts");
for (uint256 i = 0; i < _newPromoPack.tokens.length; i++) {
require(_newPromoPack.toke... | function changePromoPack(Pack memory _newPromoPack, uint _numberOfPacks) public onlyOwner {
require(_newPromoPack.tokens.length == _newPromoPack.tokenAmounts.length, "Mismatch with Tokens & Amounts");
for (uint256 i = 0; i < _newPromoPack.tokens.length; i++) {
require(_newPromoPack.toke... | 37,460 |
8 | // Mapping of YPool token to its max amount in a single swap | mapping (address => uint256) public maxYPoolTokenSwapAmount;
| mapping (address => uint256) public maxYPoolTokenSwapAmount;
| 35,451 |
18 | // ------------------------------------------------------------------------ Get the token balance for account tokenOwner ------------------------------------------------------------------------ | function balanceOf(address tokenOwner) public override view returns (uint balance) {
return balances[tokenOwner];
}
| function balanceOf(address tokenOwner) public override view returns (uint balance) {
return balances[tokenOwner];
}
| 1,485 |
290 | // Update leaderboard. | function updateLeaderboard(address _addressToUpdate)
whenNotPaused
private
returns (bool isChanged)
| function updateLeaderboard(address _addressToUpdate)
whenNotPaused
private
returns (bool isChanged)
| 36,357 |
20 | // View function to see pending Ayield on frontend. | function pendingAyield(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accAyieldPerShare = pool.accAyieldPerShare;
if (block.timestamp > pool.lastRewardTime && pool.lpSupply ... | function pendingAyield(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accAyieldPerShare = pool.accAyieldPerShare;
if (block.timestamp > pool.lastRewardTime && pool.lpSupply ... | 4,919 |
10 | // Initialize the money market controller_ The address of the Controller name_ Name of this MCD token symbol_ Symbol of this MCD token decimals_ Decimal precision of this token / | function initialize(KineControllerInterface controller_,
string memory name_,
string memory symbol_,
uint8 decimals_,
| function initialize(KineControllerInterface controller_,
string memory name_,
string memory symbol_,
uint8 decimals_,
| 7,971 |
205 | // Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,given current on-chain conditions. - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdrawcall in the same transaction. I.e. withdraw should return the same or... | function previewWithdraw(
| function previewWithdraw(
| 40,167 |
100 | // Transfer. | _balances[from] -= 1;
_balances[to] += 1;
_owners[id] = to;
emit Transfer(from, to, id);
_tokenApprovals[id] = address(0);
| _balances[from] -= 1;
_balances[to] += 1;
_owners[id] = to;
emit Transfer(from, to, id);
_tokenApprovals[id] = address(0);
| 62,855 |
235 | // 3pool | address public _curve = 0x094d12e5b541784701FD8d65F11fc0598FBC6332;
address public _mintr = 0xd061D61a4d941c39E5453435B6345Dc261C2fcE0;
address public constant usdn = 0x674C6Ad92Fd080e4004b2312b45f796a192D27a0;
constructor(
address _btf,
address _governance,
address _strategist... | address public _curve = 0x094d12e5b541784701FD8d65F11fc0598FBC6332;
address public _mintr = 0xd061D61a4d941c39E5453435B6345Dc261C2fcE0;
address public constant usdn = 0x674C6Ad92Fd080e4004b2312b45f796a192D27a0;
constructor(
address _btf,
address _governance,
address _strategist... | 13,861 |
0 | // Enum representing shipping status | enum Status {
Pending,
Shipped,
Accepted,
Rejected,
Canceled
}
| enum Status {
Pending,
Shipped,
Accepted,
Rejected,
Canceled
}
| 10,727 |
0 | // Base GSN recipient contract: includes the {IRelayRecipient} interfaceTIP: This contract is abstract. The functions {IRelayRecipient-acceptRelayedCall}, {_preRelayedCall}, and {_postRelayedCall} are not implemented and must beinformation on how to use the pre-built {GSNRecipientSignature} and{GSNRecipientERC20Fee}, o... | address private _relayHub = 0xD216153c06E857cD7f72665E0aF1d7D82172F494;
uint256 constant private _RELAYED_CALL_ACCEPTED = 0;
uint256 constant private _RELAYED_CALL_REJECTED = 11;
| address private _relayHub = 0xD216153c06E857cD7f72665E0aF1d7D82172F494;
uint256 constant private _RELAYED_CALL_ACCEPTED = 0;
uint256 constant private _RELAYED_CALL_REJECTED = 11;
| 20,267 |
414 | // // Triggered after a user claims rewards from the HeadlessStakingRewards. Usedto check for season finish. If it has not, then do not spend gas updating the other vars. _account Address of user that has burned / | function _claimRewardHook(address _account) internal override {
uint8 newMultiplier = questManager.checkForSeasonFinish(_account);
bool priceCoeffChanged = hasPriceCoeff
? _getPriceCoeff() != _userPriceCoeff[_account]
: false;
if (newMultiplier != _balances[_account].... | function _claimRewardHook(address _account) internal override {
uint8 newMultiplier = questManager.checkForSeasonFinish(_account);
bool priceCoeffChanged = hasPriceCoeff
? _getPriceCoeff() != _userPriceCoeff[_account]
: false;
if (newMultiplier != _balances[_account].... | 58,051 |
15 | // emergence stop | function halt() public onlyAdmin{
icoState = State.halted;
}
| function halt() public onlyAdmin{
icoState = State.halted;
}
| 5,150 |
42 | // Return the associated type information. memView The memory viewreturn_type - The type associated with the view / | function typeOf(bytes29 memView) internal pure returns (uint40 _type) {
assembly {
// solhint-disable-previous-line no-inline-assembly
// 216 == 256 - 40
_type := shr(216, memView) // shift out lower 24 bytes
}
}
| function typeOf(bytes29 memView) internal pure returns (uint40 _type) {
assembly {
// solhint-disable-previous-line no-inline-assembly
// 216 == 256 - 40
_type := shr(216, memView) // shift out lower 24 bytes
}
}
| 20,536 |
2 | // Perform tasks (clubbed all functions into one to reduce external calls & SAVE GAS FEE) | manager.performTasks();
| manager.performTasks();
| 15,116 |
113 | // Locked/Smart contract to enable locking and unlocking of token holders. | contract Locked is AccessControl {
mapping (address => bool) public lockedList;
event AddedLock(address user);
event RemovedLock(address user);
// Create a new role identifier for the controller role
bytes32 public constant CONTROLLER_ROLE = keccak256("CONTROLLER_ROLE");
bytes32 public consta... | contract Locked is AccessControl {
mapping (address => bool) public lockedList;
event AddedLock(address user);
event RemovedLock(address user);
// Create a new role identifier for the controller role
bytes32 public constant CONTROLLER_ROLE = keccak256("CONTROLLER_ROLE");
bytes32 public consta... | 15,146 |
16 | // get balance users uint256 tokenGatedBalance = getTokenGatedBalance( msg.sender, nft.tokenGated, nft.tokenGatedId ); require( mintedPerCollections[msg.sender][_nftId] + _amount > tokenGatedBalance, "Mint quantity exceed limit" ); | mintedPerCollections[msg.sender][_nftId] += _amount;
_mint(msg.sender, _nftId, _amount, "");
| mintedPerCollections[msg.sender][_nftId] += _amount;
_mint(msg.sender, _nftId, _amount, "");
| 4,233 |
110 | // take all we can | require(cToken.redeemUnderlying(liquidity) == 0, "ctoken: redeemUnderlying fail");
| require(cToken.redeemUnderlying(liquidity) == 0, "ctoken: redeemUnderlying fail");
| 34,044 |
44 | // Function modifier to require caller to be authorized / | modifier authorized() {
require(isAuthorized(msg.sender), "!AUTHORIZED"); _;
}
| modifier authorized() {
require(isAuthorized(msg.sender), "!AUTHORIZED"); _;
}
| 589 |
24 | // Update the free-memory pointer by padding our last write location to 32 bytes: add 31 bytes to the end of tempBytes to move to the next 32 byte block, then round down to the nearest multiple of 32. If the sum of the length of the two arrays is zero then add one before rounding down to leave a blank 32 bytes (the len... | mstore(0x40, and(
add(add(end, iszero(add(length, mload(_preBytes)))), 31),
not(31) // Round down to the nearest 32 bytes.
))
| mstore(0x40, and(
add(add(end, iszero(add(length, mload(_preBytes)))), 31),
not(31) // Round down to the nearest 32 bytes.
))
| 24,340 |
5 | // msg.sender is preserved in delegatecall.It was not available in callcode. | sender = msg.sender;
| sender = msg.sender;
| 47,558 |
77 | // 计算数量 | _transfer(this, msg.sender, amount);
| _transfer(this, msg.sender, amount);
| 8,683 |
69 | // https:en.wikipedia.org/wiki/Binary_search_algorithm | Snapshot[] storage snapshotsInfo = snapshots[_account];
uint256 index;
uint256 low = 0;
uint256 high = snapshotsInfo.length;
while (low < high) {
uint256 mid = (low + high) / 2;
if (snapshotsInfo[mid].beforeBlock > blockNum) {
high = mid;... | Snapshot[] storage snapshotsInfo = snapshots[_account];
uint256 index;
uint256 low = 0;
uint256 high = snapshotsInfo.length;
while (low < high) {
uint256 mid = (low + high) / 2;
if (snapshotsInfo[mid].beforeBlock > blockNum) {
high = mid;... | 18,659 |
1 | // CreatureCreature - a contract for my non-fungible creatures. / | contract suhmMAPToken is ERC721Tradable {
constructor(address _proxyRegistryAddress) ERC721Tradable("Suhm", "MAP", _proxyRegistryAddress){}
function baseTokenURI() override public pure returns (string memory) {
return "https://map.j-wave.co.jp/meta/json/suhm/1";
}
} | contract suhmMAPToken is ERC721Tradable {
constructor(address _proxyRegistryAddress) ERC721Tradable("Suhm", "MAP", _proxyRegistryAddress){}
function baseTokenURI() override public pure returns (string memory) {
return "https://map.j-wave.co.jp/meta/json/suhm/1";
}
} | 8,633 |
22 | // ERC-721 Non-Fungible Token Standard, optional enumeration extension/See https:github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md/Note: the ERC-165 identifier for this interface is 0x780e9d63 | interface IERC721Enumerable /* is IERC721Base */ {
/// @notice 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() external view returns (uint256);
... | interface IERC721Enumerable /* is IERC721Base */ {
/// @notice 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() external view returns (uint256);
... | 46,216 |
1 | // how much the vault is willing to lend | bool disableBorrow; // if the vehicle can continue to borrow assets
uint256 lendMaxBps; // the vault is willing to lend `min(lendRatioNum * totalBaseAsset, borrowCap)`
uint256 lendCap; // the maximum amount that the vault is willing to lend to the vehicle
| bool disableBorrow; // if the vehicle can continue to borrow assets
uint256 lendMaxBps; // the vault is willing to lend `min(lendRatioNum * totalBaseAsset, borrowCap)`
uint256 lendCap; // the maximum amount that the vault is willing to lend to the vehicle
| 10,415 |
396 | // Remove the accepted bid | delete _tokenBidders[tokenId][bidder];
emit BidShareUpdated(tokenId, bidShares);
emit BidFinalized(tokenId, bid);
| delete _tokenBidders[tokenId][bidder];
emit BidShareUpdated(tokenId, bidShares);
emit BidFinalized(tokenId, bid);
| 75,807 |
34 | // Verify if user is whitelisted |
function verifyUserWhitelisted(address _whitelistedAddress)
public
view
returns (bool)
|
function verifyUserWhitelisted(address _whitelistedAddress)
public
view
returns (bool)
| 24,181 |
49 | // overriden: if (!core.burn(addressArr, uintArr)) revertWithMutex(addressArr[0]); by- | if (!burn(addressArr, uintArr)) revertWithMutex(addressArr[0]);
| if (!burn(addressArr, uintArr)) revertWithMutex(addressArr[0]);
| 3,380 |
112 | // SWAP TO ETH | uint256 initialBalance = address(this).balance;
swapTokensForEth(contractTokenBalance);
| uint256 initialBalance = address(this).balance;
swapTokensForEth(contractTokenBalance);
| 45,138 |
1 | // The latest ETH/USD price set when the contract sends the caller a random number. | uint256 public valueAtLastUpdate;
| uint256 public valueAtLastUpdate;
| 11,676 |
142 | // Low level withdraw function | function _withdraw(uint256 _pid, uint256 _amount, address from, address to) internal {
PoolInfo storage pool = poolInfo[_pid];
require(pool.withdrawable, "Withdrawing from this pool is disabled");
UserInfo storage user = userInfo[_pid][from];
require(user.amount >= _amount, "withdraw... | function _withdraw(uint256 _pid, uint256 _amount, address from, address to) internal {
PoolInfo storage pool = poolInfo[_pid];
require(pool.withdrawable, "Withdrawing from this pool is disabled");
UserInfo storage user = userInfo[_pid][from];
require(user.amount >= _amount, "withdraw... | 9,441 |
1 | // lzReceive must be called by the endpoint for security | require(_msgSender() == address(lzEndpoint), "LzApp: invalid endpoint caller");
bytes memory trustedRemote = trustedRemoteLookup[_srcChainId];
| require(_msgSender() == address(lzEndpoint), "LzApp: invalid endpoint caller");
bytes memory trustedRemote = trustedRemoteLookup[_srcChainId];
| 4,339 |
58 | // Issue the synth (less fee) | syntharb().mint(msg.sender, _loanAmount);
| syntharb().mint(msg.sender, _loanAmount);
| 45,153 |
5 | // INIT //Inits the wallet/defines a initial cap table with specific equity per founder. Equity values 0 - 10000 representing 0-100% equity/cxo1 founder 1 /cxo2 founder 2/cxo3 founder 3/cdo1 founder 4/cdo2 founder 5/cdo3 founder 6 | constructor (address cxo1, address cxo2, address cxo3, address cdo1, address cdo2, address cdo3) {
_deployerAddress = msg.sender;
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
// Initial cap table
createInitialFounder(cxo1, 3000);
createInitialFounder(cxo2, 3000);
crea... | constructor (address cxo1, address cxo2, address cxo3, address cdo1, address cdo2, address cdo3) {
_deployerAddress = msg.sender;
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
// Initial cap table
createInitialFounder(cxo1, 3000);
createInitialFounder(cxo2, 3000);
crea... | 22,419 |
41 | // Swap and pop | slotOwners[idx] = slotOwners[slotOwners.length - 1];
slotOwners.pop();
| slotOwners[idx] = slotOwners[slotOwners.length - 1];
slotOwners.pop();
| 19,551 |
250 | // Internal - Removes a module attached to the SecurityToken by index/ | function _removeModuleWithIndex(uint8 _type, uint256 _index) internal {
uint256 length = modules[_type].length;
modules[_type][_index] = modules[_type][length - 1];
modules[_type].length = length - 1;
if ((length - 1) != _index) {
//Need to find index of _type in moduleT... | function _removeModuleWithIndex(uint8 _type, uint256 _index) internal {
uint256 length = modules[_type].length;
modules[_type][_index] = modules[_type][length - 1];
modules[_type].length = length - 1;
if ((length - 1) != _index) {
//Need to find index of _type in moduleT... | 44,810 |
158 | // Safe jgn transfer function, just in case if rounding error causes pool to not have enough jgns. | function safeJGNTransfer(address _to, uint256 _amount) internal {
uint256 jgnBal = jgn.balanceOf(address(this));
if (_amount > jgnBal) {
jgn.transfer(_to, jgnBal);
} else {
jgn.transfer(_to, _amount);
}
}
| function safeJGNTransfer(address _to, uint256 _amount) internal {
uint256 jgnBal = jgn.balanceOf(address(this));
if (_amount > jgnBal) {
jgn.transfer(_to, jgnBal);
} else {
jgn.transfer(_to, _amount);
}
}
| 17,584 |
114 | // Buy | uint256 DevTokens = amount.mul(_buyDevFee).div(100);
amount= amount.sub(DevTokens);
super._transfer(from, address(this), DevTokens);
super._transfer(from, to, amount);
| uint256 DevTokens = amount.mul(_buyDevFee).div(100);
amount= amount.sub(DevTokens);
super._transfer(from, address(this), DevTokens);
super._transfer(from, to, amount);
| 44,396 |
276 | // airdropped | bytes memory str = "to be airdropped to ";
for (uint i=0;i<str.length;i++) s[p++] = str[i];
slot = 9;
o = uint16(seq[sp++] % n1[slot]);
for (uint i=p1[slot][o];t1[slot][i] != '|';i++) s[p++] = t1[slot][i];
slot = 19;
o = uint16(seq[sp++] % n1[slot]);
for (uint i=p1[... | bytes memory str = "to be airdropped to ";
for (uint i=0;i<str.length;i++) s[p++] = str[i];
slot = 9;
o = uint16(seq[sp++] % n1[slot]);
for (uint i=p1[slot][o];t1[slot][i] != '|';i++) s[p++] = t1[slot][i];
slot = 19;
o = uint16(seq[sp++] % n1[slot]);
for (uint i=p1[... | 77,731 |
8 | // L2 Migration | function importVestingEntries(
address account,
uint256 escrowedAmount,
VestingEntries.VestingEntry[] calldata vestingEntries
) external;
| function importVestingEntries(
address account,
uint256 escrowedAmount,
VestingEntries.VestingEntry[] calldata vestingEntries
) external;
| 975 |
173 | // ITransmuterBuffer/Alchemix Finance | interface ITransmuterBuffer is IERC20TokenReceiver {
/// @notice Parameters used to define a given weighting schema.
///
/// Weighting schemas can be used to generally weight assets in relation to an action or actions that will be taken.
/// In the TransmuterBuffer, there are 2 actions that require weighting sc... | interface ITransmuterBuffer is IERC20TokenReceiver {
/// @notice Parameters used to define a given weighting schema.
///
/// Weighting schemas can be used to generally weight assets in relation to an action or actions that will be taken.
/// In the TransmuterBuffer, there are 2 actions that require weighting sc... | 30,238 |
12 | // Only a given role has access or admin/role role to check for alongside the admin role | modifier onlyRoleOrAdmin(bytes32 role) {
if (
!hasRole(DEFAULT_ADMIN_ROLE, _msgSender()) &&
!hasRole(role, _msgSender())
) {
revert Access_MissingRoleOrAdmin(role);
}
_;
}
| modifier onlyRoleOrAdmin(bytes32 role) {
if (
!hasRole(DEFAULT_ADMIN_ROLE, _msgSender()) &&
!hasRole(role, _msgSender())
) {
revert Access_MissingRoleOrAdmin(role);
}
_;
}
| 10,174 |
193 | // INTERNAL FUNCTIONS/ | function _setCreator(address _to, uint256 _id) internal creatorOnly(_id) {
_creators[_id] = _to;
}
| function _setCreator(address _to, uint256 _id) internal creatorOnly(_id) {
_creators[_id] = _to;
}
| 4,912 |
7 | // Borrowed from: https:github.com/1001-digital/erc721-extensions/blob/f5c983bac8989bc5ebf9b34c03f28e438da9a7b3/contracts/RandomlyAssigned.solL27 | return uint256(keccak256(
abi.encodePacked(
msg.sender,
block.coinbase,
block.difficulty,
block.gaslimit,
block.timestamp,
blockhash(block.number))));
| return uint256(keccak256(
abi.encodePacked(
msg.sender,
block.coinbase,
block.difficulty,
block.gaslimit,
block.timestamp,
blockhash(block.number))));
| 12,072 |
50 | // Exit Balancer pool | _exitBalancerPool(lpAmount_, minTokenAmountsBalancer_);
| _exitBalancerPool(lpAmount_, minTokenAmountsBalancer_);
| 24,834 |
41 | // Set Fee for Buys | if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_taxFee = _taxFeeOnBuy;
}
| if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_taxFee = _taxFeeOnBuy;
}
| 992 |
70 | // limit the maximum contribution for each wallet | uint256 public constant MAX_CONTRIBUTION = .1 ether;
| uint256 public constant MAX_CONTRIBUTION = .1 ether;
| 8,858 |
32 | // A structure representing a single bet. | struct Bet {
// Wager amount in wei.
uint amount;
// Modulo of a game.
uint8 modulo;
// Number of winning outcomes, used to compute winning payment (* modulo/rollUnder),
// and used instead of mask for games with modulo > MAX_MASK_MODULO.
uint8 rollUnder;
... | struct Bet {
// Wager amount in wei.
uint amount;
// Modulo of a game.
uint8 modulo;
// Number of winning outcomes, used to compute winning payment (* modulo/rollUnder),
// and used instead of mask for games with modulo > MAX_MASK_MODULO.
uint8 rollUnder;
... | 13,456 |
49 | // taker get tokens | tokenList[takerOrder.tokenBuy][takerOrder.user] = safeAdd(tokenList[takerOrder.tokenBuy][takerOrder.user], safeSub(takerBuy, takerFee));
| tokenList[takerOrder.tokenBuy][takerOrder.user] = safeAdd(tokenList[takerOrder.tokenBuy][takerOrder.user], safeSub(takerBuy, takerFee));
| 31,211 |
30 | // State management |
function getRegisState()
public
view
onlyRegulator
onlyActivatedMachineState
returns (uint256)
|
function getRegisState()
public
view
onlyRegulator
onlyActivatedMachineState
returns (uint256)
| 19,060 |
689 | // accessory functions to fetch data from the core contract / | {
return dataProvider.getReserveConfigurationData(_reserve);
}
| {
return dataProvider.getReserveConfigurationData(_reserve);
}
| 9,921 |
449 | // Returns the starting token ID.To change the starting token ID, please override this function. / | function _startTokenId() internal pure virtual returns (uint256) {
// It will become modifiable in the future versions
return 0;
}
| function _startTokenId() internal pure virtual returns (uint256) {
// It will become modifiable in the future versions
return 0;
}
| 18,536 |
34 | // Withdraws pETH/pIERC20 by providing a burn proof over at Incognito Chain This function takes a burn instruction on Incognito Chain, checksfor its validity and returns the token back to ETH chain This only works when the contract is not Paused inst: the decoded instruction as a list of bytes heights: the blocks conta... | function withdraw(
bytes memory inst,
uint heights,
bytes32[] memory instPaths,
bool[] memory instPathIsLefts,
bytes32 instRoots,
bytes32 blkData,
uint[] memory sigIdxs,
uint8[] memory sigVs,
bytes32[] memory sigRs,
| function withdraw(
bytes memory inst,
uint heights,
bytes32[] memory instPaths,
bool[] memory instPathIsLefts,
bytes32 instRoots,
bytes32 blkData,
uint[] memory sigIdxs,
uint8[] memory sigVs,
bytes32[] memory sigRs,
| 41,118 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.