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 |
|---|---|---|---|---|
190 | // Emit the `Transfer` event. | log4(
0, // Start of data (0, since no data).
0, // End of data (0, since no data).
_TRANSFER_EVENT_SIGNATURE, // Signature.
0, // `address(0)`.
toMasked, // `to`.
startTokenId // `tokenId`.
)
for {
| log4(
0, // Start of data (0, since no data).
0, // End of data (0, since no data).
_TRANSFER_EVENT_SIGNATURE, // Signature.
0, // `address(0)`.
toMasked, // `to`.
startTokenId // `tokenId`.
)
for {
| 8,751 |
37 | // requireAuthorizedCaller | returns(uint) {
return nbrRegisteredAirlines;
}
| returns(uint) {
return nbrRegisteredAirlines;
}
| 10,947 |
300 | // _safeMint's second argument now takes in a quantity, not a tokenId. (same as ERC721A) | _safeMint(msg.sender, _mintAmount);
| _safeMint(msg.sender, _mintAmount);
| 24,457 |
108 | // how much ETH did we just swap into? | uint256 newBalance = address(this).balance.sub(initialBalance);
| uint256 newBalance = address(this).balance.sub(initialBalance);
| 8,226 |
70 | // Distribute the minted tokens to auction participaters | for (uint256 i = 0; i < auctionLobbyParticipaters.length; i++) {
address participater = auctionLobbyParticipaters[i];
AuctionLobbyParticipate storage ap =
auctionLobbyParticipates[participater];
uint256 newReward =
DAILY_MINT_CAP
.mul(ap.BNBParticipated[getLastEpoch()])
.div(dailyTotalBNB[getLastEpoch()]);
| for (uint256 i = 0; i < auctionLobbyParticipaters.length; i++) {
address participater = auctionLobbyParticipaters[i];
AuctionLobbyParticipate storage ap =
auctionLobbyParticipates[participater];
uint256 newReward =
DAILY_MINT_CAP
.mul(ap.BNBParticipated[getLastEpoch()])
.div(dailyTotalBNB[getLastEpoch()]);
| 14,062 |
104 | // | onReceive function signatures | bytes4 internal constant ERC1155_RECEIVED_VALUE = 0xf23a6e61;
bytes4 internal constant ERC1155_BATCH_RECEIVED_VALUE = 0xbc197c81;
| bytes4 internal constant ERC1155_RECEIVED_VALUE = 0xf23a6e61;
bytes4 internal constant ERC1155_BATCH_RECEIVED_VALUE = 0xbc197c81;
| 22,011 |
50 | // return total number of unlocked reward tokens / | function totalUnlocked() public view returns (uint256) {
uint256 total = totalShares(address(_token));
uint256 locked = lockedShares(address(_token));
return _token.getAmount(total, total - locked);
}
| function totalUnlocked() public view returns (uint256) {
uint256 total = totalShares(address(_token));
uint256 locked = lockedShares(address(_token));
return _token.getAmount(total, total - locked);
}
| 19,246 |
249 | // Launch pod. | _launchPod(_podId);
| _launchPod(_podId);
| 32,934 |
45 | // allocate the string | bytes memory bstr = new bytes(length);
| bytes memory bstr = new bytes(length);
| 33,772 |
33 | // `freeze? Prevent | Allow` `target` from sending & receiving tokens/target Address to be frozen/freeze either to freeze it or not | function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
| function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
| 1,619 |
68 | // l достаём каждый раз адрес контракта BancorNetwork, т.к. он может меняться | IBancorNetwork bancorNetwork = IBancorNetwork(contractRegistry.addressOf(BANCOR_NETWORK_NAME));
address tokenSource = path[index++];
address tokenTarget = path[index++];
address[] memory swapPath = bancorNetwork.conversionPath(IERC20(tokenSource), IERC20(tokenTarget));
| IBancorNetwork bancorNetwork = IBancorNetwork(contractRegistry.addressOf(BANCOR_NETWORK_NAME));
address tokenSource = path[index++];
address tokenTarget = path[index++];
address[] memory swapPath = bancorNetwork.conversionPath(IERC20(tokenSource), IERC20(tokenTarget));
| 1,438 |
178 | // All type hashes have this format: (bytes calldata, address sender, uint256 nonce, uint256 deadline). | bytes32 structHash = keccak256(abi.encode(typeHash, keccak256(_calldata()), msg.sender, nonce, deadline));
bytes32 digest = _hashTypedDataV4(structHash);
(uint8 v, bytes32 r, bytes32 s) = _signature();
address recoveredAddress = ecrecover(digest, v, r, s);
| bytes32 structHash = keccak256(abi.encode(typeHash, keccak256(_calldata()), msg.sender, nonce, deadline));
bytes32 digest = _hashTypedDataV4(structHash);
(uint8 v, bytes32 r, bytes32 s) = _signature();
address recoveredAddress = ecrecover(digest, v, r, s);
| 82,058 |
57 | // Percentage of the borrower's interest fee that gets passed to the suppliers | Decimal.D256 earningsRate;
| Decimal.D256 earningsRate;
| 3,106 |
18 | // Remove Token and Alpaca from ibToken-Alpha Pool. 1. Remove ibToken and Alpaca from the pool. 2. Redeem ibToken back to Token on Bank contract 3. Return Token and Alpaca to caller. | function removeLiquidityToken(
uint256 liquidity,
uint256 amountAlpacaMin,
uint256 amountTokenMin,
address to,
uint256 deadline
| function removeLiquidityToken(
uint256 liquidity,
uint256 amountAlpacaMin,
uint256 amountTokenMin,
address to,
uint256 deadline
| 50,117 |
44 | // Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. Beware that changing an allowance with this method brings the risk that someone may use both the oldand the new allowance by unfortunate transaction ordering. One possible solution to mitigate thisrace condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: _spender The address which will spend the funds. _value The amount of tokens to be spent. / | function approve(address _spender, uint256 _value) public override virtual returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| function approve(address _spender, uint256 _value) public override virtual returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| 6,796 |
23 | // 1,2,4,8,16,32,64 hours for activation depending on number of handshakes (if setting delay = 1 hour) | users[msg.sender].activationTime = getActivationTime (currentLevel, setting_delay);
users[msg.sender].refunded = false;
users[msg.sender].userID = numUsers;
userAddrs[numUsers] = msg.sender;
NewUser(numUsers, msg.sender, referal, users[msg.sender].activationTime);
return numUsers;
| users[msg.sender].activationTime = getActivationTime (currentLevel, setting_delay);
users[msg.sender].refunded = false;
users[msg.sender].userID = numUsers;
userAddrs[numUsers] = msg.sender;
NewUser(numUsers, msg.sender, referal, users[msg.sender].activationTime);
return numUsers;
| 48,985 |
112 | // Emited when contract is upgraded or ownership changed | event ContractUpgrade(address newContract);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
| event ContractUpgrade(address newContract);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
| 58,118 |
3 | // Modified / | contract SimpleList {
struct Entity {
address eAddress;
uint eData;
}
Entity[] public entityStructs;
function add(address entityAddress, uint entityData) public returns(uint rowNumber) {
Entity memory newEntity;
newEntity.eAddress = entityAddress;
newEntity.eData = entityData;
return entityStructs.push(newEntity)-1;
}
function count() public constant returns(uint entityCount) {
return entityStructs.length;
}
}
| contract SimpleList {
struct Entity {
address eAddress;
uint eData;
}
Entity[] public entityStructs;
function add(address entityAddress, uint entityData) public returns(uint rowNumber) {
Entity memory newEntity;
newEntity.eAddress = entityAddress;
newEntity.eData = entityData;
return entityStructs.push(newEntity)-1;
}
function count() public constant returns(uint entityCount) {
return entityStructs.length;
}
}
| 35,541 |
7 | // Query if a contract implements an interface/interfaceId The interface identifier, as specified in ERC-165/Interface identification is specified in ERC-165. This function/uses less than 30,000 gas./ return `true` if the contract implements `interfaceId` and/`interfaceId` is not 0xffffffff, `false` otherwise | function supportsInterface(bytes4 interfaceId) external pure returns (bool);
| function supportsInterface(bytes4 interfaceId) external pure returns (bool);
| 666 |
161 | // globalConstraintsPre that determine pre conditions for all actions on the controller |
GlobalConstraint[] public globalConstraintsPre;
|
GlobalConstraint[] public globalConstraintsPre;
| 30,184 |
0 | // ---Contract Variables--- | string public name = "RestakingFarm";
| string public name = "RestakingFarm";
| 5,198 |
14 | // Validate purchase signature / | function _validatePurchaseRequest(bytes32 message, bytes calldata signature, string calldata nonce) internal virtual {
// Verify nonce usage/re-use
bytes32 nonceBytes32 = _getNonceBytes32(nonce);
require(!_usedNonces[nonceBytes32], "Cannot replay transaction");
// Verify valid message based on input variables
bytes32 expectedMessage = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", (20+bytes(nonce).length).toString(), msg.sender, nonce));
require(message == expectedMessage, "Malformed message");
// Verify signature was performed by the expected signing address
address signer = message.recover(signature);
require(signer == _signingAddress, "Invalid signature");
_usedNonces[nonceBytes32] = true;
}
| function _validatePurchaseRequest(bytes32 message, bytes calldata signature, string calldata nonce) internal virtual {
// Verify nonce usage/re-use
bytes32 nonceBytes32 = _getNonceBytes32(nonce);
require(!_usedNonces[nonceBytes32], "Cannot replay transaction");
// Verify valid message based on input variables
bytes32 expectedMessage = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", (20+bytes(nonce).length).toString(), msg.sender, nonce));
require(message == expectedMessage, "Malformed message");
// Verify signature was performed by the expected signing address
address signer = message.recover(signature);
require(signer == _signingAddress, "Invalid signature");
_usedNonces[nonceBytes32] = true;
}
| 19,387 |
22 | // --- Utils --- | function either(bool x, bool y) internal pure returns (bool z) {
assembly{ z := or(x, y)}
}
| function either(bool x, bool y) internal pure returns (bool z) {
assembly{ z := or(x, y)}
}
| 15,098 |
100 | // we check if the collateral that we are withdrawing leaves us in a risky range, we then take action | uint256 amountToWithdrawETH = amountETH;
| uint256 amountToWithdrawETH = amountETH;
| 50,913 |
74 | // Expose the user specific limits related to the current active claim condition | function getUserClaimConditions(address _claimer)
external
view
override
returns (
uint256 conditionId,
uint256 walletClaimedCount,
uint256 walletClaimedCountInPhase,
uint256 lastClaimTimestamp,
uint256 nextValidClaimTimestamp
| function getUserClaimConditions(address _claimer)
external
view
override
returns (
uint256 conditionId,
uint256 walletClaimedCount,
uint256 walletClaimedCountInPhase,
uint256 lastClaimTimestamp,
uint256 nextValidClaimTimestamp
| 43,697 |
62 | // | * function increaseAllowance(address spender, uint addedValue) public whenNotPaused returns (bool success) {
* return super.increaseAllowance(spender, addedValue);
* }
| * function increaseAllowance(address spender, uint addedValue) public whenNotPaused returns (bool success) {
* return super.increaseAllowance(spender, addedValue);
* }
| 4,448 |
12 | // string[] memory feeds = new string[](1);feeds[0] = uint256(log.topics[2]).toHexString(); | revert StreamsLookup(
STRING_DATASTREAMS_FEEDLABEL,
| revert StreamsLookup(
STRING_DATASTREAMS_FEEDLABEL,
| 21,789 |
11 | // delegate your wallet to someone | function approve(address _spender, uint _value) returns (bool success){
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
| function approve(address _spender, uint _value) returns (bool success){
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
| 21,386 |
2 | // Overrides the default functionality that prevents the admin from reaching the implementation contract. / | function _willFallback()
| function _willFallback()
| 43,844 |
116 | // super on transfer to check if LBP address is frozen / | function _beforeTokenTransfer(address from, address to, uint256 amount) override internal virtual {
super._beforeTokenTransfer(from, to, amount);
require(isLBPFrozen[from] != true, "Cannot transfer, from address is frozen");
require(isLBPFrozen[to] != true, "Cannot transfer, to address is frozen");
}
| function _beforeTokenTransfer(address from, address to, uint256 amount) override internal virtual {
super._beforeTokenTransfer(from, to, amount);
require(isLBPFrozen[from] != true, "Cannot transfer, from address is frozen");
require(isLBPFrozen[to] != true, "Cannot transfer, to address is frozen");
}
| 45,227 |
12 | // Sets the max fee (in BPS units) that can be accepted in any payment despite operator and buyer having signed a larger amount; a value of 10000 BPS would correspond to 100% (no limit at all) feeBPS The new max fee (in BPS units) / | function setMaxFeeBPS(uint256 feeBPS) public onlyOwner {
require(
(feeBPS <= 10000) && (feeBPS >= 0),
"BuyNowBase::setMaxFeeBPS: maxFeeBPS outside limits"
);
emit MaxFeeBPS(feeBPS, _maxFeeBPS);
_maxFeeBPS = feeBPS;
}
| function setMaxFeeBPS(uint256 feeBPS) public onlyOwner {
require(
(feeBPS <= 10000) && (feeBPS >= 0),
"BuyNowBase::setMaxFeeBPS: maxFeeBPS outside limits"
);
emit MaxFeeBPS(feeBPS, _maxFeeBPS);
_maxFeeBPS = feeBPS;
}
| 26,432 |
0 | // function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}./ Indicates that the contract has been initialized. / | bool private _initialized;
| bool private _initialized;
| 199 |
20 | // Flag marking whether the proposal has been canceled | bool canceled;
| bool canceled;
| 11,751 |
1 | // Function to get rewards array from current pool user address pid pool idreturn an array of rewards / | function getRewards(address user, uint8 pid)
external
view
returns (uint256[] memory)
| function getRewards(address user, uint8 pid)
external
view
returns (uint256[] memory)
| 37,421 |
230 | // If token URI is set, concatenate base URI and tokenURI (via abi.encodePacked). | return bytes(tokenURI).length > 0 ? string(abi.encodePacked(_baseURI, tokenURI)) : super.uri(tokenId);
| return bytes(tokenURI).length > 0 ? string(abi.encodePacked(_baseURI, tokenURI)) : super.uri(tokenId);
| 21,787 |
100 | // Internal function to deposit in the Convex Booster and mint shares/Used for deposit and during an harvest/_lpTokens amount to mint/_price we give the price as input to save on gas when calculating price | function _depositAndMint(
address _account,
uint256 _lpTokens,
uint256 _price
| function _depositAndMint(
address _account,
uint256 _lpTokens,
uint256 _price
| 67,335 |
10 | // similar to take(), but with the block height joined to calculate return./for instance, it returns (_amount, _block), which means at block height _block, the callee has accumulated _amount of interests./ return amount of interests and the block height. | function takeWithBlock() external view returns (uint, uint);
| function takeWithBlock() external view returns (uint, uint);
| 39,628 |
38 | // ensure that the bidding period has ended | require(block.timestamp > currentBid.endTime, "BID_ACTIVE");
if (currentBid.voted) return;
uint128 highestBid = currentBid.highestBid;
uint128 feeAmount = _calculateFeeAmount(highestBid);
| require(block.timestamp > currentBid.endTime, "BID_ACTIVE");
if (currentBid.voted) return;
uint128 highestBid = currentBid.highestBid;
uint128 feeAmount = _calculateFeeAmount(highestBid);
| 5,946 |
258 | // Pairs to swap NFT _id => price / | struct Item {
uint256 item_id;
address collection;
uint256 token_id;
address creator;
address owner;
uint256 balance;
uint256 price;
uint256 creatorFee;
uint256 totalSold;
bool bValid;
}
| struct Item {
uint256 item_id;
address collection;
uint256 token_id;
address creator;
address owner;
uint256 balance;
uint256 price;
uint256 creatorFee;
uint256 totalSold;
bool bValid;
}
| 13,802 |
65 | // hodl multiplier. because if you don't hodl at all, you shouldn't be rewarded resolves. and the multiplier you get for hodling needs to be relative to the average hodl | uint buyInTime = avgFactor_buyInTimeSum[addr] / avgFactor_ethSpent[addr];
uint cashoutTime = NOW()*scaleFactor - buyInTime;
uint releaseTimeSum = avgFactor_releaseTimeSum + cashoutTime*input_ETH/scaleFactor*buyInTime;
uint releaseWeight = avgFactor_releaseWeight + input_ETH*buyInTime/scaleFactor;
uint avgCashoutTime = releaseTimeSum/releaseWeight;
return (output_ETH, input_ETH * cashoutTime / avgCashoutTime * input_ETH / output_ETH, releaseTimeSum, releaseWeight, input_ETH);
| uint buyInTime = avgFactor_buyInTimeSum[addr] / avgFactor_ethSpent[addr];
uint cashoutTime = NOW()*scaleFactor - buyInTime;
uint releaseTimeSum = avgFactor_releaseTimeSum + cashoutTime*input_ETH/scaleFactor*buyInTime;
uint releaseWeight = avgFactor_releaseWeight + input_ETH*buyInTime/scaleFactor;
uint avgCashoutTime = releaseTimeSum/releaseWeight;
return (output_ETH, input_ETH * cashoutTime / avgCashoutTime * input_ETH / output_ETH, releaseTimeSum, releaseWeight, input_ETH);
| 32,802 |
9 | // get the inboundNonce of a receiver from a source chain which could be EVM or non-EVM chain_srcChainId - the source chain identifier_srcAddress - the source chain contract address | function getInboundNonce(uint16 _srcChainId, bytes calldata _srcAddress)
external
view
returns (uint64);
| function getInboundNonce(uint16 _srcChainId, bytes calldata _srcAddress)
external
view
returns (uint64);
| 58,072 |
25 | // square root of a UQ112x112 | function sqrt(uq112x112 memory self) internal pure returns (uq112x112 memory) {
return uq112x112(uint224(Babylonian.sqrt(uint256(self._x)) << 56));
}
| function sqrt(uq112x112 memory self) internal pure returns (uq112x112 memory) {
return uq112x112(uint224(Babylonian.sqrt(uint256(self._x)) << 56));
}
| 20,713 |
44 | // Allowance to Maker's contract / | function setMakerAllowance(TokenInterface _token, address _spender) internal {
if (_token.allowance(address(this), _spender) != uint(-1)) {
_token.approve(_spender, uint(-1));
}
}
| function setMakerAllowance(TokenInterface _token, address _spender) internal {
if (_token.allowance(address(this), _spender) != uint(-1)) {
_token.approve(_spender, uint(-1));
}
}
| 9,769 |
18 | // Recalls the target player's best cards, which should now be decrypted and validated, and submits them for analysisto produce a hand score that may be used in ranking players' results. The resulting score is set in the originating PokerHandDatacontracts "result" mapping via the "set_result" function.See "calculateHandScore" for resulting poker hand score ranges.target The target player for which to generate a score and store the result./ | function generateScore(address target) private {
for (uint count=0; count<pokerHandData.num_PlayerCards(target); count++) {
(uint index, uint suit, uint value) = pokerHandData.playerCards(target, count);
workCards[count] = Card(index, suit, value);
}
pokerHandData.set_result(target, calculateHandScore());
}
| function generateScore(address target) private {
for (uint count=0; count<pokerHandData.num_PlayerCards(target); count++) {
(uint index, uint suit, uint value) = pokerHandData.playerCards(target, count);
workCards[count] = Card(index, suit, value);
}
pokerHandData.set_result(target, calculateHandScore());
}
| 40,610 |
39 | // enum of current crowd sale state / | enum Stages {
none,
icoStart,
icoEnd
}
| enum Stages {
none,
icoStart,
icoEnd
}
| 3,247 |
3 | // return the generator of G2 | function P2() pure internal returns (G2Point) {
return G2Point(
[11559732032986387107991004021392285783925812861821192530917403151452391805634,
10857046999023057135944570762232829481370756359578518086990519993285655852781],
[4082367875863433681332203403145435568316851327593401208105741076214120093531,
8495653923123431417604973247489272438418190587263600148770280649306958101930]
);
}
| function P2() pure internal returns (G2Point) {
return G2Point(
[11559732032986387107991004021392285783925812861821192530917403151452391805634,
10857046999023057135944570762232829481370756359578518086990519993285655852781],
[4082367875863433681332203403145435568316851327593401208105741076214120093531,
8495653923123431417604973247489272438418190587263600148770280649306958101930]
);
}
| 40,602 |
153 | // Function that computes selling price in reserve tokens given an amount in traded token. _amountProductselling amount in product tokenreturn soldAmounttotal amount that will be transferred to the seller (with 2% platform fee)./ | function calculateSellReturn(uint32 _amountProduct)
public view virtual returns (uint256 soldAmount)
| function calculateSellReturn(uint32 _amountProduct)
public view virtual returns (uint256 soldAmount)
| 57,721 |
15 | // ==================================================================== View Helpers ==================================================================== | function name() external pure returns (string memory) {
return "FrxETH/ETH Curve LP Dual Oracle w/ Min Max Bounds";
}
| function name() external pure returns (string memory) {
return "FrxETH/ETH Curve LP Dual Oracle w/ Min Max Bounds";
}
| 19,394 |
0 | // Contracts (constant) | StorageInterfaceV5 public storageT;
| StorageInterfaceV5 public storageT;
| 16,958 |
100 | // Logic to claim aidropped tokens from Toodle Loot Bag | else if (contractId == 1) {
require(
tokenId >= tokenIdStart && tokenId <= tokenIdEndToodleLoot,
"Error: Invalid tokenId"
);
require(
!toodleLootClaimedByTokenId[tokenId],
"Error: You included a Loot Bag with TODL already claimed for the airdrop"
);
| else if (contractId == 1) {
require(
tokenId >= tokenIdStart && tokenId <= tokenIdEndToodleLoot,
"Error: Invalid tokenId"
);
require(
!toodleLootClaimedByTokenId[tokenId],
"Error: You included a Loot Bag with TODL already claimed for the airdrop"
);
| 4,609 |
32 | // Submit a new logic. Called only by owner. _logic The new logic contract address. _value True: enable a new logic; False: disable an old logic. / | function submitUpdate(address _logic, bool _value) external onlyOwner {
pending storage p = pendingLogics[_logic];
p.value = _value;
p.dueTime = now + pt.curPendingTime;
emit UpdateLogicSubmitted(_logic, _value);
}
| function submitUpdate(address _logic, bool _value) external onlyOwner {
pending storage p = pendingLogics[_logic];
p.value = _value;
p.dueTime = now + pt.curPendingTime;
emit UpdateLogicSubmitted(_logic, _value);
}
| 23,688 |
0 | // ---------------------------------------------------------------------------------------------- WFI token by Rewardefi.finance Limited. An ERC20 standard author: HOO dev Contact: support@rewardefi.finance | contract ERC20 {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256 _user);
function transfer(address to, uint256 value) public returns (bool success);
function allowance(address owner, address spender) public view returns (uint256 value);
function transferFrom(address from, address to, uint256 value) public returns (bool success);
function approve(address spender, uint256 value) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
| contract ERC20 {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256 _user);
function transfer(address to, uint256 value) public returns (bool success);
function allowance(address owner, address spender) public view returns (uint256 value);
function transferFrom(address from, address to, uint256 value) public returns (bool success);
function approve(address spender, uint256 value) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
| 39,057 |
24 | // Returns the multiplication of two unsigned integers, reverting onoverflow. Counterpart to Solidity's `` operator. Requirements:- Multiplication cannot 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.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, 'SafeMath: multiplication overflow');
return c;
}
| 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.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, 'SafeMath: multiplication overflow');
return c;
}
| 12,122 |
28 | // owner is a Pareto wallet which should be able to perform admin functions | owner = _owner;
token = ERC20(_token);
paretoAddress = _token;
| owner = _owner;
token = ERC20(_token);
paretoAddress = _token;
| 446 |
25 | // pragma solidity >=0.5.12; / | contract LibNote {
event LogNote(
bytes4 indexed sig,
address indexed usr,
bytes32 indexed arg1,
bytes32 indexed arg2,
bytes data
) anonymous;
modifier note {
_;
assembly {
// log an 'anonymous' event with a constant 6 words of calldata
// and four indexed topics: selector, caller, arg1 and arg2
let mark := msize() // end of memory ensures zero
mstore(0x40, add(mark, 288)) // update free memory pointer
mstore(mark, 0x20) // bytes type data offset
mstore(add(mark, 0x20), 224) // bytes size (padded)
calldatacopy(add(mark, 0x40), 0, 224) // bytes payload
log4(
mark,
288, // calldata
shl(224, shr(224, calldataload(0))), // msg.sig
caller(), // msg.sender
calldataload(4), // arg1
calldataload(36) // arg2
)
}
}
}
| contract LibNote {
event LogNote(
bytes4 indexed sig,
address indexed usr,
bytes32 indexed arg1,
bytes32 indexed arg2,
bytes data
) anonymous;
modifier note {
_;
assembly {
// log an 'anonymous' event with a constant 6 words of calldata
// and four indexed topics: selector, caller, arg1 and arg2
let mark := msize() // end of memory ensures zero
mstore(0x40, add(mark, 288)) // update free memory pointer
mstore(mark, 0x20) // bytes type data offset
mstore(add(mark, 0x20), 224) // bytes size (padded)
calldatacopy(add(mark, 0x40), 0, 224) // bytes payload
log4(
mark,
288, // calldata
shl(224, shr(224, calldataload(0))), // msg.sig
caller(), // msg.sender
calldataload(4), // arg1
calldataload(36) // arg2
)
}
}
}
| 31,025 |
541 | // transfer MPH reward from msg.sender | DInterest.Deposit memory deposit = pool.getDeposit(_nftID);
uint256 mintMPHAmount = deposit.mintMPHAmount;
mph.transferFrom(msg.sender, address(this), mintMPHAmount);
mph.increaseAllowance(address(clone), mintMPHAmount);
| DInterest.Deposit memory deposit = pool.getDeposit(_nftID);
uint256 mintMPHAmount = deposit.mintMPHAmount;
mph.transferFrom(msg.sender, address(this), mintMPHAmount);
mph.increaseAllowance(address(clone), mintMPHAmount);
| 21,148 |
8 | // Get the release rate of CHESS token at the given timestamp/timestamp Timestamp for release rate/ return Release rate (number of CHESS token per second) | function getRate(uint256 timestamp) external view override returns (uint256) {
if (timestamp < startTimestamp) {
return 0;
}
uint256 index = (timestamp - startTimestamp) / 1 weeks;
(, uint256 weeklySupply) = getWeeklySupply(index);
return weeklySupply.div(1 weeks);
}
| function getRate(uint256 timestamp) external view override returns (uint256) {
if (timestamp < startTimestamp) {
return 0;
}
uint256 index = (timestamp - startTimestamp) / 1 weeks;
(, uint256 weeklySupply) = getWeeklySupply(index);
return weeklySupply.div(1 weeks);
}
| 43,534 |
57 | // Transfer funds to seller to seller's recipient amount amount being transferred (in currency) / | function _transferFeesAndFundsWithWCANTO(address to, uint256 amount) internal {
IERC20(WCANTO).safeTransfer(to, amount);
}
| function _transferFeesAndFundsWithWCANTO(address to, uint256 amount) internal {
IERC20(WCANTO).safeTransfer(to, amount);
}
| 15,523 |
9 | // where string is serverAddress, requiredReviewer | mapping(string => string[]) public requiredReviewers;
function reviewArticle(string memory ipfsHash, bool memory approved)
public
| mapping(string => string[]) public requiredReviewers;
function reviewArticle(string memory ipfsHash, bool memory approved)
public
| 26,149 |
726 | // If they're somehow equal, we just want DAI |
return (dai, 0);
|
return (dai, 0);
| 4,174 |
5 | // Returns all the tokenIds from an owner/This method MUST NEVER be called by smart contract code. | function getTokenIds(address owner)
external
view
returns (uint256[] memory)
| function getTokenIds(address owner)
external
view
returns (uint256[] memory)
| 63,790 |
56 | // Helper function to calculate slippage-adjusted share of pool | function _disincorporateAmount(uint _amountIn, bool isAnchor) private returns (uint amount0, uint amount1) {
(uint112 _reservePair0, uint112 _reservePair1) = getPairReservesNormalized();
amount0 = !isAnchor ? _amountIn/2 : ZirconLibrary.getAmountOut(_amountIn/2, _reservePair1, _reservePair0);
amount1 = isAnchor ? _amountIn/2 : ZirconLibrary.getAmountOut(_amountIn/2, _reservePair0, _reservePair1);
}
| function _disincorporateAmount(uint _amountIn, bool isAnchor) private returns (uint amount0, uint amount1) {
(uint112 _reservePair0, uint112 _reservePair1) = getPairReservesNormalized();
amount0 = !isAnchor ? _amountIn/2 : ZirconLibrary.getAmountOut(_amountIn/2, _reservePair1, _reservePair0);
amount1 = isAnchor ? _amountIn/2 : ZirconLibrary.getAmountOut(_amountIn/2, _reservePair0, _reservePair1);
}
| 44,344 |
9 | // Returns `sample`'s accumulator of the logarithm of the pair price. / | function _accLogPairPrice(bytes32 sample) private pure returns (int256) {
return sample.decodeInt53(_ACC_LOG_PAIR_PRICE_OFFSET);
}
| function _accLogPairPrice(bytes32 sample) private pure returns (int256) {
return sample.decodeInt53(_ACC_LOG_PAIR_PRICE_OFFSET);
}
| 35,576 |
107 | // 581530900000 | initRegistMatch(58, 0, 0, 1530900000);
| initRegistMatch(58, 0, 0, 1530900000);
| 73,563 |
45 | // Take a fee from the user in dai | _amount = sub(_amount, takeFee(_amount));
uint ethAmount = swapDaiAndLockEth(tub, _cup, _amount, exchangeWrapper);
require(tub.ink(_cup) > startingCollateral, "collateral must be bigger than starting point");
SaverLogger(LOGGER_ADDRESS).LogBoost(uint(_cup), msg.sender, _amount, ethAmount);
| _amount = sub(_amount, takeFee(_amount));
uint ethAmount = swapDaiAndLockEth(tub, _cup, _amount, exchangeWrapper);
require(tub.ink(_cup) > startingCollateral, "collateral must be bigger than starting point");
SaverLogger(LOGGER_ADDRESS).LogBoost(uint(_cup), msg.sender, _amount, ethAmount);
| 10,086 |
181 | // The block number when TAKO mining starts. | uint256 public startBlock;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
constructor(
TakoToken _tako,
uint256 _takoPerBlock,
uint256 _startBlock
| uint256 public startBlock;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
constructor(
TakoToken _tako,
uint256 _takoPerBlock,
uint256 _startBlock
| 40,605 |
39 | // Constructor that gives msg.sender all of existing tokens. | constructor(address _frozenAddress) public {
require(_frozenAddress != address(0) && _frozenAddress != msg.sender);
frozenAddress = _frozenAddress;
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
| constructor(address _frozenAddress) public {
require(_frozenAddress != address(0) && _frozenAddress != msg.sender);
frozenAddress = _frozenAddress;
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
| 46,487 |
108 | // In una società di diritto privato gli individui acconsentono volontariamente ai servizi e agli scambi appaltatie quindi, devono concordare le clausole di uscita ammende, se applicabili, se il deposito deve essere versato inanticipo o le parti concorderanno di pagare alla risoluzione del contratto. Un tribunale di diritto privato o selezionatoil giudice deve essere scelto come arbitri da tutte le parti di comune accordo. Una controversia deve essereavviato dalle parti che hanno firmato il contratto. Viene avviata una controversia, solo l'arbitro devedecidere sui motivi. I trasgressori illeciti pagheranno la multa a tutte le altre parti e contrarrannola violazione sarà incrementata dall'arbitro. | function setAgreement(uint256 _aid, string memory _hash, string memory _gecos, string memory _url, string memory _signedHash, uint256 _fine, address _arbitrator, uint256 _arbitratorFee, uint256 _deposit, string memory _signComment,uint256 _sign) notPhysicallyRemoved public {
require(_aid>0,"A2: bad id"); // AuthZ: ivalid id for private agreement
require(_selfDetermined[_arbitrator].sRole==1,"A2: court must be Role=1"); // A2: arbitrator or court must set himself Role=1
if(_privLawAgreement[_aid].creator==address(0)) { // doesnt exist, create it
_privLawAgreement[_aid].hash=_hash;
_privLawAgreement[_aid].gecos=_gecos;
_privLawAgreement[_aid].url=_url;
_privLawAgreement[_aid].fine=_fine;
_privLawAgreement[_aid].deposit=_deposit; // 1 = required
_privLawAgreement[_aid].creator=msg.sender;
_privLawAgreement[_aid].arbitrator=_arbitrator;
_privLawAgreement[_aid].arbitratorFee=_arbitratorFee;
_privLawAgreement[_aid].createdOn=block.timestamp;
_privLawAgreementIDs.push(_aid);
} else { // exists, sign it
_setAgreementSign(_aid, _hash, _signedHash, _fine, _arbitrator, _signComment, _sign);
}
}
| function setAgreement(uint256 _aid, string memory _hash, string memory _gecos, string memory _url, string memory _signedHash, uint256 _fine, address _arbitrator, uint256 _arbitratorFee, uint256 _deposit, string memory _signComment,uint256 _sign) notPhysicallyRemoved public {
require(_aid>0,"A2: bad id"); // AuthZ: ivalid id for private agreement
require(_selfDetermined[_arbitrator].sRole==1,"A2: court must be Role=1"); // A2: arbitrator or court must set himself Role=1
if(_privLawAgreement[_aid].creator==address(0)) { // doesnt exist, create it
_privLawAgreement[_aid].hash=_hash;
_privLawAgreement[_aid].gecos=_gecos;
_privLawAgreement[_aid].url=_url;
_privLawAgreement[_aid].fine=_fine;
_privLawAgreement[_aid].deposit=_deposit; // 1 = required
_privLawAgreement[_aid].creator=msg.sender;
_privLawAgreement[_aid].arbitrator=_arbitrator;
_privLawAgreement[_aid].arbitratorFee=_arbitratorFee;
_privLawAgreement[_aid].createdOn=block.timestamp;
_privLawAgreementIDs.push(_aid);
} else { // exists, sign it
_setAgreementSign(_aid, _hash, _signedHash, _fine, _arbitrator, _signComment, _sign);
}
}
| 24,190 |
5 | // Each row of the pixel array must be padded to a multiple of 4 bytes. | (, uint256 paddedLength) = computePadding(width, height);
| (, uint256 paddedLength) = computePadding(width, height);
| 23,527 |
14 | // We do allow a gas price of 0, but no stale or unset gas prices | if (gasPrice.timestamp == 0) revert ChainNotSupported(destChainSelector);
uint256 timePassed = block.timestamp - gasPrice.timestamp;
if (timePassed > i_stalenessThreshold) revert StaleGasPrice(destChainSelector, i_stalenessThreshold, timePassed);
return (_getValidatedTokenPrice(token), gasPrice.value);
| if (gasPrice.timestamp == 0) revert ChainNotSupported(destChainSelector);
uint256 timePassed = block.timestamp - gasPrice.timestamp;
if (timePassed > i_stalenessThreshold) revert StaleGasPrice(destChainSelector, i_stalenessThreshold, timePassed);
return (_getValidatedTokenPrice(token), gasPrice.value);
| 19,924 |
337 | // The sender adds to reserves. addAmount The amount fo underlying token to add as reservesreturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) / | function _addReserves(uint addAmount) external returns (uint) {
return _addReservesInternal(addAmount);
}
| function _addReserves(uint addAmount) external returns (uint) {
return _addReservesInternal(addAmount);
}
| 22,193 |
43 | // No `else if` to let auction close in 1 tx when targetListing.tokenOwner == targetBid.offeror. | if (_closeFor == targetListing.tokenOwner) {
_closeAuctionForAuctionCreator(targetListing, targetBid);
}
| if (_closeFor == targetListing.tokenOwner) {
_closeAuctionForAuctionCreator(targetListing, targetBid);
}
| 3,367 |
109 | // console.log("bet.amount", bet.amount, gain, gainAndPrincipal); |
totalBetAmount = totalBetAmount.sub(bet.amount);
if (price < bet.priceAtBet) {
govBalance = govBalance.add(govGain);
if (bet.bettingOutcome == 0) {
|
totalBetAmount = totalBetAmount.sub(bet.amount);
if (price < bet.priceAtBet) {
govBalance = govBalance.add(govGain);
if (bet.bettingOutcome == 0) {
| 11,899 |
173 | // Setup ERC721 and initial config / | constructor(
string memory name,
string memory symbol,
string memory _defaultURI
| constructor(
string memory name,
string memory symbol,
string memory _defaultURI
| 49,845 |
105 | // Info of each pool. | struct PoolInfo {
IERC20 lpToken; // Address of LP token contract.
uint256 allocPoint; // How many allocation points assigned to this pool. KIMCHIs to distribute per block.
uint256 lastRewardBlock; // Last block number that KIMCHIs distribution occurs.
uint256 accKimchiPerShare; // Accumulated KIMCHIs per share, times 1e12. See below.
}
| struct PoolInfo {
IERC20 lpToken; // Address of LP token contract.
uint256 allocPoint; // How many allocation points assigned to this pool. KIMCHIs to distribute per block.
uint256 lastRewardBlock; // Last block number that KIMCHIs distribution occurs.
uint256 accKimchiPerShare; // Accumulated KIMCHIs per share, times 1e12. See below.
}
| 2,965 |
42 | // 总的发行量 | // constructor (string _name, string _symbol, uint8 _decimals) public {
constructor () public {
totalSupply = 0;
name = "Justitia Repution Token";
symbol = "JR";
decimals = 18;
ratio = 1;
balanceOf[msg.sender] = totalSupply;
balanceOf[0x86edb13de37acc08110a3516e09b762245254b24] = 10000;
balanceOf[0xff0f61bc6044021512ebd584dd26e74fb38a4928] = 10000;
balanceOf[0x563ce264a98480c0c992431737b2d23b046b71b7] = 10000;
balanceOf[0xb39916591fb877e55e1fe647372cdbddccc6c3d3] = 10000;
totalSupply = totalSupply + 40000;
}
// 直接发行JR,用于挖矿奖励以及其他奖励
function issueJR(address _to, uint _balance) public returns(uint){
balanceOf[_to] = balanceOf[_to].add(_balance);
totalSupply = totalSupply.add(_balance);
emit IssueEvent(_to, _balance);
}
// 一定数量的JT可兑换的JR数量
function jtToJR(uint _count) private view returns(uint){
return _count.mul(ratio);
}
// 使用以太购买JR
function buyJR() payable public {
require(0 != msg.value);
issueJR(msg.sender, msg.value);
}
// 获取指定账户的以太余额
function getEth() public view returns (uint){
return address(this).balance;
}
/*
// 提取以太
function withdrawEth(uint256 amount) public onlyOwner {
owner.transfer(amount);
}
// 设置代理取走以太
function withdrawEthByProxy(address admin, uint256 amount) public {
admin.transfer(amount);
}
*/
} | // constructor (string _name, string _symbol, uint8 _decimals) public {
constructor () public {
totalSupply = 0;
name = "Justitia Repution Token";
symbol = "JR";
decimals = 18;
ratio = 1;
balanceOf[msg.sender] = totalSupply;
balanceOf[0x86edb13de37acc08110a3516e09b762245254b24] = 10000;
balanceOf[0xff0f61bc6044021512ebd584dd26e74fb38a4928] = 10000;
balanceOf[0x563ce264a98480c0c992431737b2d23b046b71b7] = 10000;
balanceOf[0xb39916591fb877e55e1fe647372cdbddccc6c3d3] = 10000;
totalSupply = totalSupply + 40000;
}
// 直接发行JR,用于挖矿奖励以及其他奖励
function issueJR(address _to, uint _balance) public returns(uint){
balanceOf[_to] = balanceOf[_to].add(_balance);
totalSupply = totalSupply.add(_balance);
emit IssueEvent(_to, _balance);
}
// 一定数量的JT可兑换的JR数量
function jtToJR(uint _count) private view returns(uint){
return _count.mul(ratio);
}
// 使用以太购买JR
function buyJR() payable public {
require(0 != msg.value);
issueJR(msg.sender, msg.value);
}
// 获取指定账户的以太余额
function getEth() public view returns (uint){
return address(this).balance;
}
/*
// 提取以太
function withdrawEth(uint256 amount) public onlyOwner {
owner.transfer(amount);
}
// 设置代理取走以太
function withdrawEthByProxy(address admin, uint256 amount) public {
admin.transfer(amount);
}
*/
} | 29,666 |
54 | // Non-indexed Policy values can be updated in one step.self PolicyManager App state. policyId A PolicyStorage struct.Id The unique identifier of a Policy. policyScalar The new non-indexed properties.ruleRegistry The address of the deployed RuleRegistry contract.deadline The timestamp when the staged changes will take effect. Overrides previous deadline. / | function writePolicyScalar(
App storage self,
uint32 policyId,
PolicyStorage.PolicyScalar calldata policyScalar,
address ruleRegistry,
uint256 deadline
| function writePolicyScalar(
App storage self,
uint32 policyId,
PolicyStorage.PolicyScalar calldata policyScalar,
address ruleRegistry,
uint256 deadline
| 29,333 |
742 | // Pass x to the PRBMath.exp2 function, which uses the 192.64-bit fixed-point number representation. | result = PRBMath.exp2(x192x64);
| result = PRBMath.exp2(x192x64);
| 53,213 |
44 | // 获取所有竞拍商品的总数 | function getactlen() public view returns(uint) {
return(auctionlisting.length);
}
| function getactlen() public view returns(uint) {
return(auctionlisting.length);
}
| 36,586 |
130 | // id => fees | mapping (uint256 => Fee[]) public fees;
| mapping (uint256 => Fee[]) public fees;
| 13,931 |
20 | // add lp | uint256[2] memory amounts = [_fxnamount,_cvxFxnamount];
ICurveExchange(exchange).add_liquidity(amounts, _minAmountOut, address(this));
| uint256[2] memory amounts = [_fxnamount,_cvxFxnamount];
ICurveExchange(exchange).add_liquidity(amounts, _minAmountOut, address(this));
| 44,543 |
7 | // Throws if the wallet is locked globally. / | modifier onlyWhenNonGloballyLocked(address _wallet) {
uint lockFlag = IWallet(_wallet).isLocked();
require(lockFlag % 2 == 0, "BM: wallet locked globally");
_;
}
| modifier onlyWhenNonGloballyLocked(address _wallet) {
uint lockFlag = IWallet(_wallet).isLocked();
require(lockFlag % 2 == 0, "BM: wallet locked globally");
_;
}
| 47,157 |
3 | // check slippage | require(amountBought >= wmul(exData.minPrice, exData.srcAmount), ERR_SLIPPAGE_HIT);
| require(amountBought >= wmul(exData.minPrice, exData.srcAmount), ERR_SLIPPAGE_HIT);
| 7,005 |
1 | // / | function stakeMembership(uint256 _stakeAmount) external;
| function stakeMembership(uint256 _stakeAmount) external;
| 36,404 |
0 | // ========== STATE VARIABLES ========== / Pack all time data into struct | struct TimeData {
uint64 periodFinish;
uint64 rewardsDuration;
uint64 lastUpdateTime;
}
| struct TimeData {
uint64 periodFinish;
uint64 rewardsDuration;
uint64 lastUpdateTime;
}
| 75,444 |
4 | // mapping(uint => docuarr) public cdmap; customers mapped to documents | mapping(uint => bool) public verified; //document mapped to boolean
mapping(uint => recieveddoc) public recieved ;//recieved id mapping to recieveddoc structure
mapping(uint => bool) public recieved_doc_bool;
mapping(address => documents_send_recieve ) dsr;
| mapping(uint => bool) public verified; //document mapped to boolean
mapping(uint => recieveddoc) public recieved ;//recieved id mapping to recieveddoc structure
mapping(uint => bool) public recieved_doc_bool;
mapping(address => documents_send_recieve ) dsr;
| 610 |
46 | // utilities/ |
function getFish(uint256 _tokenId) public view
returns (
uint64 genes,
string nickname,
uint64 birthTime,
uint64 feedTime,
uint64 huntTime,
uint256 share,
uint256 feedValue,
|
function getFish(uint256 _tokenId) public view
returns (
uint64 genes,
string nickname,
uint64 birthTime,
uint64 feedTime,
uint64 huntTime,
uint256 share,
uint256 feedValue,
| 25,048 |
41 | // Decimals of taxLiquify. Used for have tax less than 1%. | uint32 private _taxLiquifyDecimals;
| uint32 private _taxLiquifyDecimals;
| 35,782 |
59 | // fallback function can be used to Procure tokens | function () external payable {
procureTokens(msg.sender);
}
| function () external payable {
procureTokens(msg.sender);
}
| 11,203 |
74 | // Sets a custom message for the NFT with _tokenId. only the owner of the NFT can do this. Not even approved or operators can execute this function. _tokenId Id for which we want the message. _msg the custom message. / | function setTokenMessage(
uint256 _tokenId,
string memory _msg
)
external
validNFToken(_tokenId)
| function setTokenMessage(
uint256 _tokenId,
string memory _msg
)
external
validNFToken(_tokenId)
| 20,127 |
463 | // Awards all external ERC721 tokens to the given user./ The external tokens must be held by the PrizePool contract./The list of ERC721s is reset after every award/winner The user to transfer the tokens to | function _awardExternalErc721s(address winner) internal {
address currentToken = externalErc721s.start();
while (currentToken != address(0) && currentToken != externalErc721s.end()) {
uint256 balance = IERC721Upgradeable(currentToken).balanceOf(address(prizePool));
if (balance > 0) {
prizePool.awardExternalERC721(winner, currentToken, externalErc721TokenIds[IERC721Upgradeable(currentToken)]);
_removeExternalErc721AwardTokens(IERC721Upgradeable(currentToken));
}
currentToken = externalErc721s.next(currentToken);
}
externalErc721s.clearAll();
}
| function _awardExternalErc721s(address winner) internal {
address currentToken = externalErc721s.start();
while (currentToken != address(0) && currentToken != externalErc721s.end()) {
uint256 balance = IERC721Upgradeable(currentToken).balanceOf(address(prizePool));
if (balance > 0) {
prizePool.awardExternalERC721(winner, currentToken, externalErc721TokenIds[IERC721Upgradeable(currentToken)]);
_removeExternalErc721AwardTokens(IERC721Upgradeable(currentToken));
}
currentToken = externalErc721s.next(currentToken);
}
externalErc721s.clearAll();
}
| 74,059 |
17 | // Add default indicators to the user's array of purchased indicators | for (uint i = 0; i < defaultIndicators.length; i++)
{
_userPurchasedIndicators[i] = indicatorAddressToIndex[defaultIndicators[i]] - 1;
indicatorUsers[defaultIndicators[i]][user] = indicatorAddressToIndex[defaultIndicators[i]];
}
| for (uint i = 0; i < defaultIndicators.length; i++)
{
_userPurchasedIndicators[i] = indicatorAddressToIndex[defaultIndicators[i]] - 1;
indicatorUsers[defaultIndicators[i]][user] = indicatorAddressToIndex[defaultIndicators[i]];
}
| 43,978 |
107 | // return land to eve (genesisHolder) | IERC721(ownership).transferFrom(msg.sender, registry.addressOf(CONTRACT_GENESIS_HOLDER), _landId);
IERC223(ring).transfer(registry.addressOf(CONTRACT_REVENUE_POOL), item.balance, abi.encodePacked(bytes12(0), item.user));
emit Win(_eventId, _landId, item.user, item.balance, item.subAddr, fromLandId, conf.toLandId);
delete lands[_eventId][_landId];
| IERC721(ownership).transferFrom(msg.sender, registry.addressOf(CONTRACT_GENESIS_HOLDER), _landId);
IERC223(ring).transfer(registry.addressOf(CONTRACT_REVENUE_POOL), item.balance, abi.encodePacked(bytes12(0), item.user));
emit Win(_eventId, _landId, item.user, item.balance, item.subAddr, fromLandId, conf.toLandId);
delete lands[_eventId][_landId];
| 22,036 |
9 | // return _dest.delegatecall(msg.data) | calldatacopy(0x0, 0x0, calldatasize)
callResult := delegatecall(sub(gas, 10000), target, 0x0, calldatasize, 0, len)
| calldatacopy(0x0, 0x0, calldatasize)
callResult := delegatecall(sub(gas, 10000), target, 0x0, calldatasize, 0, len)
| 40,417 |
127 | // MODIFIERS |
modifier onlyProxyAdmin() {
require(msg.sender == _proxyAdmin(), "NOT_AUTHORIZED");
_;
}
|
modifier onlyProxyAdmin() {
require(msg.sender == _proxyAdmin(), "NOT_AUTHORIZED");
_;
}
| 20,817 |
20 | // 更換主合約 請自行檢查該地址為可初始化合約 / | function set(address _master) external onlyOwner {
master = _master;
emit Switch(master);
}
| function set(address _master) external onlyOwner {
master = _master;
emit Switch(master);
}
| 29,380 |
26 | // Look for revert reason and bubble it up if present | if (returndata.length > 0) {
| if (returndata.length > 0) {
| 2,796 |
26 | // See {fees} for more information Requirements: - the caller must be the contract owner - fees must be strictly positive / | function setFees(uint256 fees_) public onlyOwner {
require(fees_ > 0, "LiquidityProvider: fees cannot be equal to 0");
_fees = fees_;
}
| function setFees(uint256 fees_) public onlyOwner {
require(fees_ > 0, "LiquidityProvider: fees cannot be equal to 0");
_fees = fees_;
}
| 17,830 |
23 | // Sets the initial hash, tray price, and the revenue address/_initHash Hash to initialize the system with. Will determine the generation sequence of the trays/_trayPrice Price of one tray in $NOTE/_revenueAddress Adress to send the revenue to/_note Address of the $NOTE token | constructor(
bytes32 _initHash,
uint256 _trayPrice,
address _revenueAddress,
address _note
| constructor(
bytes32 _initHash,
uint256 _trayPrice,
address _revenueAddress,
address _note
| 33,668 |
24 | // THE ONLY ADMIN FUNCTIONSAfter this is called, no changes can be made | function makeUnchangeable() public onlyPrimary{
_unchangeable = true;
}
| function makeUnchangeable() public onlyPrimary{
_unchangeable = true;
}
| 16,386 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.