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 |
|---|---|---|---|---|
13 | // Function will fail if the proof is not a valid inclusion or exclusion proof. | (
bool exists,
bytes memory encodedAccount
) = Lib_SecureMerkleTrie.get(
abi.encodePacked(_ovmContractAddress),
_stateTrieWitness,
preStateRoot
);
if (exists == true) {
| (
bool exists,
bytes memory encodedAccount
) = Lib_SecureMerkleTrie.get(
abi.encodePacked(_ovmContractAddress),
_stateTrieWitness,
preStateRoot
);
if (exists == true) {
| 15,577 |
10 | // Hook called by CFA contract on flow update/This function triggers the metadata update of both COF and CIF NFTs/superToken the SuperToken contract address/flowSender the flow sender/flowReceiver the flow receiver/ NOTE: We do an existence check in here to determine whether or not to execute the hook | function onUpdate(
ISuperfluidToken superToken,
address flowSender,
address flowReceiver
| function onUpdate(
ISuperfluidToken superToken,
address flowSender,
address flowReceiver
| 6,600 |
40 | // ...and send them to the customer | AssetLike(asset).exit(dealStorage.customer, dealStorage.value);
emit Refund(dealStorage.provider, serviceId);
| AssetLike(asset).exit(dealStorage.customer, dealStorage.value);
emit Refund(dealStorage.provider, serviceId);
| 12,927 |
308 | // DyDx calls this function after doing flash loan | function callFunction(
address sender,
Account.Info memory account,
bytes memory data
| function callFunction(
address sender,
Account.Info memory account,
bytes memory data
| 9,903 |
4 | // Ir Orc has only a last name | if (bytes(_firstNames[orcId]).length == 0 && bytes(_lastNames[orcId]).length > 0)
return _lastNames[orcId];
return string(abi.encodePacked(_firstNames[orcId], " ", _lastNames[orcId]));
| if (bytes(_firstNames[orcId]).length == 0 && bytes(_lastNames[orcId]).length > 0)
return _lastNames[orcId];
return string(abi.encodePacked(_firstNames[orcId], " ", _lastNames[orcId]));
| 34,666 |
31 | // send ether to the fund collection wallet override to create custom fund forwarding mechanisms | function forwardFunds() internal {
wallet.transfer(msg.value);
}
| function forwardFunds() internal {
wallet.transfer(msg.value);
}
| 12,643 |
144 | // Bond a validator _valAddr the address of the validator / | function _bondValidator(address _valAddr) private {
bondedValAddrs.push(_valAddr);
_setBondedValidator(_valAddr);
}
| function _bondValidator(address _valAddr) private {
bondedValAddrs.push(_valAddr);
_setBondedValidator(_valAddr);
}
| 43,175 |
11 | // Returns pool total assets value/ return poolTotalAssetsValue | function getPoolTotalAssetsValue() external view returns (uint256);
| function getPoolTotalAssetsValue() external view returns (uint256);
| 8,414 |
67 | // Returns the ERC20 token balance of a given account. / | function balanceOf(address account) public view returns (uint) {
return tokenState.balanceOf(account);
}
| function balanceOf(address account) public view returns (uint) {
return tokenState.balanceOf(account);
}
| 2,283 |
127 | // ============ State Variables ============ Supported burnable tokens on the local domain local token (address) => maximum burn amounts per message | mapping(address => uint256) public burnLimitsPerMessage;
| mapping(address => uint256) public burnLimitsPerMessage;
| 42,691 |
9 | // send all money to chris | chris.transfer(address(this).balance);
| chris.transfer(address(this).balance);
| 46,298 |
13 | // Extend close time if it's required | uint256 bidTimeOffset = _auction_closeTimestamp[tokenContract][tokenId].sub(block.timestamp);
if (bidTimeOffset < _extensionTimePeriod) {
_auction_closeTimestamp[tokenContract][tokenId] = _auction_closeTimestamp[tokenContract][tokenId].add(
_extensionTimePeriod.sub(bidTimeOff... | uint256 bidTimeOffset = _auction_closeTimestamp[tokenContract][tokenId].sub(block.timestamp);
if (bidTimeOffset < _extensionTimePeriod) {
_auction_closeTimestamp[tokenContract][tokenId] = _auction_closeTimestamp[tokenContract][tokenId].add(
_extensionTimePeriod.sub(bidTimeOff... | 11,348 |
127 | // MegaMoonToken with Governance. | contract MegaMoonToken is BEP20('MegaMoonToken Token', 'Moon') {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
... | contract MegaMoonToken is BEP20('MegaMoonToken Token', 'Moon') {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
... | 15,292 |
22 | // Used for calculationg inscription Ids when adding without a sig | uint256 latestInscriptionId;
| uint256 latestInscriptionId;
| 748 |
20 | // Mints MadBytes. This function receives ether in the transaction and/ converts them into MadBytes using a bonding price curve./minMB_ Minimum amount of MadBytes that you wish to mint given an/ amount of ether. If its not possible to mint the desired amount with the/ current price in the bonding curve, the transaction... | function mint(uint256 minMB_) public payable returns(uint256 nuMB) {
nuMB = _mint(msg.sender, msg.value, minMB_);
return nuMB;
}
| function mint(uint256 minMB_) public payable returns(uint256 nuMB) {
nuMB = _mint(msg.sender, msg.value, minMB_);
return nuMB;
}
| 824 |
62 | // result is unused for now solhint-disable-next-line no-unused-vars | (bool success, bytes memory result) =
| (bool success, bytes memory result) =
| 68,794 |
162 | // tracks auto generated BNB, useful for ticker etc | uint256 public totalLPBNB;
| uint256 public totalLPBNB;
| 13,603 |
208 | // Get issue data from the registry. _repoId The id of the repo in the projects registry / | function getIssue(bytes32 _repoId, uint256 _issueNumber) external view isInitialized
returns(bool hasBounty, uint standardBountyId, bool fulfilled, uint balance, address assignee)
| function getIssue(bytes32 _repoId, uint256 _issueNumber) external view isInitialized
returns(bool hasBounty, uint standardBountyId, bool fulfilled, uint balance, address assignee)
| 9,844 |
18 | // this is a uint8 rather than a 256 for storage. | uint8 internal noOfAdmins_;
| uint8 internal noOfAdmins_;
| 12,207 |
9 | // Just a sanity case in the worst case if this function is called late (EVM only stores last 256 block hashes) | if (block.number.sub(startingIndexBlock) > 255) {
startingIndex = uint(blockhash(block.number - 1)) % MAX_APES;
}
| if (block.number.sub(startingIndexBlock) > 255) {
startingIndex = uint(blockhash(block.number - 1)) % MAX_APES;
}
| 25,205 |
196 | // Reset protocolTokenToGov mapping | for (uint256 i = 0; i < allAvailableTokens.length; i++) {
protocolTokenToGov[allAvailableTokens[i]] = address(0);
}
| for (uint256 i = 0; i < allAvailableTokens.length; i++) {
protocolTokenToGov[allAvailableTokens[i]] = address(0);
}
| 6,334 |
65 | // Token Claim | mapping (address => uint) public ethContributedForTokens;
uint256 public TokenPerETHUnit;
uint256 public bonusTokens = 50000 * 10**9;
address public devAddr;
event LiquidityAddition(address indexed dst, uint value);
event LPTokenClaimed(address dst, uint value);
event TokenClaimed(address... | mapping (address => uint) public ethContributedForTokens;
uint256 public TokenPerETHUnit;
uint256 public bonusTokens = 50000 * 10**9;
address public devAddr;
event LiquidityAddition(address indexed dst, uint value);
event LPTokenClaimed(address dst, uint value);
event TokenClaimed(address... | 7,783 |
55 | // Contract module which provides a basic access control mechanism, where there is an account (an owner) that can be granted exclusive access to specific functions. By default, the owner account will be the one that deploys the contract. This | * can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred... | * can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred... | 31,713 |
311 | // we do a flash loan to give us a big gap. from here on out it is cheaper to use normal deleverage. Use Aave for extremely large loans | if (DyDxActive) {
position = position.sub(flashLoanPlugin.doDyDxFlashLoan(deficit, position));
}
| if (DyDxActive) {
position = position.sub(flashLoanPlugin.doDyDxFlashLoan(deficit, position));
}
| 4,649 |
0 | // Token Name: TPC TokenContract Name: Third Payment CirculationAuthor: kolidatgmail.comDeveloped for: TPC LLC.TPC is an ERC20 Token / | contract ERC20 {
function totalSupply() public view returns (uint supply);
function balanceOf(address who) public view returns (uint value);
function allowance(address owner, address spender ) public view returns (uint _allowance);
function transfer(address to, uint value) public returns (bool ok);
... | contract ERC20 {
function totalSupply() public view returns (uint supply);
function balanceOf(address who) public view returns (uint value);
function allowance(address owner, address spender ) public view returns (uint _allowance);
function transfer(address to, uint value) public returns (bool ok);
... | 1,171 |
6 | // Returns true if `user` has approved `relayer` to act as a relayer for them. / | function hasApprovedRelayer(address user, address relayer) external view returns (bool);
| function hasApprovedRelayer(address user, address relayer) external view returns (bool);
| 22,183 |
298 | // execute the actual withdrawal | _executeWithdrawal(contextId, provider, pool, data, poolTokenAmount, amounts);
return amounts.baseTokensToTransferFromMasterVault;
| _executeWithdrawal(contextId, provider, pool, data, poolTokenAmount, amounts);
return amounts.baseTokensToTransferFromMasterVault;
| 75,557 |
19 | // ISuppliable ISuppliable interface / | interface ISuppliable {
function isSupplier(address _supplier) external view returns (bool);
function addSupplier(address _supplier) external;
function removeSupplier(address _supplier) external;
event SupplierAdded(address indexed supplier);
event SupplierRemoved(address indexed supplier);
}
| interface ISuppliable {
function isSupplier(address _supplier) external view returns (bool);
function addSupplier(address _supplier) external;
function removeSupplier(address _supplier) external;
event SupplierAdded(address indexed supplier);
event SupplierRemoved(address indexed supplier);
}
| 78,822 |
65 | // ERC721, transfer loan to another address | lendersBalance[msg.sender] -= 1;
lendersBalance[to] += 1;
Transfer(loan.lender, to, index);
return true;
| lendersBalance[msg.sender] -= 1;
lendersBalance[to] += 1;
Transfer(loan.lender, to, index);
return true;
| 2,217 |
57 | // user => token => credit | mapping (address => mapping(address => uint)) public credit;
| mapping (address => mapping(address => uint)) public credit;
| 15,964 |
36 | // Adding 1 due to burning token 0 | _maxSupply = maxSupply + 1;
| _maxSupply = maxSupply + 1;
| 15,929 |
20 | // Appends a byte array to the end of the buffer. Resizes if doing sowould exceed the capacity of the buffer._buf The buffer to append to._data The data to append. return _buffer The original buffer./ | function append(buffer memory _buf, bytes memory _data) internal pure returns (buffer memory _buffer) {
if (_data.length + _buf.buf.length > _buf.capacity) {
resize(_buf, max(_buf.capacity, _data.length) * 2);
}
uint dest;
uint src;
uint len = _data.length;
... | function append(buffer memory _buf, bytes memory _data) internal pure returns (buffer memory _buffer) {
if (_data.length + _buf.buf.length > _buf.capacity) {
resize(_buf, max(_buf.capacity, _data.length) * 2);
}
uint dest;
uint src;
uint len = _data.length;
... | 36,189 |
61 | // Emits an {IERC1155-TransferSingle} event. from Address of the current token owner. id Identifier of the token to burn. value Amount of token to burn. / | function burnFrom(
address from,
uint256 id,
uint256 value
) external;
| function burnFrom(
address from,
uint256 id,
uint256 value
) external;
| 10,152 |
979 | // https:etherscan.io/address/0xB34F4d7c207D8979D05EDb0F63f174764Bd67825 | MultiCollateralSynth public constant synthsada_i = MultiCollateralSynth(0xB34F4d7c207D8979D05EDb0F63f174764Bd67825);
| MultiCollateralSynth public constant synthsada_i = MultiCollateralSynth(0xB34F4d7c207D8979D05EDb0F63f174764Bd67825);
| 34,457 |
255 | // Transfer reward token to sender | rewardToken.safeTransfer(msg.sender, pendingRewards);
emit Harvest(msg.sender, pendingRewards);
| rewardToken.safeTransfer(msg.sender, pendingRewards);
emit Harvest(msg.sender, pendingRewards);
| 68,468 |
77 | // Ensure that a non-zero recipient has been supplied. | if (recipient == address(0)) {
revert(_revertReason(1));
}
| if (recipient == address(0)) {
revert(_revertReason(1));
}
| 16,708 |
2 | // Notifies the controller about a token transfer allowing the/controller to react if desired/_from The origin of the transfer/_to The destination of the transfer/_amount The amount of the transfer/ return False if the controller does not authorize the transfer | function onTransfer(address _from, address _to, uint _amount) returns(bool);
| function onTransfer(address _from, address _to, uint _amount) returns(bool);
| 1,713 |
186 | // Optimism L1 Escrow Address | L1EscrowLike(OPTIMISM_ESCROW).approve(MCD_DAI, address(this), 10 * MILLION * WAD);
TokenLike(MCD_DAI).transferFrom(OPTIMISM_ESCROW, LOST_SOME_DAI_WALLET, 10 * MILLION * WAD);
| L1EscrowLike(OPTIMISM_ESCROW).approve(MCD_DAI, address(this), 10 * MILLION * WAD);
TokenLike(MCD_DAI).transferFrom(OPTIMISM_ESCROW, LOST_SOME_DAI_WALLET, 10 * MILLION * WAD);
| 2,394 |
18 | // if token is already set, don't allow it to set a different L2 address | require(currL2Addr == _l2Address, "NO_UPDATE_TO_DIFFERENT_ADDR");
| require(currL2Addr == _l2Address, "NO_UPDATE_TO_DIFFERENT_ADDR");
| 22,378 |
537 | // Updates the reserve current stable borrow rate Rf, the current variable borrow rate Rv and the current liquidity rate Rl. Also updates the lastUpdateTimestamp value. Please refer to the whitepaper for further information._reserve the address of the reserve to be updated_liquidityAdded the amount of liquidity added t... | ) internal {
CoreLibrary.ReserveData storage reserve = reserves[_reserve];
(uint256 newLiquidityRate, uint256 newStableRate, uint256 newVariableRate) = IReserveInterestRateStrategy(
reserve
.interestRateStrategyAddress
)
.calculateInterestRates(
... | ) internal {
CoreLibrary.ReserveData storage reserve = reserves[_reserve];
(uint256 newLiquidityRate, uint256 newStableRate, uint256 newVariableRate) = IReserveInterestRateStrategy(
reserve
.interestRateStrategyAddress
)
.calculateInterestRates(
... | 18,805 |
27 | // onlyOwner/It allows owner to modify allAvailableTokens array in case of emergencyie if a bug on a interest bearing token is discovered and reset protocolWrappersassociated with those tokens.protocolTokens : array of protocolTokens addresses (eg [cDAI, iDAI, ...]) wrappers : array of wrapper addresses (eg [IdleCompou... | function setAllAvailableTokensAndWrappers(
address[] calldata protocolTokens,
address[] calldata wrappers,
uint256[] calldata allocations,
bool keepAllocations
| function setAllAvailableTokensAndWrappers(
address[] calldata protocolTokens,
address[] calldata wrappers,
uint256[] calldata allocations,
bool keepAllocations
| 22,776 |
898 | // Transfers ERC20 Currency asset from this Pool to another Pool on upgrade. / | function _upgradeCapitalPool(
bytes4 _curr,
address _newPoolAddress
)
internal
| function _upgradeCapitalPool(
bytes4 _curr,
address _newPoolAddress
)
internal
| 29,431 |
48 | // return { "caddr": "the associated user contract address" } | function find(bytes32 username) constant returns (address caddr) {
| function find(bytes32 username) constant returns (address caddr) {
| 23,513 |
5 | // Greeter/Cyrus Adkisson The contract definition. A constructor of the same name will be automatically called on contract creation. | contract Suicide {
// At first, an empty "address"-type variable of the name "creator". Will be set in the constructor.
address creator;
// The constructor. It accepts a string input and saves it to the contract's "greeting" variable.
constructor() payable {
creator = msg.sender;
}
/... | contract Suicide {
// At first, an empty "address"-type variable of the name "creator". Will be set in the constructor.
address creator;
// The constructor. It accepts a string input and saves it to the contract's "greeting" variable.
constructor() payable {
creator = msg.sender;
}
/... | 51,565 |
49 | // Returns the balances so that they'll be in the order [underlying, bond]./currentBalances balances sorted low to high of address value. | function _getSortedBalances(uint256[] memory currentBalances)
internal
view
returns (uint256 underlyingBalance, uint256 bondBalance)
| function _getSortedBalances(uint256[] memory currentBalances)
internal
view
returns (uint256 underlyingBalance, uint256 bondBalance)
| 66,562 |
135 | // Actions Opyn Team A library that provides a ActionArgs struct, sub types of Action structs, and functions to parse ActionArgs into specific Actions. / | library Actions {
// possible actions that can be performed
enum ActionType {
OpenVault,
MintShortOption,
BurnShortOption,
DepositLongOption,
WithdrawLongOption,
DepositCollateral,
WithdrawCollateral,
SettleVault,
Redeem,
Call
}... | library Actions {
// possible actions that can be performed
enum ActionType {
OpenVault,
MintShortOption,
BurnShortOption,
DepositLongOption,
WithdrawLongOption,
DepositCollateral,
WithdrawCollateral,
SettleVault,
Redeem,
Call
}... | 9,453 |
4 | // A contract with an owner. Contract ownership can be transferred by first nominating the new owner,who must then accept the ownership, which prevents accidental incorrect ownership transfers. / | contract Owned {
address public owner;
address public nominatedOwner;
/**
* @dev Owned Constructor
*/
constructor(address _owner) public {
require(_owner != address(0), "Owner address cannot be 0");
owner = _owner;
emit OwnerChanged(address(0), _owner);
}
/**
... | contract Owned {
address public owner;
address public nominatedOwner;
/**
* @dev Owned Constructor
*/
constructor(address _owner) public {
require(_owner != address(0), "Owner address cannot be 0");
owner = _owner;
emit OwnerChanged(address(0), _owner);
}
/**
... | 31,354 |
39 | // just in case the contract is bust and can't pay should never be needed but who knows | function fuelContract() public onlyOwner payable {
}
| function fuelContract() public onlyOwner payable {
}
| 79,657 |
24 | // if auction end voucher is already submitted | if(auctionEndVoucherSubmitted[_auctionEndVoucherHash] == true) {
emit LogError(version, "AUCTION_END_VOUCHER_ALREADY_SUBMITED");
return;
}
| if(auctionEndVoucherSubmitted[_auctionEndVoucherHash] == true) {
emit LogError(version, "AUCTION_END_VOUCHER_ALREADY_SUBMITED");
return;
}
| 25,920 |
150 | // Sets approved amount of tokens for spender. Returns success/spender Address of allowed account/value Number of approved tokens/ return Was approval successful? | function approve(address spender, uint value)
public
returns (bool)
| function approve(address spender, uint value)
public
returns (bool)
| 55,161 |
24 | // Get last chainlink oracle data for a given price identifier priceIdentifier Price feed identifierreturn oracleData Oracle data / | function getOracleLatestData(bytes32 priceIdentifier)
external
view
override
onlyPools()
returns (OracleData memory oracleData)
| function getOracleLatestData(bytes32 priceIdentifier)
external
view
override
onlyPools()
returns (OracleData memory oracleData)
| 40,138 |
79 | // takes ethers from zebiwallet to smart contract | function takeEth() external payable {
TakeEth(msg.sender,msg.value);
}
| function takeEth() external payable {
TakeEth(msg.sender,msg.value);
}
| 25,544 |
1 | // safeApprove works only if trying to set to 0 or current allowance is 0 | token.safeApprove(spender, requiredAmount);
return;
| token.safeApprove(spender, requiredAmount);
return;
| 6,686 |
57 | // _presaleTaxFee | function setPresaleTaxFee(uint256 feeValue) external onlyOwner() {
require(feeValue >0, "feeValue must be greater than 0");
_presaleTaxFee = feeValue;
}
| function setPresaleTaxFee(uint256 feeValue) external onlyOwner() {
require(feeValue >0, "feeValue must be greater than 0");
_presaleTaxFee = feeValue;
}
| 31,586 |
26 | // Updates the cached greeks for an OptionBoardCache.greekCacheGlobals The GreekCacheGlobals. boardCacheId The id of the OptionBoardCache. / | function _updateBoardCachedGreeks(ILyraGlobals.GreekCacheGlobals memory greekCacheGlobals, uint boardCacheId)
internal
| function _updateBoardCachedGreeks(ILyraGlobals.GreekCacheGlobals memory greekCacheGlobals, uint boardCacheId)
internal
| 16,565 |
23 | // See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is notrequired by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address.- `sender` must have a balance of at least `amount`.- the caller must have allowance for... | function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "EToken: transfer amount exceeds allowa... | function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "EToken: transfer amount exceeds allowa... | 26,538 |
11 | // Maturity Date & Penalty Interest Rate (per Sec) | uint256 public immutable maturityDate;
uint256 public immutable penaltyRate;
| uint256 public immutable maturityDate;
uint256 public immutable penaltyRate;
| 48,529 |
33 | // Constructor. ownerAddr The address of the owner / | constructor (address ownerAddr) Ownable (ownerAddr) { // solhint-disable-line no-empty-blocks
}
| constructor (address ownerAddr) Ownable (ownerAddr) { // solhint-disable-line no-empty-blocks
}
| 27,107 |
98 | // Emit when new ticker get registers | event RegisterTicker(
address indexed _owner,
string _ticker,
uint256 indexed _registrationDate,
uint256 indexed _expiryDate,
bool _fromAdmin,
uint256 _registrationFeePoly,
uint256 _registrationFeeUsd
);
| event RegisterTicker(
address indexed _owner,
string _ticker,
uint256 indexed _registrationDate,
uint256 indexed _expiryDate,
bool _fromAdmin,
uint256 _registrationFeePoly,
uint256 _registrationFeeUsd
);
| 46,764 |
2 | // Emits when ORGiD delegates are removed / | event OrgIdDelegatesRemoved(
bytes32 indexed orgId,
string[] delegates
);
| event OrgIdDelegatesRemoved(
bytes32 indexed orgId,
string[] delegates
);
| 19,296 |
66 | // File: witnet-ethereum-block-relay/contracts/BlockRelayProxy.sol/ Block Relay Proxy Contract to act as a proxy between the Witnet Bridge Interface and the block relay More information can be found hereDISCLAIMER: this is a work in progress, meaning the contract could be voulnerable to attacks Witnet Foundation / | contract BlockRelayProxy {
// Address of the current controller
address internal blockRelayAddress;
// Current interface to the controller
BlockRelayInterface internal blockRelayInstance;
struct ControllerInfo {
// last epoch seen by a controller
uint256 lastEpoch;
// address of the controller
... | contract BlockRelayProxy {
// Address of the current controller
address internal blockRelayAddress;
// Current interface to the controller
BlockRelayInterface internal blockRelayInstance;
struct ControllerInfo {
// last epoch seen by a controller
uint256 lastEpoch;
// address of the controller
... | 12,602 |
34 | // This is a virtual function that should be overriden so it returns the address to which the fallback function | * and {_fallback} should delegate.
*/
function _implementation() internal virtual view returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internall call site, it will return directly to the ... | * and {_fallback} should delegate.
*/
function _implementation() internal virtual view returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internall call site, it will return directly to the ... | 12,548 |
185 | // 10 | string[] actinides = [
"Actinium",
"Thorium",
"Protactinium",
"Uranium",
"Neptunium",
"Plutonium",
"Americium",
"Curium",
"Berkelium",
| string[] actinides = [
"Actinium",
"Thorium",
"Protactinium",
"Uranium",
"Neptunium",
"Plutonium",
"Americium",
"Curium",
"Berkelium",
| 6,242 |
17 | // and then enumerate through them and get their respective bids... | function getGamesPlayerBids(uint256 gameId, address playerAddress) public view returns(uint256){
return games[gameId].PlayerBidMap[playerAddress];
}
| function getGamesPlayerBids(uint256 gameId, address playerAddress) public view returns(uint256){
return games[gameId].PlayerBidMap[playerAddress];
}
| 21,202 |
107 | // Since tokens have been granted, reduce the total amount available for vesting. | totalVesting = totalVesting.add(_value);
NewGrant(msg.sender, _to, _value);
| totalVesting = totalVesting.add(_value);
NewGrant(msg.sender, _to, _value);
| 44,487 |
2 | // FinalizableCrowdsale Extension of Crowsdale where an owner can do extra workafter finishing. By default, it will end token minting. / | contract FinalizableCrowdsale is Crowdsale, Ownable {
using SafeMath for uint256;
bool public isFinalized = false;
event Finalized();
// should be called after crowdsale ends, to do
// some extra finalization work
function finalize() onlyOwner {
require(!isFinalized);
require(hasEnded());
fi... | contract FinalizableCrowdsale is Crowdsale, Ownable {
using SafeMath for uint256;
bool public isFinalized = false;
event Finalized();
// should be called after crowdsale ends, to do
// some extra finalization work
function finalize() onlyOwner {
require(!isFinalized);
require(hasEnded());
fi... | 46,332 |
88 | // Burn liquidity tokens in exchange for base and fyToken./ The liquidity tokens need to be in this contract./baseTo Wallet receiving the base./fyTokenTo Wallet receiving the fyToken./minRatio Minimum ratio of base to fyToken in the pool./maxRatio Maximum ratio of base to fyToken in the pool./ return The amount of toke... | function burn(address baseTo, address fyTokenTo, uint256 minRatio, uint256 maxRatio)
external override
returns (uint256, uint256, uint256)
| function burn(address baseTo, address fyTokenTo, uint256 minRatio, uint256 maxRatio)
external override
returns (uint256, uint256, uint256)
| 43,919 |
64 | // validate _from,_to address and _value(Now allow with 0) | require(_from != 0 && _to != 0 && _value > 0);
| require(_from != 0 && _to != 0 && _value > 0);
| 81,618 |
12 | // return the root NFT of this tokenId/ | function getRoot(uint256 tokenId) external view returns(uint256);
| function getRoot(uint256 tokenId) external view returns(uint256);
| 4,452 |
361 | // Emits an {Transfer} event to 0 address/ | function burn(uint burnQuantity) public returns (bool) {
_burn(msg.sender, burnQuantity);
return true;
}
| function burn(uint burnQuantity) public returns (bool) {
_burn(msg.sender, burnQuantity);
return true;
}
| 39,377 |
196 | // Limited to a publicly set amount | require(_amount > 0, "Invalid amount is given");
require(_amount <= reserved, "Can't reserve more than set amount");
reserved -= _amount;
for (uint256 i = 1; i <= _amount; i++) {
_safeMint(msg.sender, _tokenIdCounter.current());
_tokenIdCounter.increment();
... | require(_amount > 0, "Invalid amount is given");
require(_amount <= reserved, "Can't reserve more than set amount");
reserved -= _amount;
for (uint256 i = 1; i <= _amount; i++) {
_safeMint(msg.sender, _tokenIdCounter.current());
_tokenIdCounter.increment();
... | 25,084 |
2 | // ! ],! "expected": [! "233"! ] | //! }, {
//! "name": "three",
//! "input": [
//! {
//! "entry": "main",
//! "calldata": [
//! "16"
//! ]
//! }
| //! }, {
//! "name": "three",
//! "input": [
//! {
//! "entry": "main",
//! "calldata": [
//! "16"
//! ]
//! }
| 36,314 |
79 | // Overrides parent by storing balances instead of issuing tokens right away. _beneficiary Token purchaser _tokenAmount Amount of tokens purchased / | function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal {
_balances[_beneficiary] = _balances[_beneficiary].add(_tokenAmount);
}
| function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal {
_balances[_beneficiary] = _balances[_beneficiary].add(_tokenAmount);
}
| 25,483 |
0 | // stores the reserve configuration | ReserveConfigurationMap configuration;
| ReserveConfigurationMap configuration;
| 21,942 |
0 | // prettier-ignore | interface IERC721 {
function totalSupply() external view returns (uint256);
function mint(address _to, uint256 _tokenId) external;
function lock(uint256 tokenId_) external;
}
| interface IERC721 {
function totalSupply() external view returns (uint256);
function mint(address _to, uint256 _tokenId) external;
function lock(uint256 tokenId_) external;
}
| 22,259 |
4 | // claim dividents/ _token token to claim | function claim(address _token){
Config memory cf = dvDetails[msg.sender][_token];
require(block.timestamp.sub(cf.start) > INTREVAL, "still in old period,please wait.");
require(cf.toClaim > 0, "nothing to claim.");
uint256 amount = cf.toClaim;
cf.claimed += amount;
cf... | function claim(address _token){
Config memory cf = dvDetails[msg.sender][_token];
require(block.timestamp.sub(cf.start) > INTREVAL, "still in old period,please wait.");
require(cf.toClaim > 0, "nothing to claim.");
uint256 amount = cf.toClaim;
cf.claimed += amount;
cf... | 25,706 |
137 | // This will suffice for checking _exists(nextTokenId),as a burned slot cannot contain the zero address. | if (nextTokenId != _currentIndex) {
nextSlot.addr = from;
nextSlot.startTimestamp = prevOwnership.startTimestamp;
}
| if (nextTokenId != _currentIndex) {
nextSlot.addr = from;
nextSlot.startTimestamp = prevOwnership.startTimestamp;
}
| 27,274 |
50 | // Sets platform address, assigns symbol and name. Can be set only once._platform platform contract address. _symbol assigned symbol. _name assigned name. return success. / | function init(Platform _platform, string _symbol, string _name) public returns (bool) {
if (address(platform) != 0x0) {
return false;
}
platform = _platform;
symbol = _symbol;
smbl = stringToBytes32(_symbol);
name = _name;
return true;
}
| function init(Platform _platform, string _symbol, string _name) public returns (bool) {
if (address(platform) != 0x0) {
return false;
}
platform = _platform;
symbol = _symbol;
smbl = stringToBytes32(_symbol);
name = _name;
return true;
}
| 11,617 |
42 | // check if address interacting with contract already has an ein | function checkforReg(address _target) public returns(bool){
SnowflakeInterface snowfl = SnowflakeInterface(snowflakeAddress);
IdentityRegistryInterface idRegistry= IdentityRegistryInterface(snowfl.identityRegistryAddress());
_target=msg.sender;
bool hasId=idRegistry.hasIdentity(msg.sender);
return ... | function checkforReg(address _target) public returns(bool){
SnowflakeInterface snowfl = SnowflakeInterface(snowflakeAddress);
IdentityRegistryInterface idRegistry= IdentityRegistryInterface(snowfl.identityRegistryAddress());
_target=msg.sender;
bool hasId=idRegistry.hasIdentity(msg.sender);
return ... | 38,693 |
20 | // update storage with the modified slot | s.selectorSlots[oldSelectorsSlotCount] = oldSelectorSlot;
| s.selectorSlots[oldSelectorsSlotCount] = oldSelectorSlot;
| 32,754 |
1 | // registered | string name;
address nicAddress;
address nicDeNSRoot;
address ownerAddress;
uint256 ownerPublicKey;
| string name;
address nicAddress;
address nicDeNSRoot;
address ownerAddress;
uint256 ownerPublicKey;
| 41,273 |
41 | // Team reserve mint function/number number of tokens to mint | function reserveMint(uint256 number) external onlyOwner {
require(number <= reserve);
reserve -= number;
bulkMint(number);
}
| function reserveMint(uint256 number) external onlyOwner {
require(number <= reserve);
reserve -= number;
bulkMint(number);
}
| 80,188 |
133 | // Gets the official ENS reverse registrar. | function getEnsReverseRegistrar() public view returns (EnsReverseRegistrar) {
return EnsReverseRegistrar(getEnsRegistry().owner(ADDR_REVERSE_NODE));
}
| function getEnsReverseRegistrar() public view returns (EnsReverseRegistrar) {
return EnsReverseRegistrar(getEnsRegistry().owner(ADDR_REVERSE_NODE));
}
| 1,111 |
337 | // Resolution for the Multiple Withdrawal Attack on ERC20 Tokens (ISBN:978-1-7281-3027-9)Similar to ERC20 Transfer event, but also logs an address which executed transferFired in transfer(), transferFrom() and some other (non-ERC20) functions_by an address which performed the transfer _from an address tokens were consu... | event Transferred(address indexed _by, address indexed _from, address indexed _to, uint256 _value);
| event Transferred(address indexed _by, address indexed _from, address indexed _to, uint256 _value);
| 11,316 |
18 | // |/ Burn _amount of tokens of a given token id _fromThe address to burn tokens from _idToken id to burn _amountThe amount to be burned / | function _burn(address _from, uint256 _id, uint256 _amount)
internal
| function _burn(address _from, uint256 _id, uint256 _amount)
internal
| 6,996 |
3 | // Should return whether the signature provided is valid for the provided datahashHash of the data to be signedsignature Signature byte array associated with _data/ | function isValidSignature(
bytes32 hash,
bytes memory signature
)
public
view
returns (
bytes4 magicValue
)
| function isValidSignature(
bytes32 hash,
bytes memory signature
)
public
view
returns (
bytes4 magicValue
)
| 40,920 |
135 | // VARIABLES//locked time(in seconds) | uint public lockedTime = uint(3600*36);
| uint public lockedTime = uint(3600*36);
| 39,289 |
21 | // Funds an existing community if it hasn't enough funds / | function fundCommunity() external override onlyCommunities {
ICommunity community = ICommunity(msg.sender);
uint256 balance = cUSD.balanceOf(msg.sender);
require(
balance < community.minTranche(),
"CommunityAdmin::fundCommunity: this community has enough funds"
... | function fundCommunity() external override onlyCommunities {
ICommunity community = ICommunity(msg.sender);
uint256 balance = cUSD.balanceOf(msg.sender);
require(
balance < community.minTranche(),
"CommunityAdmin::fundCommunity: this community has enough funds"
... | 18,396 |
4 | // This is how we prevent replay by tracking the nonce | updateLastNonce(_msgSender(), voucher.nonce);
if (voucher.currency == address(0)) {
_handleEthPayment(voucher);
} else {
| updateLastNonce(_msgSender(), voucher.nonce);
if (voucher.currency == address(0)) {
_handleEthPayment(voucher);
} else {
| 7,922 |
154 | // Treasury accumulates LP yield | address public treasury;
| address public treasury;
| 48,154 |
4 | // Status of the Basset - has it broken its peg? / | enum BassetStatus {
Default,
Normal,
BrokenBelowPeg,
BrokenAbovePeg,
Blacklisted,
Liquidating,
Liquidated,
Failed
}
| enum BassetStatus {
Default,
Normal,
BrokenBelowPeg,
BrokenAbovePeg,
Blacklisted,
Liquidating,
Liquidated,
Failed
}
| 21,945 |
9 | // Set new trader risk threshold for trader liquidation, only set by owner. _newTraderRiskLiquidateThreshold The new trader risk threshold as percentage. / | function setTraderRiskLiquidateThreshold(uint256 _newTraderRiskLiquidateThreshold) external onlyOwner {
require(_newTraderRiskLiquidateThreshold > 0, "0");
traderRiskLiquidateThreshold = Percentage.Percent(_newTraderRiskLiquidateThreshold);
}
| function setTraderRiskLiquidateThreshold(uint256 _newTraderRiskLiquidateThreshold) external onlyOwner {
require(_newTraderRiskLiquidateThreshold > 0, "0");
traderRiskLiquidateThreshold = Percentage.Percent(_newTraderRiskLiquidateThreshold);
}
| 19,245 |
63 | // for each token holder: last ether balance was when requested dividends | mapping(address => uint256) public m_lastDividends;
uint256 public m_totalHangingDividends;
uint256 public m_totalDividends;
| mapping(address => uint256) public m_lastDividends;
uint256 public m_totalHangingDividends;
uint256 public m_totalDividends;
| 16,178 |
96 | // if propose status is waiting and enough time passed, change status | if (status == PROPOSE_STATUS_WAITING && now.sub(startAt) >= getConfig(_proposeTimelock_)) {
setConfig(_proposeStatus_, ID, PROPOSE_STATUS_VOTING);
status = PROPOSE_STATUS_VOTING;
}
| if (status == PROPOSE_STATUS_WAITING && now.sub(startAt) >= getConfig(_proposeTimelock_)) {
setConfig(_proposeStatus_, ID, PROPOSE_STATUS_VOTING);
status = PROPOSE_STATUS_VOTING;
}
| 40,318 |
230 | // Creates a new Masterpiece with the given name and artist. | function createMasterpiece(
string _name,
string _artist,
uint256 _snatchWindow
)
public
onlyCurator
returns (uint)
| function createMasterpiece(
string _name,
string _artist,
uint256 _snatchWindow
)
public
onlyCurator
returns (uint)
| 41,944 |
88 | // Facilitates a claim and ensures that the claim can only happen after claimBlockNumber | function _claim(address _claimant) private {
require(claimableTokens[_claimant] > 0, "Nothing available");
require(claimed[_claimant] == false, "Already claimed");
require(block.number >= claimBlockNumber, "Cannot claim tokens yet");
claimed[_claimant] = true;
token.transfer... | function _claim(address _claimant) private {
require(claimableTokens[_claimant] > 0, "Nothing available");
require(claimed[_claimant] == false, "Already claimed");
require(block.number >= claimBlockNumber, "Cannot claim tokens yet");
claimed[_claimant] = true;
token.transfer... | 45,459 |
118 | // Helper/wrapper around IRemoteAccessBitmask | library AccessHelper {
function getAcl(IRemoteAccessBitmask remote, address subject) internal view returns (uint256) {
return remote.queryAccessControlMask(subject, ~uint256(0));
}
function queryAcl(
IRemoteAccessBitmask remote,
address subject,
uint256 filterMask
) internal view returns (uint2... | library AccessHelper {
function getAcl(IRemoteAccessBitmask remote, address subject) internal view returns (uint256) {
return remote.queryAccessControlMask(subject, ~uint256(0));
}
function queryAcl(
IRemoteAccessBitmask remote,
address subject,
uint256 filterMask
) internal view returns (uint2... | 58,493 |
6 | // The allowances for withdrawals. | mapping(address => mapping(address => uint256)) withdrawAllowances;
| mapping(address => mapping(address => uint256)) withdrawAllowances;
| 10,623 |
387 | // pay referal percentage | if (referal > 0) referer.transfer(referal);
| if (referal > 0) referer.transfer(referal);
| 20,768 |
2 | // TODO: only_ancestors, only_parents, only_children, only_offspring, only_sibblings |
constructor()
public
|
constructor()
public
| 5,546 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.