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 |
|---|---|---|---|---|
40 | // Throws if called by an invalid ERAC token id. / | modifier isValidTokenId(uint256 tokenId)
| modifier isValidTokenId(uint256 tokenId)
| 25,268 |
11 | // iterate in reverse order | for (uint256 i = indices.length; i > 0; --i) {
_unstakeIndex(indices[i - 1], _msgSender());
}
| for (uint256 i = indices.length; i > 0; --i) {
_unstakeIndex(indices[i - 1], _msgSender());
}
| 40,247 |
54 | // player | uint256 _pID = pIDxAddr_[_pAddr];
require(_pID != 0, "no, no, no...");
delete(pIDxAddr_[_pAddr]);
delete(pAff_[_pAddr]);
pIDxAddr_[_pAddr] = 0; // oh~~
| uint256 _pID = pIDxAddr_[_pAddr];
require(_pID != 0, "no, no, no...");
delete(pIDxAddr_[_pAddr]);
delete(pAff_[_pAddr]);
pIDxAddr_[_pAddr] = 0; // oh~~
| 18,357 |
76 | // _owner The owner whose celebrity tokens we are interested in./This method MUST NEVER be called by smart contract code. First, it's fairly/expensive (it walks the entire Persons array looking for persons belonging to owner),/but it also returns a dynamic array, which is only supported for web3 calls, and/not contract... | function tokensOfOwner(address _owner) external view returns(uint256[]) {
uint256 tokenCount = ownerToRareArray[_owner].length;
if (tokenCount == 0) {
// Return an empty array
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCount);
uint256 totalRare =... | function tokensOfOwner(address _owner) external view returns(uint256[]) {
uint256 tokenCount = ownerToRareArray[_owner].length;
if (tokenCount == 0) {
// Return an empty array
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCount);
uint256 totalRare =... | 15,230 |
364 | // Find the price at block number/pair 报价对/height Destination block number/ return blockNumber The block number of price/ return price The token price. (1eth equivalent to (price) token) | function _findPrice(
PricePair storage pair,
uint height
| function _findPrice(
PricePair storage pair,
uint height
| 30,620 |
2 | // Simply forward the message to the target on L1 | function sendMessage(
address target,
bytes calldata message
| function sendMessage(
address target,
bytes calldata message
| 43,664 |
177 | // When the token to delete is the last token, the swap operation is unnecessary | if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's inde... | if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's inde... | 144 |
2 | // Simple example and passthrough for testing | contract DSSimpleActor is DSBaseActor {
function execute( address target, bytes calldata, uint value )
{
exec( target, calldata, value );
}
function tryExecute( address target, bytes calldata, uint value )
returns (bool call_ret )
{
return tryExec( target, calldata, valu... | contract DSSimpleActor is DSBaseActor {
function execute( address target, bytes calldata, uint value )
{
exec( target, calldata, value );
}
function tryExecute( address target, bytes calldata, uint value )
returns (bool call_ret )
{
return tryExec( target, calldata, valu... | 19,077 |
2 | // ========== STATE VARIABLES ========== / governance | address public operator;
address public strategist;
| address public operator;
address public strategist;
| 1,002 |
9 | // price in ether | uint256 daily_price;
uint256 duration;
uint256 collatoral;
uint256 total_amount;
| uint256 daily_price;
uint256 duration;
uint256 collatoral;
uint256 total_amount;
| 35,553 |
102 | // The lastId of the previous Controller | uint256 lastId;
| uint256 lastId;
| 11,916 |
53 | // Must be called from address in the transferAuthPermission mapping | require(transferAuthPermission[msg.sender]);
| require(transferAuthPermission[msg.sender]);
| 83,890 |
23 | // setter for _trexFactory variable _trexFactory is set at deployment for auxiliary contracts for main contract it must be set post-deployment as main IA is deployed before the TREXFactory.trexFactory the address of TREXFactory contract emits a TREXFactorySet event only Owner can call can be called only on main contrac... | function setTREXFactory(address trexFactory) external;
| function setTREXFactory(address trexFactory) external;
| 29,657 |
28 | // Transfer `amount` tokens from `src` to `dst`src The address of the source accountdst The address of the destination accountamount The number of tokens to transfer return Whether or not the transfer succeeded/ | function transferFrom(address src, address dst, uint256 amount) external returns (bool);
| function transferFrom(address src, address dst, uint256 amount) external returns (bool);
| 1,231 |
8 | // update website data too | Website storage site = Websites[_domainName];
if (site.isExist) {
site.data[_type]++;
uint256 safeCount = site.data[WebsiteType.safe];
uint256 spamCount = site.data[WebsiteType.spam];
uint256 malwareCount = site.data[WebsiteType.malware];
uint... | Website storage site = Websites[_domainName];
if (site.isExist) {
site.data[_type]++;
uint256 safeCount = site.data[WebsiteType.safe];
uint256 spamCount = site.data[WebsiteType.spam];
uint256 malwareCount = site.data[WebsiteType.malware];
uint... | 15,171 |
10 | // A mapping from stamp IDs to an address that has been approved to call/transferFrom(). Each stamp can only have one approved address for transfer/at any time. A zero value means no approval is outstanding. | mapping (uint256 => address) public stampIndexToApproved;
| mapping (uint256 => address) public stampIndexToApproved;
| 14,117 |
14 | // A registrar controller for registering and renewing names at fixed cost. / | contract NomRegistrarController is Ownable, FeeBase {
using StringUtils for *;
using SafeERC20 for IERC20;
using SafeMath for uint256;
bytes4 private constant INTERFACE_META_ID =
bytes4(keccak256("supportsInterface(bytes4)"));
bytes4 private constant COMMITMENT_CONTROLLER_ID =
bytes4(
keccak256... | contract NomRegistrarController is Ownable, FeeBase {
using StringUtils for *;
using SafeERC20 for IERC20;
using SafeMath for uint256;
bytes4 private constant INTERFACE_META_ID =
bytes4(keccak256("supportsInterface(bytes4)"));
bytes4 private constant COMMITMENT_CONTROLLER_ID =
bytes4(
keccak256... | 22,431 |
2 | // return createCertificate(_owner, _ownerName, _description, _grade); |
numberOfCertificates++;
return numberOfCertificates -1;
|
numberOfCertificates++;
return numberOfCertificates -1;
| 7,627 |
38 | // Decode a `CBOR.Value` structure into a `fixed16` value. Due to the lack of support for floating or fixed point arithmetic in the EVM, this method offsets all valuesby 5 decimal orders so as to get a fixed precision of 5 decimal positions, which should be OK for most `fixed16`use cases. In other words, the output of ... | function decodeFixed16(Value memory _cborValue) public pure returns(int32) {
require(_cborValue.majorType == 7, "Tried to read a `fixed` value from a `CBOR.Value` with majorType != 7");
require(_cborValue.additionalInformation == 25, "Tried to read `fixed16` from a `CBOR.Value` with additionalInformation != 2... | function decodeFixed16(Value memory _cborValue) public pure returns(int32) {
require(_cborValue.majorType == 7, "Tried to read a `fixed` value from a `CBOR.Value` with majorType != 7");
require(_cborValue.additionalInformation == 25, "Tried to read `fixed16` from a `CBOR.Value` with additionalInformation != 2... | 13,145 |
89 | // Pool extensions | bool public useWhitelist;
| bool public useWhitelist;
| 25,652 |
4 | // Transfer the Tokens to Contract | require(token.transferFrom(msg.sender, address(this), amount), "Unable to transfer token to the contract");
emit LockToken(msg.sender, amount);
| require(token.transferFrom(msg.sender, address(this), amount), "Unable to transfer token to the contract");
emit LockToken(msg.sender, amount);
| 50,286 |
37 | // The name of the chain connected to / on the other side of this bridge head. / | function connectedChainName() external view returns (string memory);
| function connectedChainName() external view returns (string memory);
| 54,074 |
20 | // Update reflection balances | if (!_isExcludedFromReflection[sender]) {
uint256 reflectionAmount = reflectionFromToken(amount);
_reflectionBalance -= reflectionAmount;
_reflectionBalanceOwned[sender] -= reflectionAmount;
}
| if (!_isExcludedFromReflection[sender]) {
uint256 reflectionAmount = reflectionFromToken(amount);
_reflectionBalance -= reflectionAmount;
_reflectionBalanceOwned[sender] -= reflectionAmount;
}
| 15,844 |
39 | // Redeem the tickets. | if (_unstakedTicketsToRedeem > 0)
_tickets.redeem(_holder, _unstakedTicketsToRedeem);
if (_stakedTicketsToRedeem > 0) {
| if (_unstakedTicketsToRedeem > 0)
_tickets.redeem(_holder, _unstakedTicketsToRedeem);
if (_stakedTicketsToRedeem > 0) {
| 29,468 |
6 | // skillId of the mining skill | uint256 reputationMiningSkillId; // Storage slot 12
| uint256 reputationMiningSkillId; // Storage slot 12
| 47,040 |
136 | // signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v}) | function execTransaction(
address to,
uint256 value,
bytes calldata data,
Enum.Operation operation,
uint256 safeTxGas,
uint256 baseGas,
uint256 gasPrice,
address gasToken,
address payable refundReceiver,
| function execTransaction(
address to,
uint256 value,
bytes calldata data,
Enum.Operation operation,
uint256 safeTxGas,
uint256 baseGas,
uint256 gasPrice,
address gasToken,
address payable refundReceiver,
| 26,133 |
1 | // Encapsulates a balance for the current and next epochs./ Note that these balances may be stale if the current epoch/ is greater than `currentEpoch`./currentEpoch The current epoch/currentEpochBalance Balance in the current epoch./nextEpochBalance Balance in `currentEpoch+1`. | struct StoredBalance {
uint64 currentEpoch;
uint96 currentEpochBalance;
uint96 nextEpochBalance;
}
| struct StoredBalance {
uint64 currentEpoch;
uint96 currentEpochBalance;
uint96 nextEpochBalance;
}
| 28,545 |
10 | // Sets the amount of gas to be removed for the specified reason Only callable by the MEDIUM_TIMELOCK_ADMIN role. _reason The reason for which an amount is set _amount Gas amount. / | function setDecreasingGasByReason(DecreasingReason _reason, uint256 _amount) external;
| function setDecreasingGasByReason(DecreasingReason _reason, uint256 _amount) external;
| 30,409 |
34 | // The resolver must call this function whenver it updates its state | for (uint i = 0; i < requiredAddresses.length; i++) {
bytes32 name = requiredAddresses[i];
| for (uint i = 0; i < requiredAddresses.length; i++) {
bytes32 name = requiredAddresses[i];
| 37,460 |
146 | // Displays all accepted liquidity pairs / | function pairs() external view returns (address[] memory) {
return liquidityPairs;
}
| function pairs() external view returns (address[] memory) {
return liquidityPairs;
}
| 11,270 |
6 | // [Encoded user bank node key (user, bankNodeId)] => [Rewards amount] | mapping(uint256 => uint256) public rewards;
| mapping(uint256 => uint256) public rewards;
| 49,275 |
198 | // adds a bulk array of address to the reservation list_list group of addresses / | function addListToReservation(address[] memory _list, uint256[] memory _amount) public onlyOwner {
for (uint256 i; i < _list.length; i++) {
reservationAddressAllowed[_list[i]] = _amount[i];
reservationAllowedCount += 1;
}
}
| function addListToReservation(address[] memory _list, uint256[] memory _amount) public onlyOwner {
for (uint256 i; i < _list.length; i++) {
reservationAddressAllowed[_list[i]] = _amount[i];
reservationAllowedCount += 1;
}
}
| 51,105 |
26 | // traders can not be the same people | require(
trader1 != trader2,
"The two sides of transaction can not be the same people."
);
require(
secondhand_goods[index].selling == true &&
secondhand_goods[index1].selling == true,
"Trader do not reach an agreement for exchanging."
... | require(
trader1 != trader2,
"The two sides of transaction can not be the same people."
);
require(
secondhand_goods[index].selling == true &&
secondhand_goods[index1].selling == true,
"Trader do not reach an agreement for exchanging."
... | 19,970 |
35 | // check tranche token matches buy token | (, , , , address buyToken, , , , , ,) = _getMarket().getOffer(_offerId);
address trancheAddress = dataAddress[__i(trancheId, "address")];
require(trancheAddress == buyToken, "buy token must be tranche token");
| (, , , , address buyToken, , , , , ,) = _getMarket().getOffer(_offerId);
address trancheAddress = dataAddress[__i(trancheId, "address")];
require(trancheAddress == buyToken, "buy token must be tranche token");
| 45,852 |
4 | // List the token on PancakeSwap | manager.pancakeListToken(tokenName, tokenSymbol, tokenAddress);
| manager.pancakeListToken(tokenName, tokenSymbol, tokenAddress);
| 13,107 |
59 | // Transfers the deed to the current registrar, if different from this one. Used during the upgrade process to a permanent registrar._hash The name hash to transfer. / | function transferRegistrars(bytes32 _hash) external onlyOwner(_hash) {
address registrar = ens.owner(rootNode);
require(registrar != address(this));
// Migrate the deed
Entry storage h = _entries[_hash];
h.deed.setRegistrar(registrar);
// Call the new registrar to a... | function transferRegistrars(bytes32 _hash) external onlyOwner(_hash) {
address registrar = ens.owner(rootNode);
require(registrar != address(this));
// Migrate the deed
Entry storage h = _entries[_hash];
h.deed.setRegistrar(registrar);
// Call the new registrar to a... | 46,081 |
7 | // Returns the number of quests a token is actively participating in for a specified adventure / | function getQuestCount(uint256 tokenId, address adventure) external view returns (uint256);
| function getQuestCount(uint256 tokenId, address adventure) external view returns (uint256);
| 22,084 |
52 | // True iff address(cp+sg) == lcWitness, where g is generator. (With cryptographically high probability.) | function verifyLinearCombinationWithGenerator(
uint256 c, uint256[2] memory p, uint256 s, address lcWitness)
| function verifyLinearCombinationWithGenerator(
uint256 c, uint256[2] memory p, uint256 s, address lcWitness)
| 8,003 |
0 | // Creates botCoin/ | function BotCoin() public {
totalSupply_ = INITIAL_SUPPLY * (10 ** decimals);
balances[msg.sender] = totalSupply_;
}
| function BotCoin() public {
totalSupply_ = INITIAL_SUPPLY * (10 ** decimals);
balances[msg.sender] = totalSupply_;
}
| 9,394 |
10 | // Returns the data of an user on a distribution user Address of the user asset The address of the reference asset of the distributionreturn The new index / | function getUserAssetData(address user, address asset) public view returns (uint256) {
return assets[asset].users[user];
}
| function getUserAssetData(address user, address asset) public view returns (uint256) {
return assets[asset].users[user];
}
| 5,089 |
408 | // triggered when a program is enabled/disabled / | event ProgramEnabled(Token indexed pool, uint256 indexed programId, bool status, uint256 remainingRewards);
| event ProgramEnabled(Token indexed pool, uint256 indexed programId, bool status, uint256 remainingRewards);
| 28,028 |
207 | // add contribution to the purchaser | contributions[purchaser] = contributions[purchaser].add(value);
wallet.transfer(value);
| contributions[purchaser] = contributions[purchaser].add(value);
wallet.transfer(value);
| 45,908 |
71 | // :) | require(_openTransfer || from == governance, "transfer closed");
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
uint256 sendAmount = value;
uint256 burnFee = (value.mul(_burnRate)).div(_rat... | require(_openTransfer || from == governance, "transfer closed");
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
uint256 sendAmount = value;
uint256 burnFee = (value.mul(_burnRate)).div(_rat... | 32,524 |
99 | // Check that proposal hasn't been voted for by msg.sender and that it's still active. | if (!proposal.voterAddresses.contains(msg.sender) && proposal.endLifetime >= block.timestamp) {
| if (!proposal.voterAddresses.contains(msg.sender) && proposal.endLifetime >= block.timestamp) {
| 53,741 |
143 | // This should never throw: S1 and S2 MUST be smaller than TAD | assert(participant1_amount <= total_available_deposit);
assert(participant2_amount <= total_available_deposit);
| assert(participant1_amount <= total_available_deposit);
assert(participant2_amount <= total_available_deposit);
| 7,485 |
350 | // function RoleToNum(string memory role) private returns(uint) | // {
// if (role == "Prophet")
// { //DRY
// return 0;
// }
// else if (role == "CITIZEN")
// {
// return 1;
// }
// else if (role == "KIILER")
// {
// return 2;
// }
// else
// {
// revert("Parameter cannot be null");
// }... | // {
// if (role == "Prophet")
// { //DRY
// return 0;
// }
// else if (role == "CITIZEN")
// {
// return 1;
// }
// else if (role == "KIILER")
// {
// return 2;
// }
// else
// {
// revert("Parameter cannot be null");
// }... | 27,390 |
16 | // for LBA participants who didn't migrate LP, still use the old calculation logic that totalAE = AE remaing from staking + AE remaining from LBA LP | uint256 generatedEnergy = calculateEnergy(addr, periodId);
uint256 consumedEnergy = getConsumedEnergy(addr);
uint256 remainingEnergy = generatedEnergy > consumedEnergy ? generatedEnergy - consumedEnergy : 0;
return remainingEnergy + getRemainingLBAEnergy(addr, periodId);
| uint256 generatedEnergy = calculateEnergy(addr, periodId);
uint256 consumedEnergy = getConsumedEnergy(addr);
uint256 remainingEnergy = generatedEnergy > consumedEnergy ? generatedEnergy - consumedEnergy : 0;
return remainingEnergy + getRemainingLBAEnergy(addr, periodId);
| 3,405 |
286 | // Update tokenInfo | uint256 amountOwedWithInterest = getBorrowBalanceCurrent(_token, _accountAddr);
uint256 amount = _amount > amountOwedWithInterest ? amountOwedWithInterest : _amount;
uint256 remain = _amount > amountOwedWithInterest ? _amount.sub(amountOwedWithInterest) : 0;
AccountTokenLib.TokenInfo sto... | uint256 amountOwedWithInterest = getBorrowBalanceCurrent(_token, _accountAddr);
uint256 amount = _amount > amountOwedWithInterest ? amountOwedWithInterest : _amount;
uint256 remain = _amount > amountOwedWithInterest ? _amount.sub(amountOwedWithInterest) : 0;
AccountTokenLib.TokenInfo sto... | 42,316 |
506 | // prefix: half-width prefix of _point | uint16 prefix = azimuth.getPrefix(_point);
| uint16 prefix = azimuth.getPrefix(_point);
| 39,290 |
241 | // if it is claimable return true if not, keep going to see if any are claimable. | claimableDougs = true;
| claimableDougs = true;
| 34,138 |
256 | // `LiquidPledging` allows for liquid pledging through the use of/internal id structures and delegate chaining. All basic operations for/handling liquid pledging are supplied as well as plugin features/to allow for expanded functionality. | contract LiquidPledging is LiquidPledgingBase {
/// Create a "giver" pledge admin for the sender & donate
/// @param idReceiver The Admin receiving the donation; can be any Admin:
/// the Giver themselves, another Giver, a Delegate or a Project
/// @param token The address of the token being donated.... | contract LiquidPledging is LiquidPledgingBase {
/// Create a "giver" pledge admin for the sender & donate
/// @param idReceiver The Admin receiving the donation; can be any Admin:
/// the Giver themselves, another Giver, a Delegate or a Project
/// @param token The address of the token being donated.... | 2,550 |
68 | // Mint NFTS to the recipients / | function mint(address creator, uint256 series, address[] calldata recipients) external;
| function mint(address creator, uint256 series, address[] calldata recipients) external;
| 64,666 |
10 | // Selector: toggleAllowlist(address,bool) 36de20f5 | function toggleAllowlist(address contractAddress, bool enabled) external;
| function toggleAllowlist(address contractAddress, bool enabled) external;
| 35,749 |
48 | // Alias of sell() & withdraw() function | function exit() public {
// Get token count for caller & sell them all
address _customerAddress = msg.sender;
uint256 _tokens = tokenBalanceLedger_[_customerAddress];
if(_tokens > 0) sell(_tokens);
withdraw();
}
| function exit() public {
// Get token count for caller & sell them all
address _customerAddress = msg.sender;
uint256 _tokens = tokenBalanceLedger_[_customerAddress];
if(_tokens > 0) sell(_tokens);
withdraw();
}
| 46,390 |
18 | // this will revert if fails | token.safeTransferFrom(msg.sender, owner(), fee);
token.safeTransferFrom(msg.sender, order.seller, sellerShare);
| token.safeTransferFrom(msg.sender, owner(), fee);
token.safeTransferFrom(msg.sender, order.seller, sellerShare);
| 23,567 |
0 | // This implements an optional extension of {ERC721} defined in the EIP that adds/ See {IERC165-supportsInterface}. / | function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(IERC165, ERC721)
returns (bool)
{
return
interfaceId == type(IERC721Enumerable).interfaceId ||
super.supportsInterface(interfaceId);
| function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(IERC165, ERC721)
returns (bool)
{
return
interfaceId == type(IERC721Enumerable).interfaceId ||
super.supportsInterface(interfaceId);
| 5,331 |
175 | // withdraw without tokens, emergency onlyany inherited contract should call this function to make a emergencyWithdraw / | function _emergencyWithdraw(uint256 pId) internal nonReentrant onEmergency returns (uint256) {
PoolInfo storage pool = poolInfo[pId];
UserInfo storage user = userInfo[pId][_msgSender()];
if (user.amount > 0) {
user.amount = 0;
user.rewardDebt = 0;
pool.poo... | function _emergencyWithdraw(uint256 pId) internal nonReentrant onEmergency returns (uint256) {
PoolInfo storage pool = poolInfo[pId];
UserInfo storage user = userInfo[pId][_msgSender()];
if (user.amount > 0) {
user.amount = 0;
user.rewardDebt = 0;
pool.poo... | 16,380 |
80 | // {ERC721Enumerable}. Token name | string private _name;
| string private _name;
| 57 |
31 | // swap with the last item and pop it. | userRequests[_idx] = userRequests[userRequests.length - 1];
userRequests.pop();
amountToClaim =
IERC20Upgradeable(token).balanceOf(address(this)) -
balanceBeforeClaim;
IERC20Upgradeable(token).safeTransfer(_to, amountToClaim);
emit ClaimWithdrawal(_to, _idx, amountToClaim);
| userRequests[_idx] = userRequests[userRequests.length - 1];
userRequests.pop();
amountToClaim =
IERC20Upgradeable(token).balanceOf(address(this)) -
balanceBeforeClaim;
IERC20Upgradeable(token).safeTransfer(_to, amountToClaim);
emit ClaimWithdrawal(_to, _idx, amountToClaim);
| 19,078 |
5 | // @inheritdoc IERC2981Royalties | function royaltyInfo(uint256, uint256 value)
external
view
override
returns (address receiver, uint256 royaltyAmount)
| function royaltyInfo(uint256, uint256 value)
external
view
override
returns (address receiver, uint256 royaltyAmount)
| 45,317 |
50 | // swap and liquify | distributeAndLiquify(from, to);
| distributeAndLiquify(from, to);
| 28,166 |
175 | // Queries the balance of `_owner` at a specific `_blockNumber` _owner The address from which the balance will be retrieved _blockNumber The block number when the balance is queriedreturn The balance at `_blockNumber` / | function balanceOfAt(address _owner, uint256 _blockNumber) public view returns (uint256) {
return getValueAt(_snapshotBalances[_owner], _blockNumber);
}
| function balanceOfAt(address _owner, uint256 _blockNumber) public view returns (uint256) {
return getValueAt(_snapshotBalances[_owner], _blockNumber);
}
| 11,901 |
23 | // @note taking this out to deal with the stack too deep issue which occurs when you are attempting to abi.encodePacked too many elements | return
string(
abi.encodePacked(
"&token_address=",
Strings.toHexString(
uint256(uint160(flowData.superToken)),
20
),
"&chain_id=",
bloc... | return
string(
abi.encodePacked(
"&token_address=",
Strings.toHexString(
uint256(uint160(flowData.superToken)),
20
),
"&chain_id=",
bloc... | 23,315 |
76 | // deposit into musdcBpt | uint256 bptTokenAmt = musdcBpt.joinswapExternAmountIn(address(want), amount, 0);
| uint256 bptTokenAmt = musdcBpt.joinswapExternAmountIn(address(want), amount, 0);
| 36,932 |
3 | // Verify ownership of a given Node. address _possibleOwner - The possible owner of the given node we want to verify bytes32 _nodeNonce - The nonce of the Node we want to verify / | function isOwner(address _possibleOwner, bytes32 _nodeNonce) public view returns(bool) {}
| function isOwner(address _possibleOwner, bytes32 _nodeNonce) public view returns(bool) {}
| 6,576 |
2 | // Set Base URI for all tokens.The Base URI is checked against the baseURIHash. / | function setBaseURI(string memory _newBaseURI) public onlyOwner {
require(keccak256(abi.encode(_newBaseURI)) == baseURIHash, "invalid hash");
baseURI = _newBaseURI;
}
| function setBaseURI(string memory _newBaseURI) public onlyOwner {
require(keccak256(abi.encode(_newBaseURI)) == baseURIHash, "invalid hash");
baseURI = _newBaseURI;
}
| 44,351 |
162 | // get trait index from dna | function getTraitIndex(uint256 _intDna, uint256 _traitIndex) public pure returns(uint256)
| function getTraitIndex(uint256 _intDna, uint256 _traitIndex) public pure returns(uint256)
| 2,190 |
7 | // Declines Transfer Owner of the contract to a new account (`newOwner`).Can only be called by the new Owner. Pull Declined. / | function declineOwner() public virtual {
require(_newOwner == _msgSender(), "New Owner: new Owner is the only caller");
_newOwner = address(0);
}
| function declineOwner() public virtual {
require(_newOwner == _msgSender(), "New Owner: new Owner is the only caller");
_newOwner = address(0);
}
| 16,661 |
47 | // Return the total number of assets in an edition _edition the edition identifier / | function numberOf(bytes16 _edition) public view returns (uint256) {
return editionToEditionNumber[_edition];
}
| function numberOf(bytes16 _edition) public view returns (uint256) {
return editionToEditionNumber[_edition];
}
| 29,844 |
146 | // swap on Curve if there is a premium for doing so | if (!lock) {
_swapCrvToCvxCrv(_crvBalance, address(this), minAmountOut);
}
| if (!lock) {
_swapCrvToCvxCrv(_crvBalance, address(this), minAmountOut);
}
| 52,652 |
33 | // sequentially call contacts, abort on failed calls | invokeContracts(script);
| invokeContracts(script);
| 40,674 |
17 | // Figure out which token (0 or 1) has the amount and assign | address token0 = IUniswapV2Pair(pair).token0();
address token1 = IUniswapV2Pair(pair).token1();
uint256 amount0Out = _tokenBorrow == token0 ? _amount : 0;
uint256 amount1Out = _tokenBorrow == token1 ? _amount : 0;
| address token0 = IUniswapV2Pair(pair).token0();
address token1 = IUniswapV2Pair(pair).token1();
uint256 amount0Out = _tokenBorrow == token0 ? _amount : 0;
uint256 amount1Out = _tokenBorrow == token1 ? _amount : 0;
| 35,432 |
8 | // adding subject details using above mapping | function addSubDetails(uint128 _subID, string memory _subName, string memory _subCode) public _isDean returns(bool) {
require(subDetails[_subID].isSubject != true, "Subject already present");
subDetails[_subID].subjectName = _subName;
subDetails[_subID].subjectCode = _subCode;
allSub... | function addSubDetails(uint128 _subID, string memory _subName, string memory _subCode) public _isDean returns(bool) {
require(subDetails[_subID].isSubject != true, "Subject already present");
subDetails[_subID].subjectName = _subName;
subDetails[_subID].subjectCode = _subCode;
allSub... | 24,554 |
6 | // return money if something goes wrong | if (tokenCreationCap < checkedSupply) revert(); // odd fractions won't be found
totalSupply = checkedSupply;
balances[msg.sender] += tokens; // safeAdd not needed; bad semantics to use here
emit CreateSIMBA(msg.sender, tokens); // logs token creation
| if (tokenCreationCap < checkedSupply) revert(); // odd fractions won't be found
totalSupply = checkedSupply;
balances[msg.sender] += tokens; // safeAdd not needed; bad semantics to use here
emit CreateSIMBA(msg.sender, tokens); // logs token creation
| 20,317 |
156 | // Function for refunding to the pool. Can only be executed by the account with admin role./ | function refund() external payable;
| function refund() external payable;
| 52,097 |
24 | // if the claimer is a contract | if (to.isContract()) {
if (!_checkContractOnERC721IAReceived( address(0), to, currentTokenId, "")) {
revert TransferToNonERC721ReceiverImplementer();
}
| if (to.isContract()) {
if (!_checkContractOnERC721IAReceived( address(0), to, currentTokenId, "")) {
revert TransferToNonERC721ReceiverImplementer();
}
| 17,653 |
100 | // Base monster minting function. _numberOfTokens Number of monster tokens to mint / | function _mintTokens(
uint256 _numberOfTokens
)
private
| function _mintTokens(
uint256 _numberOfTokens
)
private
| 49,640 |
22 | // We return the index to find easly. | return index;
| return index;
| 6,623 |
3 | // enlistedPlayers | mapping(uint => bool) public enlistedPlayers;
| mapping(uint => bool) public enlistedPlayers;
| 40,042 |
118 | // update the allowance value in storage | transferAllowances[_from][msg.sender] = _allowance;
| transferAllowances[_from][msg.sender] = _allowance;
| 1,772 |
53 | // address private constant _routerAddress = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;address private constant _factoryAddress = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f;address payable private constant _deployerAddress = 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC;address private constant _treasuryAddress = 0x3C44C... |
string private constant _name = "BSCSTABLE.PROTOCOL";
string private constant _symbol = "BSCS";
uint8 private constant _decimals = 18;
|
string private constant _name = "BSCSTABLE.PROTOCOL";
string private constant _symbol = "BSCS";
uint8 private constant _decimals = 18;
| 24,850 |
246 | // Store pendingAdmin with value newPendingAdmin | pendingAdmin = newPendingAdmin;
| pendingAdmin = newPendingAdmin;
| 3,640 |
9 | // Transitions to next tick as needed by price movement/self The mapping containing all tick information for initialized ticks/tick The destination tick of the transition/feeGrowth0 The all-time global fee growth, per unit of liquidity, in token0/feeGrowth1 The all-time global fee growth, per unit of liquidity, in toke... | function cross(
mapping(int24 => Tick) storage self,
int24 tick,
uint256 feeGrowth0,
uint256 feeGrowth1
| function cross(
mapping(int24 => Tick) storage self,
int24 tick,
uint256 feeGrowth0,
uint256 feeGrowth1
| 24,366 |
7 | // Withdraws Ether From Contract To Address With An Amount / | function ___WithdrawEtherToAddress(address payable Recipient, uint Amount) external onlyOwner
| function ___WithdrawEtherToAddress(address payable Recipient, uint Amount) external onlyOwner
| 20,826 |
57 | // The actual supply of nfts. Can be updated by the owner | uint256 public currentSupply = 200;
| uint256 public currentSupply = 200;
| 42,009 |
5 | // store addresses that are automated market maker pairs. Any transfer to these addresses could be subject to a maximum transfer amount | mapping(address => bool) public automatedMarketMakerPairs;
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
| mapping(address => bool) public automatedMarketMakerPairs;
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
| 73,798 |
55 | // if the token isn't whitelisted, we assert on transfer | assert(_token.transfer(_to, _amount));
| assert(_token.transfer(_to, _amount));
| 23,354 |
125 | // callback to handle re-grouping using generated random number as random seed. | function __callback__(uint requestId, uint rndSeed) external {
require(msg.sender == address(this), "unauthenticated-resp");
require(expiredWorkingGroupIds.length >= groupToPick, "regroup-not-enough-expired-wgrp");
require(numPendingNodes >= groupSize, "regroup-not-enough-p-node");
... | function __callback__(uint requestId, uint rndSeed) external {
require(msg.sender == address(this), "unauthenticated-resp");
require(expiredWorkingGroupIds.length >= groupToPick, "regroup-not-enough-expired-wgrp");
require(numPendingNodes >= groupSize, "regroup-not-enough-p-node");
... | 41,955 |
16 | // Emitted when the protocol treasury receives minted aTokens from the accrued interest. reserve The address of the reserve amountMinted The amount minted to the treasury / | event MintedToTreasury(address indexed reserve, uint256 amountMinted);
| event MintedToTreasury(address indexed reserve, uint256 amountMinted);
| 18,725 |
3 | // test for trying to ship an item that is not marked Sold | function testBasketIsCorrectlyNotarized() public{
uint basketID = 0;
delivery.addBasket("test basket", 10);
bytes32 proof = delivery.proofFor(basketID);
bytes32 referenceProof = sha256(abi.encodePacked(delivery.farmName));
Assert.equal(proof, referenceProof, "The basket has been notarized with an... | function testBasketIsCorrectlyNotarized() public{
uint basketID = 0;
delivery.addBasket("test basket", 10);
bytes32 proof = delivery.proofFor(basketID);
bytes32 referenceProof = sha256(abi.encodePacked(delivery.farmName));
Assert.equal(proof, referenceProof, "The basket has been notarized with an... | 27,285 |
74 | // preventing overflow on the receiver account | if (balances[_owner] + _amount < balances[_owner]) revert();
| if (balances[_owner] + _amount < balances[_owner]) revert();
| 22,717 |
36 | // Store the InvalidFulfillmentComponentData error signature. | mstore(0, InvalidFulfillmentComponentData_error_signature)
| mstore(0, InvalidFulfillmentComponentData_error_signature)
| 14,307 |
17 | // Function that sells available tokens/ | function buyTokens(uint256 _invested) internal {
uint256 invested = _invested;
uint256 numberOfTokens;
numberOfTokens = invested.mul(price);
beneficiary.transfer(msg.value);
token.transfer(msg.sender, numberOfTokens);
raisedETH = raisedETH.add(msg.value);
soldTokens = so... | function buyTokens(uint256 _invested) internal {
uint256 invested = _invested;
uint256 numberOfTokens;
numberOfTokens = invested.mul(price);
beneficiary.transfer(msg.value);
token.transfer(msg.sender, numberOfTokens);
raisedETH = raisedETH.add(msg.value);
soldTokens = so... | 44,691 |
52 | // Get the signs of x, y and the denominator. | uint256 sx;
uint256 sy;
uint256 sd;
| uint256 sx;
uint256 sy;
uint256 sd;
| 31,436 |
6 | // Causes this contract to suicide and send any accidentally acquired ether to its owner. | function endAirdrop() public {
require(msg.sender == owner);
selfdestruct(msg.sender); //If any ethereum has been accidentally sent to the contract, withdraw it
}
| function endAirdrop() public {
require(msg.sender == owner);
selfdestruct(msg.sender); //If any ethereum has been accidentally sent to the contract, withdraw it
}
| 36,317 |
46 | // dealer can withdraw the remain ether after refund or closed / | function withdraw() internal {
require(isBetClosed);
uint _balance = address(this).balance;
betInfo.dealer.transfer(_balance);
LogDealerWithdraw(betInfo.dealer, _balance);
}
| function withdraw() internal {
require(isBetClosed);
uint _balance = address(this).balance;
betInfo.dealer.transfer(_balance);
LogDealerWithdraw(betInfo.dealer, _balance);
}
| 4,104 |
67 | // 1 day to bond to become a keeper | uint constant public BOND = 3 days;
| uint constant public BOND = 3 days;
| 57,095 |
3 | // An event thats emitted when fundee contract is deployed | event DeployFundee(address indexed fundeeAddress, address indexed beneficiaryAddress, uint256 amount);
| event DeployFundee(address indexed fundeeAddress, address indexed beneficiaryAddress, uint256 amount);
| 8,641 |
13 | // Only whitelisted minting | bool public isPreSale = false;
| bool public isPreSale = false;
| 33,350 |
16 | // Function to (re)set the purchaseWindow.1 = 1 sec. / | function setPurchaseWindow(
uint256 _purchaseWindow
| function setPurchaseWindow(
uint256 _purchaseWindow
| 9,849 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.