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
4
// Withdraw ether from this contract (in case someone accidentally sends ETH to the contract) /
function withdraw() onlyOwner public payable { uint balance = address(this).balance; payable(msg.sender).transfer(balance); }
function withdraw() onlyOwner public payable { uint balance = address(this).balance; payable(msg.sender).transfer(balance); }
36,967
291
// Public sale minting
function mint(uint lootId) public payable nonReentrant { require(!privateSale, "Public sale minting not started"); require(saleIsActive, "Sale must be active to mint"); require(publicPrice <= msg.value, "Ether value sent is not correct"); require(lootId > 0 && lootId < 8001, "Token I...
function mint(uint lootId) public payable nonReentrant { require(!privateSale, "Public sale minting not started"); require(saleIsActive, "Sale must be active to mint"); require(publicPrice <= msg.value, "Ether value sent is not correct"); require(lootId > 0 && lootId < 8001, "Token I...
18,681
8
// 全局 Map 结构
mapping(address => bool) userList; mapping(address => bool) ownerList; mapping(address => uint) public userType; mapping(address => uint) public userAmount; mapping(address => uint) public userReferrer; uint256 public Type0; uint256 public Type1; uint256 public Type2;
mapping(address => bool) userList; mapping(address => bool) ownerList; mapping(address => uint) public userType; mapping(address => uint) public userAmount; mapping(address => uint) public userReferrer; uint256 public Type0; uint256 public Type1; uint256 public Type2;
24,115
1
// Performs a foreign function call via terminal, (stringInputs) => (result)
function ffi(string[] calldata) external returns (bytes memory);
function ffi(string[] calldata) external returns (bytes memory);
28,021
31
// Sets initial values /
constructor(address token, address priceFeed, address adminWallet)
constructor(address token, address priceFeed, address adminWallet)
39,237
53
// Info of Pool Stage.
struct PoolStage { uint256 amount; uint256 buyVoteWeight; uint256 buyAmount; uint256 sellVoteWeight; uint256 sellAmount; uint256 claimAmount; }
struct PoolStage { uint256 amount; uint256 buyVoteWeight; uint256 buyAmount; uint256 sellVoteWeight; uint256 sellAmount; uint256 claimAmount; }
32,832
93
// Initializes the contract in unpaused state. /
constructor() { _paused = false; }
constructor() { _paused = false; }
2,494
191
// require(fraktionalized==false); require(IERC721(contractAddress).ownerOf(index) == address(this));
IERC721(contractAddress).safeTransferFrom(address(this), msg.sender, index);
IERC721(contractAddress).safeTransferFrom(address(this), msg.sender, index);
66,828
33
// added override to 'IERC165' and 'interfaceId == type(IERC2981).interfaceId ||' to the return
function supportsInterface(bytes4 interfaceId) public view virtual override(AccessControlEnumerableUpgradeable, IERC165Upgradeable, IERC165) returns (bool)
function supportsInterface(bytes4 interfaceId) public view virtual override(AccessControlEnumerableUpgradeable, IERC165Upgradeable, IERC165) returns (bool)
27,907
90
// Both _hand and _draws store the first card in the rightmost position. _hand uses chunks of 6 bits. In the below example, hand is [9,18,35,12,32], and the cards 18 and 35 will be replaced. _hand:[9,18,35,12,32]encoding:XX 100000 001100 100011 010010 001001chunks: 32 12 35 189 order:card5, card4, card3, card2, card1 d...
function drawToHand(uint256 _hash, uint32 _hand, uint _draws) public pure returns (uint32)
function drawToHand(uint256 _hash, uint32 _hand, uint _draws) public pure returns (uint32)
57,050
120
// so the cast does not overflow
require(sum <= uint224(-1), 'FixedPoint::muluq: sum overflow'); return uq112x112(uint224(sum));
require(sum <= uint224(-1), 'FixedPoint::muluq: sum overflow'); return uq112x112(uint224(sum));
11,518
4
// The MVP Policy is a single step requiring a confirmation response /
function startAuthorization() external override { senderRequires(Role.ADMIN); validatePolicyInitialized(); uint64 pendingActionId = _actions.createPending(_policyId); validateActionId(pendingActionId); uint sentChallengeCount = 0; for(uint i=0; i < _approverAgentIds.length; i++){...
function startAuthorization() external override { senderRequires(Role.ADMIN); validatePolicyInitialized(); uint64 pendingActionId = _actions.createPending(_policyId); validateActionId(pendingActionId); uint sentChallengeCount = 0; for(uint i=0; i < _approverAgentIds.length; i++){...
44,957
13
// allow contract to recieve funds /
event Received(address, uint);
event Received(address, uint);
11,828
28
// Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. spender The address which will spend the funds. value The amount of tokens to be spent. /
function approve(address spender, uint256 value) public returns (bool) { _approve(msg.sender, spender, value); return true; }
function approve(address spender, uint256 value) public returns (bool) { _approve(msg.sender, spender, value); return true; }
1,576
16
// divide this number by 32 (to get from bit offsets to actual number)
uint playerNonceMod8 = betOffsetInSlot >> MULTIPLY_BY_32_BIT_SHIFT;
uint playerNonceMod8 = betOffsetInSlot >> MULTIPLY_BY_32_BIT_SHIFT;
2,157
18
// returns nonce /
function nonce() public view returns (uint256) { return nonce_; }
function nonce() public view returns (uint256) { return nonce_; }
49,440
50
// Test all token addresses at once
require( TokenRegistry(tokenRegistryAddress).areAllTokensRegistered(tokens) ); // "token not registered");
require( TokenRegistry(tokenRegistryAddress).areAllTokensRegistered(tokens) ); // "token not registered");
45,016
266
// Ensure payment token allowance to the TransferProxy Note that the paymentToken may also be used as a component to issue the Set So the paymentTokenQuantity must be used vs. the exchangeIssuanceParams sendToken quantity
ERC20Wrapper.ensureAllowance( _paymentTokenAddress, address(this), address(transferProxyInstance), _paymentTokenQuantity );
ERC20Wrapper.ensureAllowance( _paymentTokenAddress, address(this), address(transferProxyInstance), _paymentTokenQuantity );
19,845
43
// mint staking shares at current rate
uint256 mintedStakingShares = (totalStakingShares > 0) ? totalStakingShares.mul(amount).div(totalStaked()) : amount.mul(INITIAL_SHARES_PER_TOKEN); require(mintedStakingShares > 0, "Geyser: stake amount too small");
uint256 mintedStakingShares = (totalStakingShares > 0) ? totalStakingShares.mul(amount).div(totalStaked()) : amount.mul(INITIAL_SHARES_PER_TOKEN); require(mintedStakingShares > 0, "Geyser: stake amount too small");
46,779
12
// 轉帳
function transfer(address to, uint256 etherValue) public { uint256 weiValue = etherValue * 1 ether; require(balance[msg.sender] >= weiValue, "your balances are not enough"); balance[msg.sender] -= weiValue; balance[to] += weiValue; // emit TransferEvent emit Transf...
function transfer(address to, uint256 etherValue) public { uint256 weiValue = etherValue * 1 ether; require(balance[msg.sender] >= weiValue, "your balances are not enough"); balance[msg.sender] -= weiValue; balance[to] += weiValue; // emit TransferEvent emit Transf...
51,973
116
// Pause or unpause the contract /
function pause() external onlyOwner { paused = !paused; }
function pause() external onlyOwner { paused = !paused; }
23,883
121
// caller
function bond() external payable; function startUnbond() external; function cancelUnbond() external; function unbondAll() external; function unbond(uint256 _amount) external;
function bond() external payable; function startUnbond() external; function cancelUnbond() external; function unbondAll() external; function unbond(uint256 _amount) external;
56,996
57
// True if the proposal should be accepted.
bool suportProposal;
bool suportProposal;
52,130
95
// Returns true if a 'leaf' can be proved to be a part of a Merkle tree defined by 'root'. For this, a 'proof' must be provided, containing sibling hashes on the branch from the leaf to the root of the tree. Each pair of leaves and each pair of pre-images are assumed to be sorted./
function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf
function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf
4,622
163
// INTERNAL FUNCTIONS // Token Transfers // Transfer tokens from a specific partition. _fromPartition Partition of the tokens to transfer. _operator The address performing the transfer. _from Token holder. _to Token recipient. _value Number of tokens to transfer. _data Information attached to the transfer. Contains the...
function _transferByPartition( bytes32 _fromPartition, address _operator, address _from, address _to, uint256 _value, bytes memory _data, bytes memory _operatorData
function _transferByPartition( bytes32 _fromPartition, address _operator, address _from, address _to, uint256 _value, bytes memory _data, bytes memory _operatorData
27,279
27
// has to be reset even though we don't use it in the single hop case
amountInCached = DEFAULT_AMOUNT_IN_CACHED;
amountInCached = DEFAULT_AMOUNT_IN_CACHED;
31,458
1
// Indicator that this is an InterestRateModel contract (for inspection)
bool public constant isInterestRateModel = true;
bool public constant isInterestRateModel = true;
27,275
21
// Throws if called through proxy by any account other than contract itself or an upgradeability owner. /
modifier onlyRelevantSender() { (bool isProxy, bytes memory returnData) = address(this).call(abi.encodeWithSelector(UPGRADEABILITY_OWNER)); require( !isProxy || // covers usage without calling through storage proxy (returnData.length == 32 && msg.sender == abi.decode(retu...
modifier onlyRelevantSender() { (bool isProxy, bytes memory returnData) = address(this).call(abi.encodeWithSelector(UPGRADEABILITY_OWNER)); require( !isProxy || // covers usage without calling through storage proxy (returnData.length == 32 && msg.sender == abi.decode(retu...
39,037
72
// Optional token name
bytes32 public name = "";
bytes32 public name = "";
25,545
431
// Request a price from DVM. Liquidation is pending dispute until DVM returns a price.
disputedLiquidation.state = Status.PendingDispute; disputedLiquidation.disputer = msg.sender;
disputedLiquidation.state = Status.PendingDispute; disputedLiquidation.disputer = msg.sender;
30,881
103
// Set apwibt address _apwibt the address of the new apwibt used only for exceptional purpose /
function setAPWIBT(address _apwibt) external;
function setAPWIBT(address _apwibt) external;
23,646
39
// User Accounting
uint256 newUserSeconds = now .sub(totals.lastTimestampSec) .mul(totals.stakingShares); totals.stakingShareSeconds = totals.stakingShareSeconds .add(newUserSeconds); uint256 totalUserRewards = (globalSeconds > 0) ? Unlocked...
uint256 newUserSeconds = now .sub(totals.lastTimestampSec) .mul(totals.stakingShares); totals.stakingShareSeconds = totals.stakingShareSeconds .add(newUserSeconds); uint256 totalUserRewards = (globalSeconds > 0) ? Unlocked...
2,538
50
// perform a multi-path distributed swap
function multiPathSwap( SwapParams memory _swap, Token[] calldata _path, DistributionParams[] memory _distribution
function multiPathSwap( SwapParams memory _swap, Token[] calldata _path, DistributionParams[] memory _distribution
30,137
13
// Staking function which updates the user balances in the parent contract /
function stake(uint256 amount) public override { require(amount > 0, "Cannot stake 0"); updateReward(msg.sender); // Call the parent to adjust the balances. super.stake(amount); // Adjust the bonus effective stake according to the multiplier. uint256 boostedBalance ...
function stake(uint256 amount) public override { require(amount > 0, "Cannot stake 0"); updateReward(msg.sender); // Call the parent to adjust the balances. super.stake(amount); // Adjust the bonus effective stake according to the multiplier. uint256 boostedBalance ...
43,154
241
// The length of the time window where a rebase operation is allowed to execute, in seconds.
uint256 public rebaseWindowLengthSec;
uint256 public rebaseWindowLengthSec;
2,979
38
// Composite plus token. A composite plus token is backed by a basket of plus token. The composite plus token,along with its underlying tokens in the basket, should have the same peg. /
contract CompositePlus is ICompositePlus, Plus, ReentrancyGuardUpgradeable { using SafeERC20Upgradeable for IERC20Upgradeable; using SafeMathUpgradeable for uint256; event Minted(address indexed user, address[] tokens, uint256[] amounts, uint256 mintShare, uint256 mintAmount); event Redeemed(address in...
contract CompositePlus is ICompositePlus, Plus, ReentrancyGuardUpgradeable { using SafeERC20Upgradeable for IERC20Upgradeable; using SafeMathUpgradeable for uint256; event Minted(address indexed user, address[] tokens, uint256[] amounts, uint256 mintShare, uint256 mintAmount); event Redeemed(address in...
16,981
6
// length-prepend the relaySignal bytearray
signal = abi.encodePacked(uint16(message.relaySignal.length), message.relaySignal);
signal = abi.encodePacked(uint16(message.relaySignal.length), message.relaySignal);
23,547
58
// Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens. _beneficiary Address performing the token purchase _tokenAmount Number of tokens to be emitted /
function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal { token.transfer(_beneficiary, _tokenAmount); }
function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal { token.transfer(_beneficiary, _tokenAmount); }
11,045
283
// This limit is necessary for onchain randomness
uint256 public constant MAX_SUPPLY_LIMIT = 10**9;
uint256 public constant MAX_SUPPLY_LIMIT = 10**9;
19,186
1
// 核酸检测信息表, key : account, field : asset_value |身份证号(主键) | 姓名|检测结果| 检测时间| |-------------------- |-------------------|------------------- |-------------------| |id | name|result| date| |---------------------|-------------------|------------------- |-------------------| 创建表
tf.createTable("t_hospital", "id", "name,result,date");
tf.createTable("t_hospital", "id", "name,result,date");
46,184
164
// File: hasTransactionCap.sol
abstract contract hasTransactionCap is Ownable { mapping (uint256 => uint256) transactionCap; function getTransactionCapForToken(uint256 _id) public view returns(uint256) { return transactionCap[_id]; } function setTransactionCapForToken(uint256 _id, uint256 _transactionCap) public onlyOwner {...
abstract contract hasTransactionCap is Ownable { mapping (uint256 => uint256) transactionCap; function getTransactionCapForToken(uint256 _id) public view returns(uint256) { return transactionCap[_id]; } function setTransactionCapForToken(uint256 _id, uint256 _transactionCap) public onlyOwner {...
36,564
10
// See {IERC165-supportsInterface}.
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId || interfaceId == type(IERC20).interfaceId || interfaceId == type(IERC20Detailed).interfaceId || interfaceId == type(IE...
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId || interfaceId == type(IERC20).interfaceId || interfaceId == type(IERC20Detailed).interfaceId || interfaceId == type(IE...
54,526
17
// What is the balance of a particular account?
function balanceOf(address _owner) view public returns (uint256 balance) { return balances[_owner]; }
function balanceOf(address _owner) view public returns (uint256 balance) { return balances[_owner]; }
17,535
256
// Sets a new comptroller for the marketAdmin function to set a new comptroller return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/
function _setComptroller(ComptrollerInterface newComptroller) public returns (uint) { // Check caller is admin if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_COMPTROLLER_OWNER_CHECK); } ComptrollerInterface oldComptroller = comptroller; ...
function _setComptroller(ComptrollerInterface newComptroller) public returns (uint) { // Check caller is admin if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_COMPTROLLER_OWNER_CHECK); } ComptrollerInterface oldComptroller = comptroller; ...
21,016
130
// when sell
else if ( automatedMarketMakerPairs[to] && !_isExcludedMaxTransactionAmount[from] ) { require( amount <= maxTransactionAmount, 'Sell transfer amount exceeds the maxTransactionAmount.' ); } else if (!_isExcludedMaxTransactionAmount[t...
else if ( automatedMarketMakerPairs[to] && !_isExcludedMaxTransactionAmount[from] ) { require( amount <= maxTransactionAmount, 'Sell transfer amount exceeds the maxTransactionAmount.' ); } else if (!_isExcludedMaxTransactionAmount[t...
77,263
41
// Called inside `withdraw` method after updating internal balances/to the receiver of the staking tokens/amount amount to unstake
function _doWithdrawTransfer( address, address to, uint256 amount
function _doWithdrawTransfer( address, address to, uint256 amount
57,609
0
// The address interpreted as native token of the chain.
address public constant NATIVE_TOKEN = address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE);
address public constant NATIVE_TOKEN = address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE);
11,054
44
// Function that returns the (dynamic) pricing for buys, sells and fee
function pricing(uint scale) public view returns (uint buyPrice, uint sellPrice, uint fee) { uint buy_eth = scaleFactor * getPriceForBonds( scale, true) / ( scaleFactor - fluxFee(scaleFactor) ) ; uint sell_eth = getPriceForBonds(scale, false); sell_eth -= fluxFee(sell_eth); return ( buy_eth, ...
function pricing(uint scale) public view returns (uint buyPrice, uint sellPrice, uint fee) { uint buy_eth = scaleFactor * getPriceForBonds( scale, true) / ( scaleFactor - fluxFee(scaleFactor) ) ; uint sell_eth = getPriceForBonds(scale, false); sell_eth -= fluxFee(sell_eth); return ( buy_eth, ...
32,894
22
// include in acts
acts[i] = act;
acts[i] = act;
19,331
51
// MintableERC721 libraryImplements the base logic for MintableERC721 /
library MintableERC721Logic { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer( address indexed from, address indexed to, uint256 indexed tokenId ); /** * @dev Emitted when `owner` enables `approved` to manage the `toke...
library MintableERC721Logic { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer( address indexed from, address indexed to, uint256 indexed tokenId ); /** * @dev Emitted when `owner` enables `approved` to manage the `toke...
11,341
61
// Authorize a third party operator to manage (send) msg.sender's asset operator address to be approved authorized bool set to true to authorize, false to withdraw authorization /
function setApprovalForAll(address operator, bool authorized) public { if (authorized) { require(!isApprovedForAll(operator, msg.sender)); _addAuthorization(operator, msg.sender); } else { require(isApprovedForAll(operator, msg.sender)); _clearAuthorization(operator, msg.sender); }...
function setApprovalForAll(address operator, bool authorized) public { if (authorized) { require(!isApprovedForAll(operator, msg.sender)); _addAuthorization(operator, msg.sender); } else { require(isApprovedForAll(operator, msg.sender)); _clearAuthorization(operator, msg.sender); }...
53,815
56
// See {IERC721Metadata-tokenURI}. /
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
3,133
7
// This contract can accept ETH without calldata
receive() external payable {} // This contract can accept ETH with calldata // However, to support EIP 721 and EIP 1155, we need to respond to those methods with their own method signature fallback() external payable { bytes4 method = msg.sig; if ( method == 0x150b7a02 // bytes4(keccak256("onERC721Received(...
receive() external payable {} // This contract can accept ETH with calldata // However, to support EIP 721 and EIP 1155, we need to respond to those methods with their own method signature fallback() external payable { bytes4 method = msg.sig; if ( method == 0x150b7a02 // bytes4(keccak256("onERC721Received(...
27,180
40
// See {IERC721Enumerable-tokenByIndex}.return tokenId at index /
function tokenByIndex(uint256 index) public override view returns (uint256) { if(_exists(index)) { return index; } else {
function tokenByIndex(uint256 index) public override view returns (uint256) { if(_exists(index)) { return index; } else {
34,068
43
// This is to prevent the owner from front running its name curators signal by posting its own signal ahead, bringing the name curators in, and dumping on them
ICuration curation = curation(); require( !curation.isCurated(_subgraphDeploymentID), "GNS: Owner cannot point to a subgraphID that has been pre-curated" );
ICuration curation = curation(); require( !curation.isCurated(_subgraphDeploymentID), "GNS: Owner cannot point to a subgraphID that has been pre-curated" );
29,834
14
// Mapping from uid of an auction listing => current winning bid in an auction.
mapping(uint256 => Offer) public winningBid; /*/////////////////////////////////////////////////////////////// Modifiers
mapping(uint256 => Offer) public winningBid; /*/////////////////////////////////////////////////////////////// Modifiers
4,063
44
// Emit log events /
TokensSent(msg.sender, tokens); ContributionReceived(msg.sender, msg.value); Transfer(owner, msg.sender, tokens); return true;
TokensSent(msg.sender, tokens); ContributionReceived(msg.sender, msg.value); Transfer(owner, msg.sender, tokens); return true;
81,240
59
// This default function can receive Ether or perform queries to modules/using bound methods.
fallback() external payable
fallback() external payable
47,072
28
// Returns the amount of `debtShares` that will be burned by paying back`debt` amount.debt to checkRequirements:- Must not revert. /
function previewPayback(uint256 debt) external view returns (uint256 shares);
function previewPayback(uint256 debt) external view returns (uint256 shares);
11,887
33
// token balance before swap
uint balanceBefore = IERC20(toTokenContract).balanceOf(msg.sender);
uint balanceBefore = IERC20(toTokenContract).balanceOf(msg.sender);
13,078
6
// Check the first field is 0x20 (because we have only a single return value)
uint256 argptr; assembly { argptr := mload(add(output, 32)) }
uint256 argptr; assembly { argptr := mload(add(output, 32)) }
37,789
146
// calculate prize
prize=paid(assistant,helper,myid);
prize=paid(assistant,helper,myid);
46,401
57
// Deploy proxy for ConversionHandler contract
address proxyConversions = createProxyForCampaign("TOKEN_SELL","TwoKeyConversionHandler");
address proxyConversions = createProxyForCampaign("TOKEN_SELL","TwoKeyConversionHandler");
24,391
173
// Short string.
uint256 strLen = prefix - 0x80; require(_in.length > strLen, "Invalid RLP short string."); return (1, strLen, RLPItemType.DATA_ITEM);
uint256 strLen = prefix - 0x80; require(_in.length > strLen, "Invalid RLP short string."); return (1, strLen, RLPItemType.DATA_ITEM);
24,322
10
// Execute membership action to mint or burn shares or loot against whitelisted `minions` in consideration of `msg.sender` & given amounts./shaman Whitelisted contract to trigger action./loot Loot involved in external call./shares Shares involved in external call./mint Confirm whether action involves mint or burn actio...
function memberAction(address shaman, uint96 loot, uint96 shares, bool mint) external nonReentrant payable returns (uint96 lootOut, uint96 sharesOut) { require(shamans[shaman],'!shaman'); /*check `shaman` is approved*/ if (mint) { /*execute `mint` action*/ (lootOut, sharesOut) = IShaman(...
function memberAction(address shaman, uint96 loot, uint96 shares, bool mint) external nonReentrant payable returns (uint96 lootOut, uint96 sharesOut) { require(shamans[shaman],'!shaman'); /*check `shaman` is approved*/ if (mint) { /*execute `mint` action*/ (lootOut, sharesOut) = IShaman(...
9,331
19
// Sets a verified proxy address.Can be done through a multisig wallet in the future. _id Id of the proxy. _proxy Proxy address. /
function setProxy(
function setProxy(
47,350
22
// Returns the account approved for `tokenId` token. Requirements: - `tokenId` must exist. /
function getApproved(uint256 tokenId)
function getApproved(uint256 tokenId)
1,015
434
// Trigger the underlying Reward Control contract to accrue ALK supply rewards for the supplier on the specified market market The address of the market to accrue rewards supplier The address of the supplier to accrue rewards isVerified Verified / Public protocol /
function refreshAlkSupplyIndex( address market, address supplier, bool isVerified
function refreshAlkSupplyIndex( address market, address supplier, bool isVerified
12,300
0
// lib/dss-interfaces/src/dapp/DSPauseAbstract.sol/ pragma solidity >=0.5.12; / https:github.com/dapphub/ds-pause
interface DSPauseAbstract { function owner() external view returns (address); function authority() external view returns (address); function setOwner(address) external; function setAuthority(address) external; function setDelay(uint256) external; function plans(bytes32) external view returns (bo...
interface DSPauseAbstract { function owner() external view returns (address); function authority() external view returns (address); function setOwner(address) external; function setAuthority(address) external; function setDelay(uint256) external; function plans(bytes32) external view returns (bo...
1,552
32
// delivery service
payable(address(_customerAddress)).transfer(_dividends);
payable(address(_customerAddress)).transfer(_dividends);
19,231
1
// 260 ~= 1.1e18 so this is sufficient to store the full range of potential AUM fees.
uint256 private constant _AUM_FEE_PCT_WIDTH = 60;
uint256 private constant _AUM_FEE_PCT_WIDTH = 60;
22,088
3
// Whether this maker is allowed to create a new Issuance.Maker is allowed if maker white list is not enabled, or the maker is in the whitelist. /
function isMakerAllowed(address maker) public view returns (bool) { return !_makerWhitelistEnabled || _makerWhitelist[maker]; }
function isMakerAllowed(address maker) public view returns (bool) { return !_makerWhitelistEnabled || _makerWhitelist[maker]; }
7,930
27
// toggle alt token state on pool/only governance can call this/_pool pool address for alt token
function toggleActiveAlt(address _pool) external onlyGovernance returns (bool) { require(poolAltInfo[_pool].altToken != address(0), "TNE"); emit UpdateAltState( poolInfo[_pool].isAltActive, poolInfo[_pool].isAltActive = !poolInfo[_pool].isAltActive, _pool ...
function toggleActiveAlt(address _pool) external onlyGovernance returns (bool) { require(poolAltInfo[_pool].altToken != address(0), "TNE"); emit UpdateAltState( poolInfo[_pool].isAltActive, poolInfo[_pool].isAltActive = !poolInfo[_pool].isAltActive, _pool ...
53,850
15
// Change the Tokens contract address
function changeTokensAddress(address _newTokensAddress) external onlyOwner { tokens = ITokens(_newTokensAddress); }
function changeTokensAddress(address _newTokensAddress) external onlyOwner { tokens = ITokens(_newTokensAddress); }
17,201
17
// Gets the smallest part of the token that is not divisible.return the token granularity /
function granularity() external view override returns (uint256) { return tokenGranularity; }
function granularity() external view override returns (uint256) { return tokenGranularity; }
28,060
3
// If no xJollof exists, mint it 1:1 to the amount put in
if (totalShares == 0 || totalJollof == 0) { _mint(msg.sender, _amount); }
if (totalShares == 0 || totalJollof == 0) { _mint(msg.sender, _amount); }
47,525
21
// transfer old hero
(genes,,,,,,level,lockedTo,lockId) = heroesOld.getCharacter(_tokenId); heroesOld.unlock(_tokenId, lockId); heroesOld.lock(_tokenId, 0, 999); heroesOld.transferFrom(msg.sender, address(this), _tokenId);
(genes,,,,,,level,lockedTo,lockId) = heroesOld.getCharacter(_tokenId); heroesOld.unlock(_tokenId, lockId); heroesOld.lock(_tokenId, 0, 999); heroesOld.transferFrom(msg.sender, address(this), _tokenId);
3,702
48
// the given date must be aligned to 8am UTC and the correct offset, otherwise we will end up setting a price on a un-aligned date
require( date == get8amWeeklyOrDailyAligned(date), "date is not aligned" );
require( date == get8amWeeklyOrDailyAligned(date), "date is not aligned" );
32,515
221
// Allows owner to set Max mints per tx _newMaxMint maximum amount of tokens allowed to mint per tx. Must be >= 1 /
function setMaxMint(uint256 _newMaxMint) public onlyOwner { require(_newMaxMint >= 1, "Max mint must be at least 1"); maxBatchSize = _newMaxMint; }
function setMaxMint(uint256 _newMaxMint) public onlyOwner { require(_newMaxMint >= 1, "Max mint must be at least 1"); maxBatchSize = _newMaxMint; }
33,356
54
// 限制批次設置已使用票券票的數量,不能大於 maxMarkedTickets,以避免手續費過高。
require(_ticketIds.length <= maxMarkedTickets, "set too many tickets in the same time");
require(_ticketIds.length <= maxMarkedTickets, "set too many tickets in the same time");
30,273
175
// File: hasTransactionCap.sol
abstract contract hasTransactionCap is Teams { mapping (uint256 => uint256) transactionCap; function getTransactionCapForToken(uint256 _id) public view returns(uint256) { return transactionCap[_id]; } function setTransactionCapForToken(uint256 _id, uint256 _transactionCap) public onlyTeamOrOwn...
abstract contract hasTransactionCap is Teams { mapping (uint256 => uint256) transactionCap; function getTransactionCapForToken(uint256 _id) public view returns(uint256) { return transactionCap[_id]; } function setTransactionCapForToken(uint256 _id, uint256 _transactionCap) public onlyTeamOrOwn...
12,061
141
// register the supported interfaces to conform to ERC1363 via ERC165
_registerInterface(_INTERFACE_ID_ERC1363_TRANSFER); _registerInterface(_INTERFACE_ID_ERC1363_APPROVE);
_registerInterface(_INTERFACE_ID_ERC1363_TRANSFER); _registerInterface(_INTERFACE_ID_ERC1363_APPROVE);
6,436
95
// IRatesProvider IRatesProvider interfaceCyril Lapinte - <cyril.lapinte@openfiz.com> /
abstract contract IRatesProvider { function defineRatesExternal(uint256[] calldata _rates) virtual external returns (bool); function name() virtual public view returns (string memory); function rate(bytes32 _currency) virtual public view returns (uint256); function currencies() virtual public view retur...
abstract contract IRatesProvider { function defineRatesExternal(uint256[] calldata _rates) virtual external returns (bool); function name() virtual public view returns (string memory); function rate(bytes32 _currency) virtual public view returns (uint256); function currencies() virtual public view retur...
48,050
5
// check if the sender already has a username
require(balanceOf(msg.sender) == 0, "You have a username"); uint256 supply = totalSupply();
require(balanceOf(msg.sender) == 0, "You have a username"); uint256 supply = totalSupply();
10,087
16
// Returns the index of the next element to be enqueued.return Index for the next queue element. / slither-disable-next-line external-function
function getNextQueueIndex() public view returns (uint40) { return _nextQueueIndex; }
function getNextQueueIndex() public view returns (uint40) { return _nextQueueIndex; }
5,487
1
// Assign all tokens to the contract's creator.
constructor(address owner, string memory name, string memory symbol) { _name = name; _symbol = symbol; _mint(owner, totalSupply); }
constructor(address owner, string memory name, string memory symbol) { _name = name; _symbol = symbol; _mint(owner, totalSupply); }
2,844
0
// Initial distribution for the first 24h genesis pools
uint256 public constant INITIAL_GENESIS_POOL_DISTRIBUTION = 2400 ether;
uint256 public constant INITIAL_GENESIS_POOL_DISTRIBUTION = 2400 ether;
15,926
40
// withdraw foreign tokens /
function withdrawForeignTokens(address tokenContract) onlyAdmin public returns (bool) { ForeignToken token = ForeignToken(tokenContract); uint256 amount = token.balanceOf(address(this)); return token.transfer(admin, amount); }
function withdrawForeignTokens(address tokenContract) onlyAdmin public returns (bool) { ForeignToken token = ForeignToken(tokenContract); uint256 amount = token.balanceOf(address(this)); return token.transfer(admin, amount); }
12,674
28
// TRANSFER FUNCTIONS
function transfer(address to, uint256 value) public
function transfer(address to, uint256 value) public
4,599
4
// Sets the liquidation threshold of the reserve self The reserve configuration threshold The new liquidation threshold /
{ require(threshold <= MAX_VALID_LIQUIDATION_THRESHOLD, Errors.INVALID_LIQ_THRESHOLD); self.data = (self.data & LIQUIDATION_THRESHOLD_MASK) | (threshold << LIQUIDATION_THRESHOLD_START_BIT_POSITION); }
{ require(threshold <= MAX_VALID_LIQUIDATION_THRESHOLD, Errors.INVALID_LIQ_THRESHOLD); self.data = (self.data & LIQUIDATION_THRESHOLD_MASK) | (threshold << LIQUIDATION_THRESHOLD_START_BIT_POSITION); }
36,421
80
// Collection of functions related to array types. /
library Arrays { /** * @dev Searches a sorted `array` and returns the first index that contains * a value greater or equal to `element`. If no such index exists (i.e. all * values in the array are strictly less than `element`), the array length is * returned. Time complexity O(log n). * ...
library Arrays { /** * @dev Searches a sorted `array` and returns the first index that contains * a value greater or equal to `element`. If no such index exists (i.e. all * values in the array are strictly less than `element`), the array length is * returned. Time complexity O(log n). * ...
522
3
// when I want to modify or comment on my previous claim
bytes CLAIM_AMEND_REF = "amend ref";
bytes CLAIM_AMEND_REF = "amend ref";
48,454
50
// Adds list of addresses to whitelist. Not overloaded due to limitations with truffle testing. _beneficiaries Addresses to be added to the whitelist /
function addManyToWhitelist(address[] _beneficiaries) external onlyOwner { for (uint256 i = 0; i < _beneficiaries.length; i++) { whitelist[_beneficiaries[i]] = true; } }
function addManyToWhitelist(address[] _beneficiaries) external onlyOwner { for (uint256 i = 0; i < _beneficiaries.length; i++) { whitelist[_beneficiaries[i]] = true; } }
32,005
1
// propose fork_propNewTellorAddress address for new proposed Tellor/
function propFork(address _propNewTellorAddress) external { doTransfer(msg.sender,address(this), 10000e18);//This is the fork fee uint disputeId = disputesIds.length + 1; disputes[disputeId] = Dispute({ isPropFork: true, reportedMiner: msg.sender, reporti...
function propFork(address _propNewTellorAddress) external { doTransfer(msg.sender,address(this), 10000e18);//This is the fork fee uint disputeId = disputesIds.length + 1; disputes[disputeId] = Dispute({ isPropFork: true, reportedMiner: msg.sender, reporti...
24,445
17
// logforsale for car added
event ForSale(string message, uint _carId, address seller);
event ForSale(string message, uint _carId, address seller);
31,243
11
// This is a non-standard ERC-20
success := not(0) // set success to true
success := not(0) // set success to true
4,189
42
// Approve token transfer to cover all possible scenarios
_approve(address(this), address(uniswapV2Router), tokenAmount);
_approve(address(this), address(uniswapV2Router), tokenAmount);
1,693
0
// Verifies that the rebasing is not paused. /
modifier whenNotRebasePaused() { require(!rebasePaused, "Rebasing paused"); _; }
modifier whenNotRebasePaused() { require(!rebasePaused, "Rebasing paused"); _; }
5,008
213
// Opium.Registry contract keeps addresses of deployed Opium contracts set to allow them route and communicate to each other
contract Registry is RegistryErrors { // Address of Opium.TokenMinter contract address private minter; // Address of Opium.Core contract address private core; // Address of Opium.OracleAggregator contract address private oracleAggregator; // Address of Opium.SyntheticAggregator contract ...
contract Registry is RegistryErrors { // Address of Opium.TokenMinter contract address private minter; // Address of Opium.Core contract address private core; // Address of Opium.OracleAggregator contract address private oracleAggregator; // Address of Opium.SyntheticAggregator contract ...
32,175
3
// uint256s
uint256 MAX_SUPPLY = 10000; uint256 MINTS_PER_TIER = 2000; uint256 SEED_NONCE = 0;
uint256 MAX_SUPPLY = 10000; uint256 MINTS_PER_TIER = 2000; uint256 SEED_NONCE = 0;
52,538