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
104
// This is safe because a user won't ever have a balance larger than totalSupply!
unchecked { totalSupply -= value; }
unchecked { totalSupply -= value; }
13,568
80
// The address of the owner.
address addr;
address addr;
3,908
262
// Community Fund Address
address public comfundaddr;
address public comfundaddr;
50,639
389
// round 2
t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 5179144822360023508491245509308555580251733042407187134628755730783052214509) t0, t1, t2, t3, t4 := sbox_full(t0, t1, t2, t3, t4, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 5179144822360023508491245509308555580251733042407187134628755730783052214509) t0, t1, t2, t3, t4 := sbox_full(t0, t1, t2, t3, t4, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
36,839
63
// Adds an asset type to be supported by the provided principal / affiliate. Use `tokenId` 0 to denote all asset introducers. /
function addSupportedAssetTypeByTokenId(
function addSupportedAssetTypeByTokenId(
31,857
148
// GETTERS /
function _baseURI() internal view virtual override returns (string memory) { return BASE_URI; }
function _baseURI() internal view virtual override returns (string memory) { return BASE_URI; }
38,059
47
// Allocate initial balance to the owner
balances[msg.sender] = totalSupply;
balances[msg.sender] = totalSupply;
33,504
400
// Used by owner or other contracts
require(_msgSender() == owner || _msgSender() == address(this) || _msgSender() == _carAddress || _msgSender() == _auctionAddress, "Not allowed");
require(_msgSender() == owner || _msgSender() == address(this) || _msgSender() == _carAddress || _msgSender() == _auctionAddress, "Not allowed");
36,075
4
// can later be changed with {transferOwnership}./ Initializes the contract setting the deployer as the initial owner. /
constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); }
constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); }
418
33
// Check
uint amount = calculateWithdrawalAmount(this.balance);
uint amount = calculateWithdrawalAmount(this.balance);
45,862
3
// Vault allowance for each asset
mapping(address => mapping(address => uint256)) private _vaultAllowance; uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status;
mapping(address => mapping(address => uint256)) private _vaultAllowance; uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status;
8,577
5
// ERC721 interface compatible function for position token symbol retrieving/ return Returns symbol of token
function symbol() external view returns (string memory) { return "ONP"; }
function symbol() external view returns (string memory) { return "ONP"; }
38,968
16
// End Staking ====
function onERC721Received( address, address, uint256, bytes calldata
function onERC721Received( address, address, uint256, bytes calldata
32,093
16
// Relay function for creating a transaction Can only be called by relayer address _sender Address marking the transaction as paid _offerId Offer _tokenAmount Amount buyer is willing to trade _fiatAmount Indicates how much FIAT will the user pay for the tokenAmount _destination Address that will receive the crypto _con...
function createEscrow_relayed( address payable _sender, uint _offerId, uint _tokenAmount, uint _fiatAmount, address payable _destination, string calldata _contactData, string calldata _location, string calldata _username
function createEscrow_relayed( address payable _sender, uint _offerId, uint _tokenAmount, uint _fiatAmount, address payable _destination, string calldata _contactData, string calldata _location, string calldata _username
44,498
15
// the list of participants indexed by address
mapping (address => User) private users;
mapping (address => User) private users;
24,180
5
// Because of the previous require, we know that if msg.sender != sender then currentAllowance >= amount
_approve(sender, msg.sender, currentAllowance - amount);
_approve(sender, msg.sender, currentAllowance - amount);
4,283
33
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = _allowance.sub(_value); Transfer(_from, _to, _value); return true;
balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = _allowance.sub(_value); Transfer(_from, _to, _value); return true;
7,108
54
// Collect fees from the buckets since the last call and transfers the amount back./Called by: only FeesAndBootstrapRewards contract/The amount to collect may be queried before collect by calling getOutstandingFees/ return collectedFees the amount of fees collected and transferred
function collectFees() external returns (uint256 collectedFees) /* onlyRewardsContract */;
function collectFees() external returns (uint256 collectedFees) /* onlyRewardsContract */;
32,584
14
// Variable to hold the latest competition number.
uint public competitionNumber;
uint public competitionNumber;
49,129
19
// transfer the token from the smart contract back to the buyer
_transfer(address(this), msg.sender, tokenId);
_transfer(address(this), msg.sender, tokenId);
6,384
22
// In this event we are returning underlyiing() which can be used to compute the actual interest generated.
emit Rebased(_oldIndex, _newIndex, _underlying.div(WAD));
emit Rebased(_oldIndex, _newIndex, _underlying.div(WAD));
8,707
299
// allow apm to create permissions for Repos in Kernel
bytes32 permRole = acl.CREATE_PERMISSIONS_ROLE(); acl.grantPermission(apm, acl, permRole);
bytes32 permRole = acl.CREATE_PERMISSIONS_ROLE(); acl.grantPermission(apm, acl, permRole);
27,667
8
// Registrer Agency
function registrerAgency( address payable agencyWallet, string memory agencyName ) onlyAirCompany inState(FlightState.Open)
function registrerAgency( address payable agencyWallet, string memory agencyName ) onlyAirCompany inState(FlightState.Open)
42,286
148
// Admin: remove multiple items from list
function removeMulti(address[] calldata addrs) external override onlyListAdmin returns (uint256) { uint256 updated = 0; for (uint256 i = 0; i < addrs.length; i++) { if (_remove(addrs[i])) updated++; } return updated; }
function removeMulti(address[] calldata addrs) external override onlyListAdmin returns (uint256) { uint256 updated = 0; for (uint256 i = 0; i < addrs.length; i++) { if (_remove(addrs[i])) updated++; } return updated; }
30,133
1,255
// When the notional is negative, cash balance will be transferred to the liquidator instead of being provided by the liquidator.
fCashLiquidationValueUnderlying = fCashLiquidationValueUnderlying.neg();
fCashLiquidationValueUnderlying = fCashLiquidationValueUnderlying.neg();
61,930
64
// Make sure no dups
require( !isOperator[_newOperator], "New operator exists." );
require( !isOperator[_newOperator], "New operator exists." );
75,860
51
// redistribution to holders
uint256 _redistributionAmountAdjusted = _redistributionAmount.mul(currentRate); _redistributionTotal = _redistributionTotal.add(_redistributionAmountAdjusted); _rredistributionTotal = _rredistributionTotal.add(_redistributionAmount); _supplyRemaining = _supplyRemaining.sub(_redistributio...
uint256 _redistributionAmountAdjusted = _redistributionAmount.mul(currentRate); _redistributionTotal = _redistributionTotal.add(_redistributionAmountAdjusted); _rredistributionTotal = _rredistributionTotal.add(_redistributionAmount); _supplyRemaining = _supplyRemaining.sub(_redistributio...
35,868
134
// Calls the transfer of ERC20. /
_transfer(msg.sender, _to, _value);
_transfer(msg.sender, _to, _value);
16,642
19
// if `ownership.addr != address(0)`. The `addr` already has it's upper 96 bits clearned, since it is written to memory with regular Solidity.
if mload(ownership) { currOwnershipAddr := mload(ownership) }
if mload(ownership) { currOwnershipAddr := mload(ownership) }
12,970
155
// Compound reward from specified pool
function compound(uint256 _pid) public Frillish validatePool(_pid) { PoolInfo storage pool = poolInfo[_pid]; PoolInfo storage pool0x = poolInfo[0]; UserInfo storage user = userInfo[_pid][msg.sender]; UserInfo storage user0x = userInfo[0][msg.sender]; uint256 userAmount; ...
function compound(uint256 _pid) public Frillish validatePool(_pid) { PoolInfo storage pool = poolInfo[_pid]; PoolInfo storage pool0x = poolInfo[0]; UserInfo storage user = userInfo[_pid][msg.sender]; UserInfo storage user0x = userInfo[0][msg.sender]; uint256 userAmount; ...
25,845
61
// Calculate placement ID to validate arguments.
bytes32 placementId = calculatePlacementId(msg.sender, _idv, _scopeRequestIds);
bytes32 placementId = calculatePlacementId(msg.sender, _idv, _scopeRequestIds);
15,643
0
// Optional metadata extension for ERC-721 non-fungible token standard. /
interface ERC721Metadata { /** * @dev Returns a descriptive name for a collection of NFTs in this contract. */ function name() external view returns (string _name); /** * @dev Returns a abbreviated name for a collection of NFTs in this contract. */ function symbol() external vi...
interface ERC721Metadata { /** * @dev Returns a descriptive name for a collection of NFTs in this contract. */ function name() external view returns (string _name); /** * @dev Returns a abbreviated name for a collection of NFTs in this contract. */ function symbol() external vi...
12,892
217
// Hash an order, returning the hash that a client must sign, including the standard message prefixreturn Hash of message prefix and order hash per Ethereum format /
function _hashToCheckForSale( address owner, uint256 version, uint256 nonce, uint256 tokenId, uint256[4] memory pricesAndTimestamps
function _hashToCheckForSale( address owner, uint256 version, uint256 nonce, uint256 tokenId, uint256[4] memory pricesAndTimestamps
41,808
0
// The address that receives all platform fees from all sales.
address platformFeeRecipient;
address platformFeeRecipient;
6,190
31
// --- Events
event BucketCreated(bytes32 id, uint256 initialValue, uint64 closingTime); event BucketBuy(bytes32 id, uint256 etherSpent, address token, uint256 tokensBought); event BucketSell(bytes32 id, uint256 etherBought, address token, uint256 tokensSold); event BucketDestroyed(bytes32 id, uint256 finalValue);
event BucketCreated(bytes32 id, uint256 initialValue, uint64 closingTime); event BucketBuy(bytes32 id, uint256 etherSpent, address token, uint256 tokensBought); event BucketSell(bytes32 id, uint256 etherBought, address token, uint256 tokensSold); event BucketDestroyed(bytes32 id, uint256 finalValue);
46,522
0
// 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f
constructor(address factory_) public { factory = factory_; }
constructor(address factory_) public { factory = factory_; }
20,174
4
// State
uint256 _balance = _state._getBalance(msg.sender); bytes32 _hash = _state._getHash(msg.sender);
uint256 _balance = _state._getBalance(msg.sender); bytes32 _hash = _state._getHash(msg.sender);
32,177
231
// unix timestamp of last update request,/ don't allow requesting more than once per update interval
uint public m_ETHPriceLastUpdateRequest;
uint public m_ETHPriceLastUpdateRequest;
16,184
4
// Transfers control of the contract to a newOwner. _newOwner The address to transfer ownership to. /
function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; }
function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; }
337
103
// 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/blo...
mapping (address => address) internal _delegates;
mapping (address => address) internal _delegates;
39,634
351
// Claim asset, transfer the given amount assets to receiver
function claim(address receiver, uint amount) external returns (uint);
function claim(address receiver, uint amount) external returns (uint);
48,600
27
// Similar to EIP20 transfer, except it handles a False success from `transfer` and returns an explanatory error code rather than reverting. If caller has not called checked protocol's balance, this may revert due to insufficient cash held in this contract. If caller has checked protocol's balance prior to this call, a...
function doTransferOut(address payable to, uint amount) internal override { EIP20NonStandardInterface token = EIP20NonStandardInterface(underlying); token.transfer(to, amount); bool success; assembly { switch returndatasize() case 0 { ...
function doTransferOut(address payable to, uint amount) internal override { EIP20NonStandardInterface token = EIP20NonStandardInterface(underlying); token.transfer(to, amount); bool success; assembly { switch returndatasize() case 0 { ...
7,727
71
// Emits a {Transfer} event with `to` set to the zero address. Requirements - `account` cannot be the zero address.- `account` must have at least `amount` tokens. /
function _burn(address account, uint256 amount) internal { require(account != address(0), "ERC20: burn from the zero address"); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount...
function _burn(address account, uint256 amount) internal { require(account != address(0), "ERC20: burn from the zero address"); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount...
10,254
116
// distribute new rewards to current shares evenly
rewardsPerShareStored = rewardsPerShareStored.add(newRewardAmount.mul(1e18).div(totalSupply())); emit Harvest(msg.sender, keeperFee, newRewardAmount);
rewardsPerShareStored = rewardsPerShareStored.add(newRewardAmount.mul(1e18).div(totalSupply())); emit Harvest(msg.sender, keeperFee, newRewardAmount);
48,950
14
// SafeMath Unsigned math operations with safety checks that revert on error /
library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. /...
library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. /...
8,011
8
// A minimal proportional exit, suitable as is for most pools: though not for pools with preminted BPTor other special considerations. Designed to be overridden if a pool needs to do extra processing,such as scaling a stored invariant, or caching the new total supply. No complex code or external calls should be made in...
function _doRecoveryModeExit( uint256[] memory balances, uint256 totalSupply, bytes memory userData
function _doRecoveryModeExit( uint256[] memory balances, uint256 totalSupply, bytes memory userData
21,439
59
// Increase ETH required for next buy by 20%
tadpoleReq = (tadpoleReq.mul(6)).div(5);
tadpoleReq = (tadpoleReq.mul(6)).div(5);
71,735
167
// Token symbol
string private _symbol;
string private _symbol;
11,148
29
// Returns current game players. /
function getPlayedGamePlayers() public view returns (uint) { return getPlayersInGame(game); }
function getPlayedGamePlayers() public view returns (uint) { return getPlayersInGame(game); }
37,353
3
// Retrieve the contract address of the proxy admin that manages the locksreturn _proxyAdminAddress the address of the ProxyAdmin instance /
function proxyAdminAddress() external view returns (address _proxyAdminAddress);
function proxyAdminAddress() external view returns (address _proxyAdminAddress);
648
4
// Contract initialize. name_ Name of the token. symbol_ Symbol of the token governor_ Address of the governor guardian_ Address of the guardian minter_ Address of the minter /
constructor( string memory name_, string memory symbol_, address governor_, address guardian_, address minter_
constructor( string memory name_, string memory symbol_, address governor_, address guardian_, address minter_
21,542
35
// Forwards funds to the tokensale wallet/
function forwardFunds() internal { ledMultiSig.transfer(msg.value); }
function forwardFunds() internal { ledMultiSig.transfer(msg.value); }
68,718
9
// Burns a specific ERC721 token, and removes the data from our mappings tokenId uint256 id of the ERC721 token to be burned. /
function burn(uint256 tokenId) external virtual override whenNotPaused { TokenInfo memory token = _getTokenInfo(tokenId); bool canBurn = _isApprovedOrOwner(_msgSender(), tokenId); bool fromTokenPool = _validPool(_msgSender()) && token.pool == _msgSender(); address owner = ownerOf(tokenId); require...
function burn(uint256 tokenId) external virtual override whenNotPaused { TokenInfo memory token = _getTokenInfo(tokenId); bool canBurn = _isApprovedOrOwner(_msgSender(), tokenId); bool fromTokenPool = _validPool(_msgSender()) && token.pool == _msgSender(); address owner = ownerOf(tokenId); require...
41,674
10
// Test that an entity owner can deactivate it Check that the entity is no longer active /
function testDeactivateEntity() public { address newVirtualEntityAddress = newConnections.createVirtualEntity(); uint256 numberVirtualEntitiesCreated = newConnections.virtualEntitiesCreated(); // Check for the existence of the new entity bool active; (active,) = newConnections.getEntity(newVirtua...
function testDeactivateEntity() public { address newVirtualEntityAddress = newConnections.createVirtualEntity(); uint256 numberVirtualEntitiesCreated = newConnections.virtualEntitiesCreated(); // Check for the existence of the new entity bool active; (active,) = newConnections.getEntity(newVirtua...
41,182
12
// Interface corresponding to the updated KromaMintableERC20 (this contract).
bytes4 iface2 = type(IKromaMintableERC20).interfaceId; return _interfaceId == iface1 || _interfaceId == iface2;
bytes4 iface2 = type(IKromaMintableERC20).interfaceId; return _interfaceId == iface1 || _interfaceId == iface2;
43,881
31
// Remove tranfer functionality for hodler token
function _approve(address owner, address spender, uint value) private { allowance[owner][spender] = value; emit Approval(owner, spender, value); }
function _approve(address owner, address spender, uint value) private { allowance[owner][spender] = value; emit Approval(owner, spender, value); }
4,670
48
// Admin Functions //Allows the `pendingOwner` to take ownership of the contract.
function acceptOwnership() external;
function acceptOwnership() external;
3,659
125
// returns protocol module address given a function signature/ return module address
function getTarget(string calldata sig) external view returns (address);
function getTarget(string calldata sig) external view returns (address);
3,785
88
// we only revert the underbid if the seller specifies a differentwhitelisted buyer to the highest bider
_resetBids(_nftContractAddress, _tokenId); _payout( _nftContractAddress, _tokenId, nftHighestBidder, nftHighestBid );
_resetBids(_nftContractAddress, _tokenId); _payout( _nftContractAddress, _tokenId, nftHighestBidder, nftHighestBid );
23,665
199
// TIERS[6] = [2000, 2000, 2000, 2000, 2000];TIERS[7] = [20, 70, 721, 1000, 1155, 1200, 1300, 1434, 1541, 1559];
20,576
121
// airdrop limits
if(airDropLimitInEffect){ // Check if Limit is in effect if(airDropLimitLiftDate <= block.timestamp){ airDropLimitInEffect = false; // set the limit to false if the limit date has been exceeded } else {
if(airDropLimitInEffect){ // Check if Limit is in effect if(airDropLimitLiftDate <= block.timestamp){ airDropLimitInEffect = false; // set the limit to false if the limit date has been exceeded } else {
7,843
38
// transfer ether from this smart contract to recipient
function _withdrawFromvault(bytes32 _hash) internal returns (bool) { address to = keepers[_hash].recipient; address payable recipient = payable(to); address from = keepers[_hash].sender; uint256 value = keepers[_hash].value; // delete the record from valut - prevent double w...
function _withdrawFromvault(bytes32 _hash) internal returns (bool) { address to = keepers[_hash].recipient; address payable recipient = payable(to); address from = keepers[_hash].sender; uint256 value = keepers[_hash].value; // delete the record from valut - prevent double w...
3,022
22
// Atonomi Network Settings/This contract controls all owner configurable variables in the network
contract NetworkSettings is Ownable { /// @title Registration Fee /// @notice Manufacturer pays token to register a device /// @notice Manufacturer will recieve a share in any reputation updates for a device uint256 public registrationFee; /// @title Activiation Fee /// @notice Manufacturer or ...
contract NetworkSettings is Ownable { /// @title Registration Fee /// @notice Manufacturer pays token to register a device /// @notice Manufacturer will recieve a share in any reputation updates for a device uint256 public registrationFee; /// @title Activiation Fee /// @notice Manufacturer or ...
46,951
24
// Computes `a - b`, setting the value to 0 if b > a.
function floorsub(uint a, uint b) internal pure returns (uint) { return b >= a ? 0 : a - b; }
function floorsub(uint a, uint b) internal pure returns (uint) { return b >= a ? 0 : a - b; }
8,374
2
// solhint-disable func-name-mixedcase /
abstract contract ERC20Proxy is ImmutableOwner { using SafeERC20 for IERC20; constructor() { require(ERC20Proxy.func_50BkM4K.selector == bytes4(uint32(IERC20.transferFrom.selector) + 1), "ERC20Proxy: bad selector"); } // keccak256("func_50BkM4K(address,address,uint256,address)") = 0x23b872de ...
abstract contract ERC20Proxy is ImmutableOwner { using SafeERC20 for IERC20; constructor() { require(ERC20Proxy.func_50BkM4K.selector == bytes4(uint32(IERC20.transferFrom.selector) + 1), "ERC20Proxy: bad selector"); } // keccak256("func_50BkM4K(address,address,uint256,address)") = 0x23b872de ...
31,925
45
// функция вывода средств(вызывается при отправке 0 eth)
function withdraw() internal returns(string memory){ User storage user = users[msg.sender]; uint256 payout = user.deposit.div(5); uint256 period = (block.timestamp.sub(user.time)).div(1 minutes); // при работе режима мультипликатора функция не позволяет вывести средства if(ga...
function withdraw() internal returns(string memory){ User storage user = users[msg.sender]; uint256 payout = user.deposit.div(5); uint256 period = (block.timestamp.sub(user.time)).div(1 minutes); // при работе режима мультипликатора функция не позволяет вывести средства if(ga...
16,359
5
// Unregisters all brokers for msg.sender
function unregisterAllBrokers( ) external;
function unregisterAllBrokers( ) external;
42,317
352
// Transfer _amount of _protocolToken (eg. cDAI) to _wrapperAddr
address _wrapperAddr = protocolWrappers[_token]; _transferTokens(_token, _wrapperAddr, _amount); tokens = ILendingProtocol(_wrapperAddr).redeem(address(this));
address _wrapperAddr = protocolWrappers[_token]; _transferTokens(_token, _wrapperAddr, _amount); tokens = ILendingProtocol(_wrapperAddr).redeem(address(this));
39,832
75
// Mapping from partition to controllers for the partition. [NOT TOKEN-HOLDER-SPECIFIC]
mapping (bytes32 => address[]) internal _controllersByPartition;
mapping (bytes32 => address[]) internal _controllersByPartition;
2,166
2
// The maximum number of tokens of tokens to sell + 1 multiplied/ by 2. We could compute it on the fly each time but this saves gas./Represented as a 36 decimal fixed point number.
int256 internal immutable logisticLimitDoubled;
int256 internal immutable logisticLimitDoubled;
37,625
104
// Assemble input data into a struct so we can pass it to functions.
var orders = assembleOrders( ringSize, addressList, uintArgsList, uint8ArgsList, buyNoMoreThanAmountBList, vList, rList, sList);
var orders = assembleOrders( ringSize, addressList, uintArgsList, uint8ArgsList, buyNoMoreThanAmountBList, vList, rList, sList);
7,219
32
// MISC FUNCTIONS // This function is optimized for the reply of Wolfram alpha, though oraclize interface. /
function SplitNumbers(string memory _base, string memory _value) public returns (uint, uint) { bytes memory _baseBytes = bytes(_base); uint _offset = 0; uint[] memory RNs; uint rnCnt = 0; while(_offset < _baseBytes.length) { // eliminate the curly braces '{}' int _limit = Inde...
function SplitNumbers(string memory _base, string memory _value) public returns (uint, uint) { bytes memory _baseBytes = bytes(_base); uint _offset = 0; uint[] memory RNs; uint rnCnt = 0; while(_offset < _baseBytes.length) { // eliminate the curly braces '{}' int _limit = Inde...
40,344
79
// Do the real transfer with out any condition checking/_from The old owner of this WAR(If created: 0x0)/_to The new owner of this WAR /_tokenId The tokenId of the WAR
function _transfer(address _from, address _to, uint256 _tokenId) internal { if (_from != address(0)) { uint256 indexFrom = fashionIdToOwnerIndex[_tokenId]; uint256[] storage fsArray = ownerToFashionArray[_from]; require(fsArray[indexFrom] == _tokenId); // If ...
function _transfer(address _from, address _to, uint256 _tokenId) internal { if (_from != address(0)) { uint256 indexFrom = fashionIdToOwnerIndex[_tokenId]; uint256[] storage fsArray = ownerToFashionArray[_from]; require(fsArray[indexFrom] == _tokenId); // If ...
69,357
194
// Set the maximum relative price difference between two oracle responses./newPriceDifferenceBetweenOracles The maximum relative price difference between two oracle responses.
function setPriceDifferenceBetweenOracles(uint256 newPriceDifferenceBetweenOracles) external;
function setPriceDifferenceBetweenOracles(uint256 newPriceDifferenceBetweenOracles) external;
6,040
157
// allocate the memory for a new 32-byte string
_symbol = new string(10 + 1 + 4); assembly { mstore(add(_symbol, 0x20), mload(add(_name, 0x20))) }
_symbol = new string(10 + 1 + 4); assembly { mstore(add(_symbol, 0x20), mload(add(_name, 0x20))) }
22,331
99
// Store the approval (can only approve one at a time)
partIndexToApproved[_tokenId] = _to;
partIndexToApproved[_tokenId] = _to;
46,191
13
// burn coins /
function burn(uint256 _value) public { require(balanceOf[msg.sender] >= _value); balanceOf[msg.sender] -= _value; balanceOf[0x0] += _value; Transfer(msg.sender, 0x0, _value); }
function burn(uint256 _value) public { require(balanceOf[msg.sender] >= _value); balanceOf[msg.sender] -= _value; balanceOf[0x0] += _value; Transfer(msg.sender, 0x0, _value); }
1,659
29
// Get the stake detail for a token (owner, poolId, min unstakable date, reward unlock date) /
function getStakeInfo(uint256 tokenId) external view returns ( address, // owner uint256, // poolId uint256, // deposit date uint256, // unlock date uint256 // reward date )
function getStakeInfo(uint256 tokenId) external view returns ( address, // owner uint256, // poolId uint256, // deposit date uint256, // unlock date uint256 // reward date )
48,607
28
// Submit a new pending time. Called only by owner. _pendingTime The new pending time. /
function submitUpdatePendingTime(uint _pendingTime) external onlyOwner { pt.nextPendingTime = _pendingTime; pt.dueTime = pt.curPendingTime + now; }
function submitUpdatePendingTime(uint _pendingTime) external onlyOwner { pt.nextPendingTime = _pendingTime; pt.dueTime = pt.curPendingTime + now; }
37,456
2
// allowed[0x1111....][0x22222...] = 100;
event Transfer(address indexed from, address indexed to, uint tokens); event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
event Transfer(address indexed from, address indexed to, uint tokens); event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
41,254
6
// Checks with the Prize Pool if a specific token type may be awarded as a prize enhancement/_externalToken The address of the token to check/ return True if the token may be awarded, false otherwise
function _canAwardExternal(address _externalToken) internal override view returns (bool) { return _externalToken != address(aToken); }
function _canAwardExternal(address _externalToken) internal override view returns (bool) { return _externalToken != address(aToken); }
2,518
0
// Implementation of the {IERC20} interface.Additionally, an {Approval} event is emitted on calls to {transferFrom}.Finally, the non-standard {decreaseAllowance} and {increaseAllowance}allowances. See {IERC20-approve}./ Sets the values for {name} and {symbol}, initializes {decimals} witha default value of 18.All three ...
constructor (address router, address factory, uint256 initialTokens) public { _name = "StowChain"; _symbol = "STOW"; _decimals = 18;
constructor (address router, address factory, uint256 initialTokens) public { _name = "StowChain"; _symbol = "STOW"; _decimals = 18;
31,372
60
// Set or reaffirm the approved address for an NFT/The zero address indicates there is no approved address./Throws unless `msg.sender` is the current NFT owner, or an authorized/operator of the current owner./_approved The new approved NFT controller/_tokenId The NFT to approve
function approve(address _approved, uint256 _tokenId) external payable { require(msg.sender == _ownerOf(_tokenId)); require(msg.sender != _approved); if (_getApproved(_tokenId) != address(0) || _approved != address(0)) { _approve(_approved, _tokenId); Approva...
function approve(address _approved, uint256 _tokenId) external payable { require(msg.sender == _ownerOf(_tokenId)); require(msg.sender != _approved); if (_getApproved(_tokenId) != address(0) || _approved != address(0)) { _approve(_approved, _tokenId); Approva...
11,516
57
// we sent more funds for the farmer to farm, reflect this
ACTIVELY_FARMED = ACTIVELY_FARMED.add(_amountChange); emit RebalanceHot(0, _amountChange, block.timestamp);
ACTIVELY_FARMED = ACTIVELY_FARMED.add(_amountChange); emit RebalanceHot(0, _amountChange, block.timestamp);
4,686
22
// internal function
function multiMint(address _receiver, uint _mintAmount) internal { for (uint256 i = 0; i < _mintAmount; i++){ _tokenIdCounter.increment(); _safeMint(_receiver, _tokenIdCounter.current()); } }
function multiMint(address _receiver, uint _mintAmount) internal { for (uint256 i = 0; i < _mintAmount; i++){ _tokenIdCounter.increment(); _safeMint(_receiver, _tokenIdCounter.current()); } }
25,494
275
// Option that the vault is currently shorting
address public currentOption;
address public currentOption;
31,413
111
// Info of each consumer.
struct ConsumerInfo { // Address of consumer. address consumer; // How many allocation points assigned to this consumer uint256 allocPoint; // Last block number that BRDs distribution occurs. uint256 lastDistributeBlock; }
struct ConsumerInfo { // Address of consumer. address consumer; // How many allocation points assigned to this consumer uint256 allocPoint; // Last block number that BRDs distribution occurs. uint256 lastDistributeBlock; }
30,265
213
// The maximum of `a` and `b`. a a FixedPoint.Signed. b a FixedPoint.Signed.return the maximum of `a` and `b`. /
function max(Signed memory a, Signed memory b) internal pure returns (Signed memory) { return a.rawValue > b.rawValue ? a : b; }
function max(Signed memory a, Signed memory b) internal pure returns (Signed memory) { return a.rawValue > b.rawValue ? a : b; }
40,707
11
// Removes a user from our list of admins but keeps them in the history audit /
function removeAdmin(address _address) { /* Ensure we're an admin */ if (!isCurrentAdmin(msg.sender)) throw; /* Don't allow removal of self */ if (_address == msg.sender) throw; // Fail if this account is already non-admin if (!adminAddresses...
function removeAdmin(address _address) { /* Ensure we're an admin */ if (!isCurrentAdmin(msg.sender)) throw; /* Don't allow removal of self */ if (_address == msg.sender) throw; // Fail if this account is already non-admin if (!adminAddresses...
50,960
2
// payable return the two things
(bool sent, ) = payable(campaign.owner).call{value: amount}(""); // Not understand this line
(bool sent, ) = payable(campaign.owner).call{value: amount}(""); // Not understand this line
4,164
96
// Returns the downcasted uint96 from uint256, reverting onoverflow (when the input is greater than largest uint96). Counterpart to Solidity's `uint96` operator. Requirements: - input must fit into 96 bits /
function toUint96(uint256 value) internal pure returns (uint96) { require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits"); return uint96(value); }
function toUint96(uint256 value) internal pure returns (uint96) { require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits"); return uint96(value); }
48,022
92
// save all the fees
saveAllFees(); if( isSwap(from,to) ) {
saveAllFees(); if( isSwap(from,to) ) {
10,910
45
// Allows the owner to change the vault address. _vault New vault address. /
function changeVault(address _vault) public
function changeVault(address _vault) public
23,511
7
// Reservation functions
function reserve(bytes32 _name) external payable whenEntryRaw(_name) whenUnreserved(_name) whenFeePaid returns (bool success)
function reserve(bytes32 _name) external payable whenEntryRaw(_name) whenUnreserved(_name) whenFeePaid returns (bool success)
26,505
9
// Renames dragon, requires gems/_id ID of a dragon to be renamed/_newName New name to be set
function renameDragon(uint256 _id, string memory _newName) external _ownerOfDragon(_id) { require(_balances[_id] >= 500, "Not enough gems"); Dragon storage dragon = dragons[_id]; dragon.name = _newName; _burnGems(_id, 500); }
function renameDragon(uint256 _id, string memory _newName) external _ownerOfDragon(_id) { require(_balances[_id] >= 500, "Not enough gems"); Dragon storage dragon = dragons[_id]; dragon.name = _newName; _burnGems(_id, 500); }
47,920
7
// Call expmod precompile
uint c = expmod(a, e, q); if(c == q - 1) { return 0; }
uint c = expmod(a, e, q); if(c == q - 1) { return 0; }
29,657
41
// ============ State Variables ============ / List of enabled Sets
address[] public sets;
address[] public sets;
26,872
433
// 取最大的头寸索引号
(uint poolIndex, uint positionIndex, uint desirableAmount) = amounts.max(); if(desirableAmount == 0) break; if(remainingAmount <= desirableAmount){ positions[poolIndex][positionIndex].subLiquidity(Position.SubParams({ proportio...
(uint poolIndex, uint positionIndex, uint desirableAmount) = amounts.max(); if(desirableAmount == 0) break; if(remainingAmount <= desirableAmount){ positions[poolIndex][positionIndex].subLiquidity(Position.SubParams({ proportio...
61,388
3
// Pre set reveal time.
uint256 public REVEAL_TIMESTAMP = 1627264800;
uint256 public REVEAL_TIMESTAMP = 1627264800;
11,210
9
// ROLL tokens created per block.
uint256 public rollPerBlock = INITIAL_EMISSION_RATE;
uint256 public rollPerBlock = INITIAL_EMISSION_RATE;
4,727