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 |
|---|---|---|---|---|
497 | // add y^20(20! / 20!) | res = res / 0x21c3677c82b40000 + y + FIXED_1;
| res = res / 0x21c3677c82b40000 + y + FIXED_1;
| 33,288 |
5 | // Official record of token balances for each account | mapping (address => uint96) internal balances;
| mapping (address => uint96) internal balances;
| 11,603 |
16 | // Owners Map | mapping(uint256 => address) public tokenOwners;
| mapping(uint256 => address) public tokenOwners;
| 32,089 |
13 | // Set the new contract URI. | _contractURI = newContractURI;
| _contractURI = newContractURI;
| 12,550 |
11 | // setters | bool public reLockProfits; // true if we choose to re-lock profits following each harvest and automatically start another epoch
bool public checkTrueHoldings; // bool to reset our profit/loss based on the amount we have if we withdrew everything at once
uint256 public slippageMax; // in bips, how much slipp... | bool public reLockProfits; // true if we choose to re-lock profits following each harvest and automatically start another epoch
bool public checkTrueHoldings; // bool to reset our profit/loss based on the amount we have if we withdrew everything at once
uint256 public slippageMax; // in bips, how much slipp... | 18,286 |
153 | // send withdrawn EVRT | uint256 tax = (what * paperHandsPenalty) / MAX_BIPS;
uint256 toSend = what - tax;
| uint256 tax = (what * paperHandsPenalty) / MAX_BIPS;
uint256 toSend = what - tax;
| 49,510 |
8 | // Refund to `recipient` when buy NFT failed or Seaport gives back remaining ether. NOTE: Caller must guarantee that the `recipient` is the expected refunding receiver. | uint256 refund = address(this).balance;
if (refund > 0) {
Address.sendValue(payable(recipient), refund);
}
| uint256 refund = address(this).balance;
if (refund > 0) {
Address.sendValue(payable(recipient), refund);
}
| 13,946 |
55 | // Sets the signature address of an edition | function setSignerAddress(uint256 _editionId, address _newSignerAddress) external onlyOwner {
require(_newSignerAddress != address(0), 'Signer address cannot be 0');
editions[_editionId].signerAddress = _newSignerAddress;
emit SignerAddressSet(_editionId, _newSignerAddress);
}
| function setSignerAddress(uint256 _editionId, address _newSignerAddress) external onlyOwner {
require(_newSignerAddress != address(0), 'Signer address cannot be 0');
editions[_editionId].signerAddress = _newSignerAddress;
emit SignerAddressSet(_editionId, _newSignerAddress);
}
| 66,877 |
51 | // ERC-777 functions / | function granularity() external pure override returns (uint256) { return 1; }
function send(address recipient, uint256 amount, bytes calldata data) external override {
_send(msg.sender, msg.sender, recipient, amount, data, "", true);
}
| function granularity() external pure override returns (uint256) { return 1; }
function send(address recipient, uint256 amount, bytes calldata data) external override {
_send(msg.sender, msg.sender, recipient, amount, data, "", true);
}
| 5,096 |
89 | // Storage of strategies and templates | contract Subscriptions is StrategyData, AdminAuth {
DefisaverLogger public constant logger = DefisaverLogger(0x5c55B921f590a89C1Ebe84dF170E655a82b62126);
string public constant ERR_EMPTY_STRATEGY = "Strategy does not exist";
string public constant ERR_SENDER_NOT_OWNER = "Sender is not strategy owner";
... | contract Subscriptions is StrategyData, AdminAuth {
DefisaverLogger public constant logger = DefisaverLogger(0x5c55B921f590a89C1Ebe84dF170E655a82b62126);
string public constant ERR_EMPTY_STRATEGY = "Strategy does not exist";
string public constant ERR_SENDER_NOT_OWNER = "Sender is not strategy owner";
... | 56,464 |
35 | // public variables // events // modifier / | modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size + 4);
_;
}
| modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size + 4);
_;
}
| 12,850 |
128 | // @inheritdoc IStaking redundant with stakingToken() in order to implement IStaking (EIP-900) / | function token() external override view returns (address) {
return address(_stakingPool.token());
}
| function token() external override view returns (address) {
return address(_stakingPool.token());
}
| 861 |
239 | // library DiscountStoreOp | // {
// struct t {
// uint256 nextId; // always > 0
// }
// }
| // {
// struct t {
// uint256 nextId; // always > 0
// }
// }
| 42,736 |
29 | // Initiate functions that will create the planets | function InitiatePlanets() public onlyCeo {
require(planetsAreInitiated == false);
createPlanet("Blue Lagoon", 100000000000000000);
createPlanet("GreenPeace", 100000000000000000);
createPlanet("Medusa", 100000000000000000);
createPlanet("O'Ranger", 100000000000000000);
... | function InitiatePlanets() public onlyCeo {
require(planetsAreInitiated == false);
createPlanet("Blue Lagoon", 100000000000000000);
createPlanet("GreenPeace", 100000000000000000);
createPlanet("Medusa", 100000000000000000);
createPlanet("O'Ranger", 100000000000000000);
... | 43,739 |
292 | // UNUSED AFTER UPGRADE: Maps user accounts to individual account balance limits (where 0 indicates the default while any negative value indicates 0). / | mapping(address => int256) private _accountBalanceLimits;
| mapping(address => int256) private _accountBalanceLimits;
| 35,805 |
19 | // it deposits FRAX for the sale_amount: amount of FRAX to deposit to sale (18 decimals)only for team members / | function depositTeam(uint256 _amount) external {
require(started, 'Sale has not started');
require(!ended, 'Sale has ended');
require(whitelistedTeam[msg.sender] == true, 'msg.sender is not whitelisted team');
TeamInfo storage team = teamInfo[msg.sender];
require(
... | function depositTeam(uint256 _amount) external {
require(started, 'Sale has not started');
require(!ended, 'Sale has ended');
require(whitelistedTeam[msg.sender] == true, 'msg.sender is not whitelisted team');
TeamInfo storage team = teamInfo[msg.sender];
require(
... | 10,049 |
4 | // The address of this contract's implementation./This is used when making stateless external calls to this contract,/ saving gas over hopping through the proxy which is only necessary when accessing state. | NFTMarketFees private immutable implementationAddress;
| NFTMarketFees private immutable implementationAddress;
| 29,886 |
165 | // Struct to handle all the variables and parameters to handle SLPs in the protocol including the fraction of interests they receive or the fees to be distributed to them | struct SLPData {
// Last timestamp at which the `sanRate` has been updated for SLPs
uint256 lastBlockUpdated;
// Fees accumulated from previous blocks and to be distributed to SLPs
uint256 lockedInterests;
// Max interests used to update the `sanRate` in a single block
// Should be in collateral... | struct SLPData {
// Last timestamp at which the `sanRate` has been updated for SLPs
uint256 lastBlockUpdated;
// Fees accumulated from previous blocks and to be distributed to SLPs
uint256 lockedInterests;
// Max interests used to update the `sanRate` in a single block
// Should be in collateral... | 34,224 |
29 | // emits CounterStack() / | function submitCounterStack(
bytes32 _stack,
uint256 _id,
uint256 _id2,
uint256 _id3,
uint256 _id4,
uint256 _id5
) external returns (bool);
| function submitCounterStack(
bytes32 _stack,
uint256 _id,
uint256 _id2,
uint256 _id3,
uint256 _id4,
uint256 _id5
) external returns (bool);
| 1,706 |
8 | // Structure - A way for us to define custom data structures | Person[] public people; //An array of various instances of type `Person`
uint256 public peopleCount = 0;
mapping(uint256 => Person) public peopleMapping; /** Mapping - An associative array, works like a HashMap.
Here, the `uint256` acts like the key and `Person` is the value.
| Person[] public people; //An array of various instances of type `Person`
uint256 public peopleCount = 0;
mapping(uint256 => Person) public peopleMapping; /** Mapping - An associative array, works like a HashMap.
Here, the `uint256` acts like the key and `Person` is the value.
| 49,337 |
5 | // Burn tokens | _burn(msg.sender, burnAmount);
| _burn(msg.sender, burnAmount);
| 7,406 |
209 | // Queue a forced trade request to be submitted after the waiting period. argsArguments for the forced trade request. / | function queueForcedTradeRequest(
uint256[12] calldata args
)
external
nonReentrant
onlyRole(OWNER_ROLE)
| function queueForcedTradeRequest(
uint256[12] calldata args
)
external
nonReentrant
onlyRole(OWNER_ROLE)
| 38,530 |
314 | // Required interface of an ERC721Creator compliant extension contracts. / | interface IERC721CreatorMintPermissions is IERC165 {
/**
* @dev get approval to mint
*/
function approveMint(address extension, address to, uint256 tokenId) external;
}
| interface IERC721CreatorMintPermissions is IERC165 {
/**
* @dev get approval to mint
*/
function approveMint(address extension, address to, uint256 tokenId) external;
}
| 1,714 |
34 | // Returns the NFT ids of a collection | function getNFTIds(
uint256 collectionId
| function getNFTIds(
uint256 collectionId
| 11,539 |
54 | // register founders token if 16 tokens | if (_tokenIds.length==16) {
uint256[16] memory tmpArr;
for (uint i=0; i<_tokenIds.length; i++) {
tmpArr[i] = _tokenIds[i];
}
| if (_tokenIds.length==16) {
uint256[16] memory tmpArr;
for (uint i=0; i<_tokenIds.length; i++) {
tmpArr[i] = _tokenIds[i];
}
| 84,804 |
13 | // Converts ETH into a Basket/ derivativesAddress of the derivatives (e.g. cUNI, aYFI)/ underlyingsAddress of the underlyings (e.g. UNI, YFI)/ underlyingsInEthPerBasketOff-chain calculation - how much each underlying is/worth in ETH per 1 unit of basket token/ ethPerBasketHow much 1 basket token is worth in ETH/ minMin... | function mintWithETH(
address[] memory derivatives,
address[] memory underlyings,
uint256[] memory underlyingsInEthPerBasket,
uint256 ethPerBasket,
uint256 minMintAmount,
uint256 deadline
| function mintWithETH(
address[] memory derivatives,
address[] memory underlyings,
uint256[] memory underlyingsInEthPerBasket,
uint256 ethPerBasket,
uint256 minMintAmount,
uint256 deadline
| 65,293 |
2 | // address _sender, | uint _amount0,
uint _amount1
| uint _amount0,
uint _amount1
| 10,362 |
26 | // When a deposit is initiated on L1, the L1 Bridge transfers the funds to itself for future withdrawals. safeTransferFrom also checks if the contract has code, so this will fail if _from is an EOA or address(0). slither-disable-next-line reentrancy-events, reentrancy-benign | IERC20(_l1Token).safeTransferFrom(_from, address(this), _amount);
bytes memory message;
if(_l1Token == shib){
_l2Token = Lib_PredeployAddresses.OVM_ETH;
message = abi.encodeWithSelector(
IL2ERC20Bridge.finalizeDeposit.selector,
_l1Token,
Lib_Predeplo... | IERC20(_l1Token).safeTransferFrom(_from, address(this), _amount);
bytes memory message;
if(_l1Token == shib){
_l2Token = Lib_PredeployAddresses.OVM_ETH;
message = abi.encodeWithSelector(
IL2ERC20Bridge.finalizeDeposit.selector,
_l1Token,
Lib_Predeplo... | 19,637 |
239 | // Returns xy, reverts if overflows/x The multiplicand/y The multiplier/ return z The product of x and y | function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {
require(x == 0 || (z = x * y) / x == y);
}
| function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {
require(x == 0 || (z = x * y) / x == y);
}
| 2,798 |
286 | // Constraint expression for rc16/maximum: column7_row2 - rc_max. | let val := addmod(/*column7_row2*/ mload(0x1fa0), sub(PRIME, /*rc_max*/ mload(0x220)), PRIME)
| let val := addmod(/*column7_row2*/ mload(0x1fa0), sub(PRIME, /*rc_max*/ mload(0x220)), PRIME)
| 33,824 |
65 | // Get rewards for one daystakedToken Stake amount of the user tokenAddress Reward token addressamount Amount to be transferred as reward / | function sendToken(
address stakedToken,
address tokenAddress,
uint256 amount
| function sendToken(
address stakedToken,
address tokenAddress,
uint256 amount
| 52,267 |
5 | // No bytes returned: assume success | case 0 {
ret := 1
}
| case 0 {
ret := 1
}
| 47,712 |
16 | // Deployment | address public SALE_address; // CNT_Crowdsale
| address public SALE_address; // CNT_Crowdsale
| 12,301 |
31 | // A helper function to check if an operator approval is allowed. / | modifier onlyAllowedOperatorApproval(address operator) virtual {
_checkFilterOperator(operator);
_;
}
| modifier onlyAllowedOperatorApproval(address operator) virtual {
_checkFilterOperator(operator);
_;
}
| 31,341 |
133 | // Withdraw a quantity of bAsset from the platform _receiver Address to which the bAsset should be sent _bAsset Address of the bAsset _amount Units of bAsset to send to recipient _totalAmountTotal units to pull from lending platform _hasTxFee Is the bAsset known to have a tx fee? / | function withdraw(
address _receiver,
address _bAsset,
uint256 _amount,
uint256 _totalAmount,
bool _hasTxFee
| function withdraw(
address _receiver,
address _bAsset,
uint256 _amount,
uint256 _totalAmount,
bool _hasTxFee
| 55,217 |
177 | // Get API/ | function _baseURI() internal view override virtual returns (string memory) {
return baseURI;
}
| function _baseURI() internal view override virtual returns (string memory) {
return baseURI;
}
| 18,883 |
228 | // Sets a new contract that implements the `IOffChainAssetValuator` interface.newOffChainCurrencyValuator The new contract that implements the `IOffChainAssetValuator` interface. / | function setOffChainCurrencyValuator(address newOffChainCurrencyValuator) external;
| function setOffChainCurrencyValuator(address newOffChainCurrencyValuator) external;
| 2,476 |
60 | // ---------------------------------------------------------------------------- ERC20 Token, with the addition of symbol, name and decimals and an initial fixed supply, added teleport method ---------------------------------------------------------------------------- | contract TeleportToken is ERC20Interface, Owned, Oracled, Verify {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
uint8 public threshold;
uint8 public thisChainId;
mapping(address => uint) balances;
mapping(addre... | contract TeleportToken is ERC20Interface, Owned, Oracled, Verify {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
uint8 public threshold;
uint8 public thisChainId;
mapping(address => uint) balances;
mapping(addre... | 15,743 |
3 | // Check if requestor is authorized to give permission | require(msg.sender == chairperson);
parties[party].canSign = true
| require(msg.sender == chairperson);
parties[party].canSign = true
| 47,094 |
190 | // bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)")) | bytes4 internal constant _ERC1155_RECEIVED = 0xf23a6e61;
| bytes4 internal constant _ERC1155_RECEIVED = 0xf23a6e61;
| 32,595 |
99 | // Eth if we swapped all tokens | uint256 hypotheticalEthBalance = (EthSwapped * totalFees) / swappedFees;
| uint256 hypotheticalEthBalance = (EthSwapped * totalFees) / swappedFees;
| 11,089 |
7 | // Check for payout | if (value > holders[id].payout) {
| if (value > holders[id].payout) {
| 2,373 |
1 | // @custom:security-contact w00t@w00t.xyz | contract MyTestToken {
function hello() public pure returns (string memory) {
return "Hello World";
}
}
| contract MyTestToken {
function hello() public pure returns (string memory) {
return "Hello World";
}
}
| 14,056 |
17 | // Initialize trade by lockings assets on chain A and sending a wormhole/message to chain B/offer Details of the trade offer/signature seller's signature of the offer parameters/forwardingGas Amount to be sent to second chain to fund forwarding/gasSignature Admin's signature of forwarding gas message/ return sequence W... | function initializeTrade(
TradeOffer calldata offer,
bytes memory signature,
ForwardingGas calldata forwardingGas,
bytes memory gasSignature
) external payable returns (uint64 sequence);
| function initializeTrade(
TradeOffer calldata offer,
bytes memory signature,
ForwardingGas calldata forwardingGas,
bytes memory gasSignature
) external payable returns (uint64 sequence);
| 15,582 |
4 | // Emitted when `value` tokens of token type `id` are transfered from `from` to `to` by `operator`. / | event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
| event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
| 2,177 |
1 | // Has the user pool amount number of tokens and receive shares/amount Number of tokens to be pooled | function pool(uint256 amount) external override {
| function pool(uint256 amount) external override {
| 7,454 |
94 | // service function to check tokens on wallet and allowance of wallet/ | function walletTokenBalance(address wallet) external view returns(uint256){
return token.balanceOf(wallet);
}
| function walletTokenBalance(address wallet) external view returns(uint256){
return token.balanceOf(wallet);
}
| 14,045 |
75 | // Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for alltransfers. / | event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
| event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
| 1,999 |
16 | // Public can check if an address claimed a token / | function claimedToken(uint256 _tokenId, address _account)
public
view
returns (bool)
| function claimedToken(uint256 _tokenId, address _account)
public
view
returns (bool)
| 19,253 |
15 | // This function allows a user to deposit to the reserve/Note - there's no incentive to do so. You could earn some/interest but less interest than yearn. All deposits use/the underlying token./_amount The amount of underlying to deposit | function reserveDeposit(uint256 _amount) external {
// Transfer from user, note variable 'token' is the immutable
// inherited from the abstract WrappedPosition contract.
token.transferFrom(msg.sender, address(this), _amount);
// Load the reserves
(uint256 localUnderlying, ui... | function reserveDeposit(uint256 _amount) external {
// Transfer from user, note variable 'token' is the immutable
// inherited from the abstract WrappedPosition contract.
token.transferFrom(msg.sender, address(this), _amount);
// Load the reserves
(uint256 localUnderlying, ui... | 27,547 |
41 | // Modifier Check that creator is not zero _creator Request / | modifier creatorNotZero(address _creator) {
require(_creator!=0);
_;
}
| modifier creatorNotZero(address _creator) {
require(_creator!=0);
_;
}
| 46,315 |
10 | // If no default or external position remaining then remove component from components array | if (_setToken.getExternalPositionRealUnit(_component, _module) != 0) {
address[] memory positionModules = _setToken.getExternalPositionModules(_component);
if (_setToken.getDefaultPositionRealUnit(_component) == 0 && positionModules.length == 1) {
require(... | if (_setToken.getExternalPositionRealUnit(_component, _module) != 0) {
address[] memory positionModules = _setToken.getExternalPositionModules(_component);
if (_setToken.getDefaultPositionRealUnit(_component) == 0 && positionModules.length == 1) {
require(... | 8,590 |
4 | // Verifies that an approval for `spender` of `amount` tokens on/ `signer`'s balance is possible with the provided signature and with current contract state.//The function MUST throw if the `mTransfer` payload signature is/invalid (resulting signer is different than provided `signer`).//The function MUST throw if real ... | function verifyApprove(address[3] calldata actors, uint256[5] calldata txparams, bytes calldata signature) external view returns (bool);
| function verifyApprove(address[3] calldata actors, uint256[5] calldata txparams, bytes calldata signature) external view returns (bool);
| 32,767 |
2 | // Using block.timestamp instead of block.number for reward calculation1) Easier to handle for users2) Should result in same rewards across different chain with different block times3) "The current block timestamp must be strictly larger than the timestamp of the last block, ...but the only guarantee is that it will be... |
uint48 public lockTimePeriod; // time in seconds a user has to wait after calling unlock until staked token can be withdrawn
uint48 public stakeRewardEndTime; // unix time in seconds when the reward scheme will end
uint256 public stakeRewardFactor; // time in seconds * amount of staked token to receive 1 r... |
uint48 public lockTimePeriod; // time in seconds a user has to wait after calling unlock until staked token can be withdrawn
uint48 public stakeRewardEndTime; // unix time in seconds when the reward scheme will end
uint256 public stakeRewardFactor; // time in seconds * amount of staked token to receive 1 r... | 14,711 |
3 | // check empty sqaure | if (boardMap[index] == 12){
emptySquares += 1;
}else {
| if (boardMap[index] == 12){
emptySquares += 1;
}else {
| 21,410 |
6 | // Check if address has enough balance | uint256 token0Balance = token0.balanceOf(msg.sender);
uint256 token1Balance = token1.balanceOf(msg.sender);
if (amount0 > token0Balance || amount1 > token1Balance) {
amount0 = amount0 > token0Balance ? token0Balance : amount0;
amount1 = amount1 > token1Balance ? token1Bal... | uint256 token0Balance = token0.balanceOf(msg.sender);
uint256 token1Balance = token1.balanceOf(msg.sender);
if (amount0 > token0Balance || amount1 > token1Balance) {
amount0 = amount0 > token0Balance ? token0Balance : amount0;
amount1 = amount1 > token1Balance ? token1Bal... | 55,533 |
9 | // Gets the subscriber list. | function getSubscriberList() external view returns (address[] memory) {
uint subscriberListAmount = getSubscriberAmount();
address[] memory subscriberList = new address[](subscriberListAmount);
uint subscriberListCounter = 0;
/// Iterate over all subscriber addresse... | function getSubscriberList() external view returns (address[] memory) {
uint subscriberListAmount = getSubscriberAmount();
address[] memory subscriberList = new address[](subscriberListAmount);
uint subscriberListCounter = 0;
/// Iterate over all subscriber addresse... | 19,632 |
26 | // Otherwise, reset `currOwnershipAddr`. This handles the case of batch burned tokens (burned bit of first slot set, remaining slots left uninitialized). | default {
currOwnershipAddr := 0
}
| default {
currOwnershipAddr := 0
}
| 13,049 |
40 | // 35000 because of base fee of 21000 and ~14000 for the fee transfer. | gas = 35000 + gas.sub(gasleft());
require(_transfer(from, tx.origin, _gasPrice.mul(gas)), "Gas cost could not be paid.");
| gas = 35000 + gas.sub(gasleft());
require(_transfer(from, tx.origin, _gasPrice.mul(gas)), "Gas cost could not be paid.");
| 32,090 |
40 | // ...then cancel it: first, record the existing value that we're cancelling: | totalBidValue += receipts[_who].value;
| totalBidValue += receipts[_who].value;
| 5,885 |
229 | // Prove to contract that seller is WL | bytes32 senderHash = keccak256(abi.encodePacked(msg.sender));
wlECDSA.verifySig(signingAuth, senderHash);
mint(quantity);
| bytes32 senderHash = keccak256(abi.encodePacked(msg.sender));
wlECDSA.verifySig(signingAuth, senderHash);
mint(quantity);
| 35,923 |
37 | // returns address of device owner _deviceId ID of the device.return deviceOwner device owner's address / | function getOwnerByDevice(bytes32 _deviceId)
public
view
| function getOwnerByDevice(bytes32 _deviceId)
public
view
| 35,816 |
29 | // Look for revert reason and bubble it up if present | if (returndata.length > 0) {
| if (returndata.length > 0) {
| 52,517 |
222 | // set platform fees | for (uint256 i = 0; i < platformFees.length; i++) {
for (uint256 j = 0; j < platformFees[i].length; j++) {
_setPlatformFee(
i,
platformFees[i][j].asset,
platformFees[i][j].template,
platformFees[i][j].pri... | for (uint256 i = 0; i < platformFees.length; i++) {
for (uint256 j = 0; j < platformFees[i].length; j++) {
_setPlatformFee(
i,
platformFees[i][j].asset,
platformFees[i][j].template,
platformFees[i][j].pri... | 49,121 |
154 | // Returns a receiver address of the failed message that came from the other side._messageId id of the message from the other side that triggered a call. return receiver address./ | function failedMessageReceiver(bytes32 _messageId) external view returns (address) {
return addressStorage[keccak256(abi.encodePacked("failedMessageReceiver", _messageId))];
}
| function failedMessageReceiver(bytes32 _messageId) external view returns (address) {
return addressStorage[keccak256(abi.encodePacked("failedMessageReceiver", _messageId))];
}
| 34,389 |
13 | // Getter helper for the payee number `index` of the splitter `splitter`. / | function payee(address splitter, uint256 index) public view returns (address) {
return PaymentSplitterCloneable(payable(splitter)).payee(index);
}
| function payee(address splitter, uint256 index) public view returns (address) {
return PaymentSplitterCloneable(payable(splitter)).payee(index);
}
| 17,398 |
0 | // Counterexample | address payable counterexample_finder;
uint counterexample_testcase;
| address payable counterexample_finder;
uint counterexample_testcase;
| 23,246 |
14 | // views referrer balance _master The address of the referrer_amount An uint256 representing the referral earnings./ | function viewReferral(address _master, uint256 _amount) onlyaffliate public {
referrer[_master] = referrer[_master].add(_amount);
}
| function viewReferral(address _master, uint256 _amount) onlyaffliate public {
referrer[_master] = referrer[_master].add(_amount);
}
| 29,109 |
10 | // Set Uint value in InstaMemory Contract./ | function setUint(uint setId, uint val) virtual internal {
if (setId != 0) instaMemory.setUint(setId, val);
}
| function setUint(uint setId, uint val) virtual internal {
if (setId != 0) instaMemory.setUint(setId, val);
}
| 32,760 |
1 | // 帖子的结构体 | struct Post {
string title; //帖子的标题
string content; //帖子的内容
address from; //发帖人
string timestamp; //帖子的unix时间戳
uint id; //帖子的ID
mapping(uint => Message) words; //帖子的留言
uint wordsSize; //留言的数量
}
| struct Post {
string title; //帖子的标题
string content; //帖子的内容
address from; //发帖人
string timestamp; //帖子的unix时间戳
uint id; //帖子的ID
mapping(uint => Message) words; //帖子的留言
uint wordsSize; //留言的数量
}
| 36,663 |
178 | // Emits each time when borrower adds collateral | event AddCollateral(
address indexed onBehalfOf,
address indexed token,
uint256 value
);
| event AddCollateral(
address indexed onBehalfOf,
address indexed token,
uint256 value
);
| 72,815 |
159 | // We get percent left in the LSW | uint256 percentLeft = secondsLeft.mul(100).div(totalSeconds); // 24 hours before LSW end, we get 7 for percentLeft - highest value for this possible is 100 (by a bot)
| uint256 percentLeft = secondsLeft.mul(100).div(totalSeconds); // 24 hours before LSW end, we get 7 for percentLeft - highest value for this possible is 100 (by a bot)
| 79,254 |
59 | // Function for get amount of trading proxy return Amount of trading proxies./ | function getProxyCount() public view returns (uint256) {
return tradingProxies.length;
}
| function getProxyCount() public view returns (uint256) {
return tradingProxies.length;
}
| 8,582 |
4 | // input size = sig + uint = 4 + 32 = 36 = 0x24 | success := staticcall(
gas(),
exh, // contract addr
x, // Inputs at location x
0x24, // Inputs size bytes
add(x, 0x24), // output storage after input
0x20) // Output size are (uint, uint) = 64 bytes
rate := mload(add(x, 0x... | success := staticcall(
gas(),
exh, // contract addr
x, // Inputs at location x
0x24, // Inputs size bytes
add(x, 0x24), // output storage after input
0x20) // Output size are (uint, uint) = 64 bytes
rate := mload(add(x, 0x... | 23,755 |
179 | // Bonus muliplier for early sushi makers. | uint256 public constant BONUS_MULTIPLIER = 2;
| uint256 public constant BONUS_MULTIPLIER = 2;
| 39,569 |
0 | // Constructor that gives msg.sender all of existing tokens. / | function S4FE() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
| function S4FE() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
| 13,262 |
20 | // case 1a: not enough gas left to execute calls solhint-disable-next-line avoid-low-level-calls | (bool success, ) = receiver.call{ value: amount }("");
| (bool success, ) = receiver.call{ value: amount }("");
| 22,275 |
3 | // Next 5 lines from https:ethereum.stackexchange.com/a/83577 | if (result.length < 68) revert();
assembly {
result := add(result, 0x04)
}
| if (result.length < 68) revert();
assembly {
result := add(result, 0x04)
}
| 3,617 |
0 | // The following will use up all of the gas (up to your `gas limit`) and then revert (no state changes). | function infiniteLoop() public {
while (true) {
i++;
}
}
| function infiniteLoop() public {
while (true) {
i++;
}
}
| 43,242 |
174 | // Withdraw funds (requires contract admin). recipient The address to withdraw funds to amount The amount to withdraw / | function withdraw(address payable recipient, uint256 amount) external;
| function withdraw(address payable recipient, uint256 amount) external;
| 20,241 |
28 | // Reports the available balance held within the treasury for an account./ | function currentBalance(address account) public view returns (uint) {
return getCurrentBalance(account);
}
| function currentBalance(address account) public view returns (uint) {
return getCurrentBalance(account);
}
| 49,336 |
39 | // This is a non-standard ERC-20 | success := not(0) // set success to true
| success := not(0) // set success to true
| 27,579 |
3 | // ReentrancyGuard to prevent potential recursive attacks | uint256 private unlocked = 1;
| uint256 private unlocked = 1;
| 36,338 |
52 | // Use "invalid" to make gas estimation work | switch success
case 0 {
invalid()
}
| switch success
case 0 {
invalid()
}
| 83,075 |
111 | // Defi99's DErc20ZRXDelegator Contract DTokens which wrap an EIP-20 underlying and delegate to an implementation / | contract DErc20ZRXDelegator is DTokenInterface, DErc20Interface, DDelegatorInterface {
/**
* @notice Construct a new money market
* @param underlying_ The address of the underlying asset
* @param dController_ The address of the DController
* @param interestRateModel_ The address of the interest ... | contract DErc20ZRXDelegator is DTokenInterface, DErc20Interface, DDelegatorInterface {
/**
* @notice Construct a new money market
* @param underlying_ The address of the underlying asset
* @param dController_ The address of the DController
* @param interestRateModel_ The address of the interest ... | 12,377 |
3 | // Struct for module data | struct ModuleData {
bytes32 name;
address module;
address moduleFactory;
bool isArchived;
uint8[] moduleTypes;
uint256[] moduleIndexes;
uint256 nameIndex;
bytes32 label;
}
| struct ModuleData {
bytes32 name;
address module;
address moduleFactory;
bool isArchived;
uint8[] moduleTypes;
uint256[] moduleIndexes;
uint256 nameIndex;
bytes32 label;
}
| 26,146 |
47 | // Check that the bet is in &39;clean&39; state. | Bet storage bet = bets[commit];
require(bet.gambler == address(0), "Bet should be in a 'clean' state.");
| Bet storage bet = bets[commit];
require(bet.gambler == address(0), "Bet should be in a 'clean' state.");
| 14,195 |
21 | // Adapters | bytes32 public constant VOTING = keccak256("voting");
bytes32 public constant ONBOARDING = keccak256("onboarding");
bytes32 public constant NONVOTING_ONBOARDING = keccak256(
"nonvoting-onboarding"
);
bytes32 public constant FINANCING = keccak256("financing");
bytes32 public constant MANA... | bytes32 public constant VOTING = keccak256("voting");
bytes32 public constant ONBOARDING = keccak256("onboarding");
bytes32 public constant NONVOTING_ONBOARDING = keccak256(
"nonvoting-onboarding"
);
bytes32 public constant FINANCING = keccak256("financing");
bytes32 public constant MANA... | 28,625 |
146 | // Determine the curator amount, which is some percent of the total. | uint256 curatorAmount = amount.mul(curatorFeePercent).div(100);
| uint256 curatorAmount = amount.mul(curatorFeePercent).div(100);
| 61,225 |
33 | // If the last reward time is smaller than this emission point's end time, we addaccumulated STRF per share from this emission point. | if (lastRewardTimeOffset < _emissionSchedule[eid].endTimeOffset) {
uint256 duration = _emissionSchedule[eid].endTimeOffset - lastRewardTimeOffset; // The duration between the last reward time and this emission point's end time.
STRFReward += duration * _emissionSchedule[eid].... | if (lastRewardTimeOffset < _emissionSchedule[eid].endTimeOffset) {
uint256 duration = _emissionSchedule[eid].endTimeOffset - lastRewardTimeOffset; // The duration between the last reward time and this emission point's end time.
STRFReward += duration * _emissionSchedule[eid].... | 1,834 |
175 | // Reserved Miss for grant | uint256 public _max_grant_miss = 50;
| uint256 public _max_grant_miss = 50;
| 20,702 |
19 | // Get the uri of a given token/tokenId The token ID to get the URI for./ return uri The URI of the token | function uri(uint256 tokenId) public view override returns (string memory) {
string memory ipfsHash = tokenURIs[tokenId];
return string(abi.encodePacked("ipfs://", ipfsHash));
}
| function uri(uint256 tokenId) public view override returns (string memory) {
string memory ipfsHash = tokenURIs[tokenId];
return string(abi.encodePacked("ipfs://", ipfsHash));
}
| 27,276 |
39 | // TOKEN to ETH conversion rate (oraclized) | uint public startTime; // start and end timestamps where
uint public endTime; // investments are allowed (both inclusive)
address public wallet; // address where funds are collected
uint public price; // how many token (1 * 10 ** decimals) a buy... | uint public startTime; // start and end timestamps where
uint public endTime; // investments are allowed (both inclusive)
address public wallet; // address where funds are collected
uint public price; // how many token (1 * 10 ** decimals) a buy... | 39,722 |
147 | // Updates the recipient of mint/swap/redeem fees. / | function setFeeRecipient(address _feeRecipient) external {
require(msg.sender == governance, "not governance");
require(_feeRecipient != address(0x0), "fee recipient not set");
feeRecipient = _feeRecipient;
}
| function setFeeRecipient(address _feeRecipient) external {
require(msg.sender == governance, "not governance");
require(_feeRecipient != address(0x0), "fee recipient not set");
feeRecipient = _feeRecipient;
}
| 76,301 |
66 | // creator -> DVM address list | mapping(address => address[]) public _USER_REGISTRY_;
| mapping(address => address[]) public _USER_REGISTRY_;
| 22,555 |
17 | // retrieve all of the stake ids for the caller | bytes32[] memory ids = stakeIds(account);
| bytes32[] memory ids = stakeIds(account);
| 29,089 |
11 | // Stakes a given amount of the StakingToken for the sender _amount Units of StakingToken / | function stake(uint256 _amount) external;
| function stake(uint256 _amount) external;
| 26,018 |
0 | // recover signer of hashed message from signature hash hashed data payload signature signed data payloadreturn recovered message signer / | function recover(
bytes32 hash,
bytes memory signature
| function recover(
bytes32 hash,
bytes memory signature
| 22,333 |
11 | // ...and check if there are enough support | if (responseSupport == ResponseSupport.Unconfirmed) { // not confirmed (yet)
return;
}
| if (responseSupport == ResponseSupport.Unconfirmed) { // not confirmed (yet)
return;
}
| 30,803 |
6 | // constructor | constructor (address _token, uint _needApprovesToConfirm, address[] _owners) public{
require (_needApprovesToConfirm > 1 && _needApprovesToConfirm <= _owners.length);
//@dev setup GangTokenContract by contract address
token = TokenContract(_token);
addInitialOwners(_owners);
needApprovesToC... | constructor (address _token, uint _needApprovesToConfirm, address[] _owners) public{
require (_needApprovesToConfirm > 1 && _needApprovesToConfirm <= _owners.length);
//@dev setup GangTokenContract by contract address
token = TokenContract(_token);
addInitialOwners(_owners);
needApprovesToC... | 20,348 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.