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 |
|---|---|---|---|---|
80 | // Reason error codes for the TransactionRelayed event/OK - the transaction was successfully relayed and execution successful - never included in the event/RelayedCallFailed - the transaction was relayed, but the relayed call failed/RejectedByPreRelayed - the transaction was not relayed due to preRelatedCall reverting/... | enum RelayCallStatus {
OK,
RelayedCallFailed,
RejectedByPreRelayed,
RejectedByForwarder,
RejectedByRecipientRevert,
PostRelayedFailed,
PaymasterBalanceChanged
}
| enum RelayCallStatus {
OK,
RelayedCallFailed,
RejectedByPreRelayed,
RejectedByForwarder,
RejectedByRecipientRevert,
PostRelayedFailed,
PaymasterBalanceChanged
}
| 6,622 |
33 | // Calculates how many votes should be withdrawn from eachdeprecated group. withdrawal The total amount of votes that needs to be withdrawn.return deprecatedGroupsWithdrawn The array of deprecated groups to bewithdrawn from.return deprecatedWithdrawalsPerGroup The amount of votes to withdrawfrom the respective deprecat... | function getDeprecatedGroupsWithdrawalDistribution(uint256 withdrawal)
internal
returns (
address[] memory deprecatedGroupsWithdrawn,
uint256[] memory deprecatedWithdrawalsPerGroup,
uint256 numberDeprecatedGroupsWithdrawn,
uint256 remainingWithdrawal
... | function getDeprecatedGroupsWithdrawalDistribution(uint256 withdrawal)
internal
returns (
address[] memory deprecatedGroupsWithdrawn,
uint256[] memory deprecatedWithdrawalsPerGroup,
uint256 numberDeprecatedGroupsWithdrawn,
uint256 remainingWithdrawal
... | 29,034 |
17 | // Returns the amount of tokens approved by the owner that can betransferred to the spender's account tokenOwner Address of token owner we check for allowance on spender Address of spender that token owner approved to spend on his behalfreturn uint / | function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
return super.allowance(tokenOwner, spender);
}
| function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
return super.allowance(tokenOwner, spender);
}
| 26,413 |
14 | // update l2 latest store block number_l2StoredBlockNumber l2 latest block number/ | function updateL2StoredBlockNumber(uint256 _l2StoredBlockNumber) external {
require(msg.sender == sequencer, "Only the sequencer can set latest l2 block number");
l2StoredBlockNumber = _l2StoredBlockNumber;
}
| function updateL2StoredBlockNumber(uint256 _l2StoredBlockNumber) external {
require(msg.sender == sequencer, "Only the sequencer can set latest l2 block number");
l2StoredBlockNumber = _l2StoredBlockNumber;
}
| 1,787 |
22 | // get reward pool for the given token | RewardPool storage pool = rewardPools[tokenAddress];
| RewardPool storage pool = rewardPools[tokenAddress];
| 32,969 |
146 | // Resets last validator - the one with the smallest vesting balance | function resetLastActiveValidator(ChainInfo storage chain) internal {
address foundLastValidatorAcc = chain.validators.list[0];
uint256 foundLastValidatorVesting = chain.usersData[foundLastValidatorAcc].validator.vesting;
address actValidatorAcc;
uint256 actValidatorVest... | function resetLastActiveValidator(ChainInfo storage chain) internal {
address foundLastValidatorAcc = chain.validators.list[0];
uint256 foundLastValidatorVesting = chain.usersData[foundLastValidatorAcc].validator.vesting;
address actValidatorAcc;
uint256 actValidatorVest... | 18,569 |
15 | // solium-disable-next-line indentation | uint256(keccak256(abi.encodePacked(nonceTimesGeneratorAddress, msgHash)));
| uint256(keccak256(abi.encodePacked(nonceTimesGeneratorAddress, msgHash)));
| 44,893 |
37 | // Add/update allowed max expiration _maxExpiration maximum expiration time of option / | function addAllowedMaxExpiration(uint256 _maxExpiration) public onlyOwner(msg.sender) {
allowedMaxExpiration[_maxExpiration] = true;
}
| function addAllowedMaxExpiration(uint256 _maxExpiration) public onlyOwner(msg.sender) {
allowedMaxExpiration[_maxExpiration] = true;
}
| 32,819 |
68 | // Give rewards to voters and return the outcome of the vote | function ConcludeProposal(uint vetoTime, UserManager UMI) external returns (int){
// Require that all voters are able to voter
require(VotingTokensCreated == voters.getValuesLength(),
"Have not created all the VotingTokens");
// Require that enough time has passed for the old account to veto an attack
if... | function ConcludeProposal(uint vetoTime, UserManager UMI) external returns (int){
// Require that all voters are able to voter
require(VotingTokensCreated == voters.getValuesLength(),
"Have not created all the VotingTokens");
// Require that enough time has passed for the old account to veto an attack
if... | 11,461 |
12 | // _die(); | _this.emitApoptosis(
receiver
);
| _this.emitApoptosis(
receiver
);
| 50,183 |
44 | // BLO token contract. | BlokToken public blok;
| BlokToken public blok;
| 26,827 |
11 | // Transfer purchased assets to msg.sender. | transferAssetToSender(orders[0].makerAssetData, makerAssetAmountPurchased);
| transferAssetToSender(orders[0].makerAssetData, makerAssetAmountPurchased);
| 1,166 |
158 | // internal implementation of unstaking methods amount number of tokens to unstake gysr number of GYSR tokens applied to unstaking operationreturn number of reward tokens distributed / | function _unstake(uint256 amount, uint256 gysr)
private
nonReentrant
returns (uint256)
| function _unstake(uint256 amount, uint256 gysr)
private
nonReentrant
returns (uint256)
| 38,125 |
503 | // A modifier which checks if whitelisted for minting. | modifier onlyWhitelisted() {
require(whiteList[msg.sender], "Transmuter: !whitelisted");
_;
}
| modifier onlyWhitelisted() {
require(whiteList[msg.sender], "Transmuter: !whitelisted");
_;
}
| 35,673 |
295 | // Storage for the `oracleId` results dataCache[oracleId][timestamp] => data | mapping (address => mapping(uint256 => uint256)) public dataCache;
| mapping (address => mapping(uint256 => uint256)) public dataCache;
| 34,314 |
23 | // ERC721TradableERC721Tradable - ERC721 contract that whitelists a trading address, and has minting functionality. / | abstract contract ERC721Tradable is ContextMixin, ERC721Enumerable, NativeMetaTransaction, Ownable {
using SafeMath for uint256;
address proxyRegistryAddress;
mapping (address => bool) operators;
mapping (uint256 => uint256) tokenToSeries;
struct Series {
string name;
str... | abstract contract ERC721Tradable is ContextMixin, ERC721Enumerable, NativeMetaTransaction, Ownable {
using SafeMath for uint256;
address proxyRegistryAddress;
mapping (address => bool) operators;
mapping (uint256 => uint256) tokenToSeries;
struct Series {
string name;
str... | 4,092 |
89 | // List ntoken information by page/offset Skip previous (offset) records/count Return (count) records/order Order. 0 reverse order, non-0 positive order/ return ntoken information by page | function list(uint offset, uint count, uint order) external view returns (NTokenTag[] memory);
| function list(uint offset, uint count, uint order) external view returns (NTokenTag[] memory);
| 37,237 |
26 | // Returns the minimum input asset amount required to buy the given output asset amount and the prices amountOut Amount of reserveOut reserveIn Address of the asset to be swap from reserveOut Address of the asset to be swap toreturn uint256 Amount in of the reserveInreturn uint256 The price of in amount denominated in ... | function getAmountsIn(
uint256 amountOut,
address reserveIn,
address reserveOut
)
external
view
override
returns (
uint256,
| function getAmountsIn(
uint256 amountOut,
address reserveIn,
address reserveOut
)
external
view
override
returns (
uint256,
| 11,926 |
38 | // Withdraw everything from external pool | function exitRewardPool() internal virtual {
uint bal = _rewardPoolBalance();
if (bal != 0) {
withdrawAndClaimFromPool(bal);
}
}
| function exitRewardPool() internal virtual {
uint bal = _rewardPoolBalance();
if (bal != 0) {
withdrawAndClaimFromPool(bal);
}
}
| 11,612 |
37 | // Unstakes the given token IDs and claim $WRAB rewards.Merkle proofs are used to validate rarityMultipliers and prevent usersfrom claiming more rewards than they are supposed to from the contractdirectly by inputting a false rarity multiplier. / |
function _unstake(
uint256[] calldata tokenIds,
uint256[] calldata rarityMultipliers,
bytes32[][] calldata merkleProofs,
bool revertIfNotEnoughWRAB
|
function _unstake(
uint256[] calldata tokenIds,
uint256[] calldata rarityMultipliers,
bytes32[][] calldata merkleProofs,
bool revertIfNotEnoughWRAB
| 17,770 |
0 | // Interface for a middleware / service that may look at past stake amounts. Layr Labs, Inc. Specifically, this interface is designed for services that consult stake amounts up to `BLOCK_STALE_MEASURE`blocks in the past. This may be necessary due to, e.g., network processing & communication delays, or to avoid race con... | interface IDelayedService {
/// @notice The maximum amount of blocks in the past that the service will consider stake amounts to still be 'valid'.
function BLOCK_STALE_MEASURE() external view returns(uint32);
}
| interface IDelayedService {
/// @notice The maximum amount of blocks in the past that the service will consider stake amounts to still be 'valid'.
function BLOCK_STALE_MEASURE() external view returns(uint32);
}
| 29,767 |
12 | // Runs a while loop to continue minting for the set amount asked. | for (uint8 counter = 0; counter < _amount; counter++) {
| for (uint8 counter = 0; counter < _amount; counter++) {
| 25,453 |
61 | // Initiate the account of destinations[i] with values[i]. The function must only be called when the contract is paused. The caller must check that destinations are unique addresses. For a large number of destinations, separate the balances initialization in different calls to batchTransfer.destinations List of address... | function batchTransfer(address[] memory destinations, uint256[] memory values) public onlyOwner whenPaused {
require(destinations.length == values.length);
uint256 length = destinations.length;
uint i;
for (i=0; i < length; i++) {
rewards[destinations[i]] = values[i];
... | function batchTransfer(address[] memory destinations, uint256[] memory values) public onlyOwner whenPaused {
require(destinations.length == values.length);
uint256 length = destinations.length;
uint i;
for (i=0; i < length; i++) {
rewards[destinations[i]] = values[i];
... | 5,980 |
73 | // Mapping from NFT ID to approved address. / | mapping (uint256 => address) internal idToApproval;
| mapping (uint256 => address) internal idToApproval;
| 21,026 |
581 | // Burns tokens from msg.sender, decreases totalSupply, initSupply, and a users balance./ |
function burn(uint256 amount)
override
external
returns (bool)
|
function burn(uint256 amount)
override
external
returns (bool)
| 7,996 |
44 | // Info of each user that stakes LP tokens. | mapping (uint256 => mapping (address => UserInfo)) public userInfo;
uint256 public rewardPerSecond;
IERC20 public masterLpToken;
uint256 private constant ACC_TOKEN_PRECISION = 1e12;
address public immutable MASTERCHEF_V2;
uint256 internal unlocked;
| mapping (uint256 => mapping (address => UserInfo)) public userInfo;
uint256 public rewardPerSecond;
IERC20 public masterLpToken;
uint256 private constant ACC_TOKEN_PRECISION = 1e12;
address public immutable MASTERCHEF_V2;
uint256 internal unlocked;
| 9,452 |
31 | // We do not want the validator to ever prevent reporting, so we limit its gas usage and catch any errors that may arise. | try vc.validator.validate{gas: vc.gasLimit}(
| try vc.validator.validate{gas: vc.gasLimit}(
| 28,259 |
58 | // if address is 0, then it's ETH | if (_addr == address(0x0)) {
decimals = 18;
} else if (isContract(_addr)) {
| if (_addr == address(0x0)) {
decimals = 18;
} else if (isContract(_addr)) {
| 53,336 |
134 | // ============ Private/Internal Functions ============ //Participant enters the pool and enter amount is transferred from the user to the pool. / | function _enterPool() internal returns(uint256 _participantIndex) {
participants.push(msg.sender);
totalEnteredAmount = totalEnteredAmount.add(poolConfig.enterAmount);
if (participants.length == poolConfig.participantLimit) {
emit MaxParticipationCompleted(msg.sender);
... | function _enterPool() internal returns(uint256 _participantIndex) {
participants.push(msg.sender);
totalEnteredAmount = totalEnteredAmount.add(poolConfig.enterAmount);
if (participants.length == poolConfig.participantLimit) {
emit MaxParticipationCompleted(msg.sender);
... | 54,340 |
5 | // BEP20 | function name() public pure returns (string memory) {
return _name;
}
| function name() public pure returns (string memory) {
return _name;
}
| 94 |
20 | // send / withdraw _amount to _payee_payee the address where the funds are going to go_amount the amount of Ether that will be sent/ | function withdrawFromContract(address _payee, uint _amount) external onlyOwner {
require(_payee != address(0) && _payee != address(this));
require(contractBalance >= _amount, INSUFICIENT_BALANCE);
require(_amount > 0 && _amount <= address(this).balance, NOT_EHOUGH_ETHER);
//we check... | function withdrawFromContract(address _payee, uint _amount) external onlyOwner {
require(_payee != address(0) && _payee != address(this));
require(contractBalance >= _amount, INSUFICIENT_BALANCE);
require(_amount > 0 && _amount <= address(this).balance, NOT_EHOUGH_ETHER);
//we check... | 20,092 |
1 | // Owner of the contract | address private _upgradeabilityOwner;
| address private _upgradeabilityOwner;
| 37,469 |
18 | // Array of all snaps | SnapEntry[] public snaps;
| SnapEntry[] public snaps;
| 7,157 |
112 | // make the swap Due to the characteristics of the project, it is not possible to define a minimum amount receivable. | uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
return true;
| uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
return true;
| 31,004 |
37 | // save the address of the offer | mapOffers[nCurrentId] = objOffer;
| mapOffers[nCurrentId] = objOffer;
| 20,329 |
37 | // Sets the vote-unready threshold/ voteUnreadyPercentMilleThreshold - the minimum threshold in percent-mille (0-100,000) | function setVoteUnreadyPercentMilleThreshold(uint32 voteUnreadyPercentMilleThreshold) external /* onlyFunctionalManager onlyWhenActive */;
| function setVoteUnreadyPercentMilleThreshold(uint32 voteUnreadyPercentMilleThreshold) external /* onlyFunctionalManager onlyWhenActive */;
| 8,452 |
7 | // 소유주의 본부 ID들을 반환합니다. | function getOwnerHQIds(address owner) view external returns (uint[] memory);
| function getOwnerHQIds(address owner) view external returns (uint[] memory);
| 48,776 |
36 | // Deposit payout | if(to_payout > 0) {
if(users[msg.sender].payouts + to_payout > max_payout) {
to_payout = max_payout - users[msg.sender].payouts;
}
| if(to_payout > 0) {
if(users[msg.sender].payouts + to_payout > max_payout) {
to_payout = max_payout - users[msg.sender].payouts;
}
| 1,899 |
164 | // Prevents other msg.sender than controller or vault addresses | modifier onlyControllerOrVault() {
require(
_msgSender() == controller ||
_msgSender() == IController(controller).vaults(_want),
"!controller|vault"
);
_;
}
| modifier onlyControllerOrVault() {
require(
_msgSender() == controller ||
_msgSender() == IController(controller).vaults(_want),
"!controller|vault"
);
_;
}
| 80,893 |
38 | // burn div | bool public _closeFee = false;
uint256 public _burndiv = 2;
string private _name = 'EarnDefiCoin';
string private _symbol = 'EDC';
uint8 private _decimals = 9;
| bool public _closeFee = false;
uint256 public _burndiv = 2;
string private _name = 'EarnDefiCoin';
string private _symbol = 'EDC';
uint8 private _decimals = 9;
| 49,050 |
431 | // Returns C-OP mapping contract/ | function copMapping() private view returns (CopMappingInterface){
return CopMappingInterface(_copMappingAddress);
}
| function copMapping() private view returns (CopMappingInterface){
return CopMappingInterface(_copMappingAddress);
}
| 32,698 |
188 | // Check whether the account has been changed before and mark it as changed if not. We need this because "nuisance gas" only applies to the first time that an account is changed. | bool _wasAccountAlreadyChanged = ovmStateManager.testAndSetAccountChanged(
_address
);
| bool _wasAccountAlreadyChanged = ovmStateManager.testAndSetAccountChanged(
_address
);
| 45,580 |
220 | // Contract initializer/ | function init(string memory __name, string memory __symbol, uint __decimals, uint __totalSupply, address __owner, address __admin) internal initializer {
__Ownable_init();
__ERC20PresetMinterPauser_init(__name, __symbol);
_setupDecimals(uint8(__decimals));
_decimalsMultiplier = 10 ... | function init(string memory __name, string memory __symbol, uint __decimals, uint __totalSupply, address __owner, address __admin) internal initializer {
__Ownable_init();
__ERC20PresetMinterPauser_init(__name, __symbol);
_setupDecimals(uint8(__decimals));
_decimalsMultiplier = 10 ... | 76,236 |
68 | // An event thats emitted when a delegate account's vote balance changes | event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
| event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
| 12,156 |
8 | // Transfer `tokens` tokens from `src` to `dst` by `spender` Called by both `transfer` and `transferFrom` internally spender The address of the account performing the transfer src The address of the source account dst The address of the destination account tokens The number of tokens to transferreturn Whether or not th... | function transferTokens(address spender, address src, address dst, uint tokens) internal returns (uint) {
/* Fail if transfer not allowed */
uint allowed = comptroller.transferAllowed(address(this), src, dst, tokens);
if (allowed != 0) {
return failOpaque(Error.COMPTROLLER_REJECT... | function transferTokens(address spender, address src, address dst, uint tokens) internal returns (uint) {
/* Fail if transfer not allowed */
uint allowed = comptroller.transferAllowed(address(this), src, dst, tokens);
if (allowed != 0) {
return failOpaque(Error.COMPTROLLER_REJECT... | 16,188 |
199 | // move tokens to the team multisig wallet | 16,871 | ||
8 | // bytes32 theAddress = stringToBytes32(_address1); | address retAddress= bytesToAddress(stringToByte(_address1));
return retAddress;
| address retAddress= bytesToAddress(stringToByte(_address1));
return retAddress;
| 39,832 |
55 | // import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; | using SafeERC20 for IERC20;
address constant ETHER = address(0);
event LogWithdraw(
address indexed _from,
address indexed _assetAddress,
uint amount
);
| using SafeERC20 for IERC20;
address constant ETHER = address(0);
event LogWithdraw(
address indexed _from,
address indexed _assetAddress,
uint amount
);
| 1,432 |
7 | // return name the name of the token / | function name() external view returns(string memory);
| function name() external view returns(string memory);
| 29,569 |
208 | // set the implementation for the admin, this needs to be in a base class else we cannot set it newImpl address pf the implementation / | function setAdminImpl(address newImpl) external onlyGovernor {
bytes32 position = adminImplPosition;
assembly {
sstore(position, newImpl)
}
}
| function setAdminImpl(address newImpl) external onlyGovernor {
bytes32 position = adminImplPosition;
assembly {
sstore(position, newImpl)
}
}
| 72,144 |
112 | // Take one off the poolId | poolId = offsetPoolId - 1;
| poolId = offsetPoolId - 1;
| 60,601 |
106 | // specify the only account that can resolve blueprint prediction states and transfer RBLX tokens from a blueprint contract to buyer, creator, or fee collection admin can change address of oracle to be used for blueprints created thereafter, see NOTE5 for clarifications | rblxOracleAddress = _rblxOracleAddress;
| rblxOracleAddress = _rblxOracleAddress;
| 20,178 |
236 | // Exit early if all debt was allocated. | if (debtToBeAttributedPoints == 0) {
break;
}
| if (debtToBeAttributedPoints == 0) {
break;
}
| 30,022 |
36 | // internal | function _approve(address to, uint tokenId) internal{
_tokenApprovals[tokenId] = to;
emit Approval(ownerOf(tokenId), to, tokenId);
}
| function _approve(address to, uint tokenId) internal{
_tokenApprovals[tokenId] = to;
emit Approval(ownerOf(tokenId), to, tokenId);
}
| 69,148 |
16 | // otherwise, use the default ERC721.isApprovedForAll() | return ERC721.isApprovedForAll(_owner, _operator);
| return ERC721.isApprovedForAll(_owner, _operator);
| 3,671 |
10 | // Prevent account from minting tokens and voting _address The address to add to the blacklist / | function addToBlacklist(address _address) public onlyOwner {
blacklist[_address] = true;
}
| function addToBlacklist(address _address) public onlyOwner {
blacklist[_address] = true;
}
| 31,966 |
25 | // function addPharmacyCompany( address _pharmacyCompany, string memory _name, uint256 _pharmacyCompanyId | // ) public {
// require(
// allPharmacyCompany[_pharmacyCompany].isAdded == false,
// "you already added yourself"
// );
// PharmacyCompany storage newPharmacyCompany = allPharmacyCompany[
// _pharmacyCompany
// ];
// newPharmacyCompany.p... | // ) public {
// require(
// allPharmacyCompany[_pharmacyCompany].isAdded == false,
// "you already added yourself"
// );
// PharmacyCompany storage newPharmacyCompany = allPharmacyCompany[
// _pharmacyCompany
// ];
// newPharmacyCompany.p... | 26,192 |
89 | // X-CARD / | ) public override onlyAdmin {
ERC721State.ERC721LAState storage state = ERC721State
._getERC721LAState();
state._xCardContractAddress = xCardContractAddress;
}
| ) public override onlyAdmin {
ERC721State.ERC721LAState storage state = ERC721State
._getERC721LAState();
state._xCardContractAddress = xCardContractAddress;
}
| 40,242 |
48 | // tokenId => (child address => array of child tokens) | mapping(uint256 => mapping(address => EnumerableSet.UintSet))
private childTokens;
| mapping(uint256 => mapping(address => EnumerableSet.UintSet))
private childTokens;
| 9,026 |
69 | // Elliptic Curve Digital Signature Algorithm (ECDSA) operations. These functions can be used to verify that a message was signed by the holderof the private keys of a given address. / | library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do noth... | library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do noth... | 422 |
107 | // Provides an interface to the ratio unitreturn Ratio scale unit (1e8 or 1108) / | function getRatioScale() internal pure returns (uint256) {
return RATIO_SCALE;
}
| function getRatioScale() internal pure returns (uint256) {
return RATIO_SCALE;
}
| 9,961 |
22 | // Misc | uint256 internal constant SHOULD_NOT_HAPPEN = 999;
| uint256 internal constant SHOULD_NOT_HAPPEN = 999;
| 3,298 |
263 | // EnumerableSet of all msdTokens | EnumerableSetUpgradeable.AddressSet internal msdTokens;
| EnumerableSetUpgradeable.AddressSet internal msdTokens;
| 52,197 |
246 | // Returns the total rewards currently available for withdrawal. (For calling from inside the contract) / | function _calculateWithdrawableAmount(address _property, address _user)
private
view
returns (uint256 _amount, uint256 _price)
| function _calculateWithdrawableAmount(address _property, address _user)
private
view
returns (uint256 _amount, uint256 _price)
| 35,077 |
14 | // Revokes a prior confirmation of the given operation | function revoke(bytes32 _operation) external {
uint memberIndex = m_memberIndex[uint(msg.sender)];
// make sure they're an member
if (memberIndex == 0)
return;
uint memberIndexBit = 2**memberIndex;
var pending = m_pending[_operation];
if (pending.membersD... | function revoke(bytes32 _operation) external {
uint memberIndex = m_memberIndex[uint(msg.sender)];
// make sure they're an member
if (memberIndex == 0)
return;
uint memberIndexBit = 2**memberIndex;
var pending = m_pending[_operation];
if (pending.membersD... | 45,347 |
47 | // Token contract - Implements Standard Token Interface but adds Charity Support :)/Rishab Hegde - <contact@rishabhegde.com> | contract FoolToken is StandardToken, Escapable {
/*
* Token meta data
*/
string constant public name = "FoolToken";
string constant public symbol = "FOOL";
uint8 constant public decimals = 18;
bool public alive = true;
Campaign public beneficiary; // expected to be a Giveth campaign
... | contract FoolToken is StandardToken, Escapable {
/*
* Token meta data
*/
string constant public name = "FoolToken";
string constant public symbol = "FOOL";
uint8 constant public decimals = 18;
bool public alive = true;
Campaign public beneficiary; // expected to be a Giveth campaign
... | 30,307 |
49 | // Allows the current admin to set the admin in one tx. Useful initial deployment. newAdmin The address to transfer ownership to. / | function transferAdminQuickly(address newAdmin) public onlyAdmin {
require(newAdmin != address(0), "admin 0");
emit TransferAdminPending(newAdmin);
emit AdminClaimed(newAdmin, admin);
admin = newAdmin;
}
| function transferAdminQuickly(address newAdmin) public onlyAdmin {
require(newAdmin != address(0), "admin 0");
emit TransferAdminPending(newAdmin);
emit AdminClaimed(newAdmin, admin);
admin = newAdmin;
}
| 29,155 |
3 | // grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. Requirements: - `start` < `stop` / | function tokensOfOwnerIn(
address owner,
uint256 start,
uint256 stop
) external view returns (uint256[] memory) {
unchecked {
if (start >= stop) revert InvalidQueryRange();
uint256 tokenIdsIdx;
uint256 stopLimit = _currentIndex;
| function tokensOfOwnerIn(
address owner,
uint256 start,
uint256 stop
) external view returns (uint256[] memory) {
unchecked {
if (start >= stop) revert InvalidQueryRange();
uint256 tokenIdsIdx;
uint256 stopLimit = _currentIndex;
| 3,793 |
5 | // 2Rt/d | Decimal.D256 memory start = Decimal.ratio(_totalReward, _duration).mul(2).mul(_time);
| Decimal.D256 memory start = Decimal.ratio(_totalReward, _duration).mul(2).mul(_time);
| 2,042 |
161 | // Get all tokens owned by owner. / | function ownerTokens(address owner) public view returns (uint256[] memory) {
uint256 tokenCount = ERC721Sequencial.balanceOf(owner);
require(tokenCount != 0, "ERC721Enumerable: owner owns no tokens");
uint256 length = _owners.length;
uint256[] memory tokenIds = new uint256[](tokenCo... | function ownerTokens(address owner) public view returns (uint256[] memory) {
uint256 tokenCount = ERC721Sequencial.balanceOf(owner);
require(tokenCount != 0, "ERC721Enumerable: owner owns no tokens");
uint256 length = _owners.length;
uint256[] memory tokenIds = new uint256[](tokenCo... | 78,984 |
87 | // @notify Pull funds from the dripper/ | function pullFunds() public {
rewardDripper.dripReward(address(rewardPool));
}
| function pullFunds() public {
rewardDripper.dripReward(address(rewardPool));
}
| 38,135 |
18 | // function to get current limit (per-person proposable number of projects) /return current upper limit | function get_proposal_limit() public view returns (uint256){
return Proposal_limit;
}
| function get_proposal_limit() public view returns (uint256){
return Proposal_limit;
}
| 6,942 |
28 | // delegatecall returns 0 on error. | case 0 { revert(0, returndatasize()) }
| case 0 { revert(0, returndatasize()) }
| 8,268 |
613 | // Decompose an ABI-encoded SignatureError./encoded ABI-encoded revert error./ return errorCode The error code./ return signerAddress The expected signer of the hash./ return signature The full signature. | function decodeSignatureError(bytes memory encoded)
internal
pure
returns (
LibExchangeRichErrors.SignatureErrorCodes errorCode,
bytes32 hash,
address signerAddress,
bytes memory signature
)
| function decodeSignatureError(bytes memory encoded)
internal
pure
returns (
LibExchangeRichErrors.SignatureErrorCodes errorCode,
bytes32 hash,
address signerAddress,
bytes memory signature
)
| 55,001 |
436 | // Duration of the lockreturn Returns the duration of the lock in blocks. / | function lockDuration() public view returns (uint256) {
return blocklock.lockDuration;
}
| function lockDuration() public view returns (uint256) {
return blocklock.lockDuration;
}
| 55,337 |
246 | // We calculate the new borrower and total borrow balancesaccountBorrowsNew = accountBorrows - actualRepayAmount | (vars.mathErr, vars.accountBorrowsNew) = subUInt(
vars.accountBorrows,
vars.repayAmount
);
require(vars.mathErr == MathError.NO_ERROR, "Repay borrow new account balance calculation failed");
| (vars.mathErr, vars.accountBorrowsNew) = subUInt(
vars.accountBorrows,
vars.repayAmount
);
require(vars.mathErr == MathError.NO_ERROR, "Repay borrow new account balance calculation failed");
| 24,070 |
14 | // see IVoting interface | (
bool open,
bool executed,
| (
bool open,
bool executed,
| 36,047 |
321 | // We can skip the period, as no debt minted during period (next period's startingDebtIndex is still 0) | if (nextPeriodStartingDebtIndex > 0 && lastFeeWithdrawal < _recentFeePeriodsStorage(i).feePeriodId) {
| if (nextPeriodStartingDebtIndex > 0 && lastFeeWithdrawal < _recentFeePeriodsStorage(i).feePeriodId) {
| 4,787 |
29 | // Thrown if the bond hasn't matured yet, or redeeming is paused | error BondNotRedeemable();
| error BondNotRedeemable();
| 35,403 |
257 | // calculates the amount of collateral needed in ETH to cover a new borrow. _reserve the reserve from which the user wants to borrow _amount the amount the user wants to borrow _fee the fee for the amount that the user needs to cover _userCurrentBorrowBalanceTH the current borrow balance of the user (before the borrow)... | ) external view returns (uint256) {
uint256 reserveDecimals = core.getReserveDecimals(_reserve);
IPriceOracleGetter oracle = IPriceOracleGetter(addressesProvider.getPriceOracle());
uint256 requestedBorrowAmountETH = oracle
.getAssetPrice(_reserve)
.mul(_amount.add(_... | ) external view returns (uint256) {
uint256 reserveDecimals = core.getReserveDecimals(_reserve);
IPriceOracleGetter oracle = IPriceOracleGetter(addressesProvider.getPriceOracle());
uint256 requestedBorrowAmountETH = oracle
.getAssetPrice(_reserve)
.mul(_amount.add(_... | 6,909 |
17 | // Restricted data (refernce from the VolumeRestrictionLib library ) | RestrictedData holderData;
| RestrictedData holderData;
| 18,003 |
32 | // ------------------------------Fallback------------------------------ Fallback function: just throw an exception to stop execution. | function (){ throw; }
| function (){ throw; }
| 10,781 |
98 | // 33 IN DATA / SET DATA / GET DATA / STRING / PUBLIC / ONLY OWNER / CONSTANT |
string inCCH_edit_33 = " une première phrase " ;
|
string inCCH_edit_33 = " une première phrase " ;
| 83,901 |
5 | // Emitted when a transfer has its external data executed transferId - The unique identifier of the crosschain transfer. success - Whether calldata succeeded returnData - Return bytes from the IXReceiver / | event ExternalCalldataExecuted(bytes32 indexed transferId, bool success, bytes returnData);
| event ExternalCalldataExecuted(bytes32 indexed transferId, bool success, bytes returnData);
| 29,981 |
5 | // `value` tokens were transfered from the bank to `to`/the balance of `from` was decreased by `value`/is triggered on any successful call to `transferTokens`/from the account/contract that called `transferTokens` and/got their balance decreased by `value`/to the one that received `value` tokens from the bank/value amo... | event Transfer(address indexed from, address to, uint256 value);
| event Transfer(address indexed from, address to, uint256 value);
| 15,056 |
542 | // We alow anyone to withdraw these funds for the account owner | function withdrawFromMerkleTree(
ExchangeData.State storage S,
ExchangeData.MerkleProof calldata merkleProof
)
public
| function withdrawFromMerkleTree(
ExchangeData.State storage S,
ExchangeData.MerkleProof calldata merkleProof
)
public
| 24,208 |
6 | // give us the juice | IERC20(_protocolToken).transfer(address(this), _totalTokenAmount);
| IERC20(_protocolToken).transfer(address(this), _totalTokenAmount);
| 8,859 |
22 | // compressedData key | struct Player {
address addr; // player address
uint256 gen; // general vault
uint256 percent; // gen percent vault
}
| struct Player {
address addr; // player address
uint256 gen; // general vault
uint256 percent; // gen percent vault
}
| 18,271 |
7 | // create deposit | stablecoin.safeTransferFrom(
_creator,
address(this),
_initialDepositAmount
);
stablecoin.safeIncreaseAllowance(address(pool), type(uint256).max);
uint256 interestAmount;
(depositID, interestAmount) = pool.deposit(
_initialDepositAm... | stablecoin.safeTransferFrom(
_creator,
address(this),
_initialDepositAmount
);
stablecoin.safeIncreaseAllowance(address(pool), type(uint256).max);
uint256 interestAmount;
(depositID, interestAmount) = pool.deposit(
_initialDepositAm... | 52,195 |
109 | // Changes the username for a user / | function changeUsername(string memory newName) public {
address sender = _msgSender();
require(validateName(newName) == true, "Not a valid new name");
require(sha256(bytes(newName)) != sha256(bytes(_usernames[sender])), "New username is same as the current one");
require(isUserNameRe... | function changeUsername(string memory newName) public {
address sender = _msgSender();
require(validateName(newName) == true, "Not a valid new name");
require(sha256(bytes(newName)) != sha256(bytes(_usernames[sender])), "New username is same as the current one");
require(isUserNameRe... | 11,150 |
38 | // update mappings with custom token | bytes29 _tokenId = BridgeMessage.formatTokenId(_domain, _id);
representationToCanonical[_custom].domain = _tokenId.domain();
representationToCanonical[_custom].id = _tokenId.id();
bytes32 _idHash = _tokenId.keccak();
canonicalToRepresentation[_idHash] = _custom;
| bytes29 _tokenId = BridgeMessage.formatTokenId(_domain, _id);
representationToCanonical[_custom].domain = _tokenId.domain();
representationToCanonical[_custom].id = _tokenId.id();
bytes32 _idHash = _tokenId.keccak();
canonicalToRepresentation[_idHash] = _custom;
| 14,614 |
7 | // Let user to add liquidity by supplying stable coin, access: ANY/_liqudityAmount is amount of stable coin tokens to secure | function addLiquidity(uint256 _liqudityAmount) external;
| function addLiquidity(uint256 _liqudityAmount) external;
| 55,692 |
12 | // This function is used to send ether to winner address | function transferAmount() public payable {
// check ether value should be greater than '.0001'
require(msg.value > .0001 ether);
// Check the sender address should be equal to organizer address
// since the organizer can only send ether to winner
require(msg.sender ==... | function transferAmount() public payable {
// check ether value should be greater than '.0001'
require(msg.value > .0001 ether);
// Check the sender address should be equal to organizer address
// since the organizer can only send ether to winner
require(msg.sender ==... | 18,190 |
71 | // How dividends work: - A "point" is a fraction of a Wei (1e-32), it's used to reduce rounding errors. - totalPointsPerToken represents how many points each token is entitled to from all the dividends ever received. Each time a new deposit is made, it is incremented by the points oweable per token at the time of depos... | uint constant POINTS_PER_WEI = 1e32;
uint public dividendsTotal;
uint public dividendsCollected;
uint public totalPointsPerToken;
uint public totalBurned;
mapping (address => uint) public creditedPoints;
mapping (address => uint) public lastPointsPerToken;
| uint constant POINTS_PER_WEI = 1e32;
uint public dividendsTotal;
uint public dividendsCollected;
uint public totalPointsPerToken;
uint public totalBurned;
mapping (address => uint) public creditedPoints;
mapping (address => uint) public lastPointsPerToken;
| 46,000 |
6 | // Returns the multiplication of two unsigned integers, reverting on overflow. Counterpart to Solidity's `` operator. Requirements: - Multiplication cannot overflow./ | // function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// // benefit is lost if 'b' is also tested.
// // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
// if (a ... | // function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// // benefit is lost if 'b' is also tested.
// // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
// if (a ... | 59,142 |
2 | // function sliceRoleMembers(bytes32 role,uint256 start,uint256 end)external view returns(address[] memory); |
function getRoleAdmin(
bytes32 role
)external view returns(
bytes32
);
|
function getRoleAdmin(
bytes32 role
)external view returns(
bytes32
);
| 1,323 |
21 | // Store the refund amount | refunds[lotteryId][player] = refundAmount;
| refunds[lotteryId][player] = refundAmount;
| 29,504 |
44 | // See {IERC721-ownerOf}. / | function ownerOf(uint256 tokenId) public view override returns (address) {
return address(uint160(_packedOwnershipOf(tokenId)));
}
| function ownerOf(uint256 tokenId) public view override returns (address) {
return address(uint160(_packedOwnershipOf(tokenId)));
}
| 13,185 |
12 | // Withdraw the specified amount of tokens from the gauge. And use all the resulting tokensto remove liquidity from metapool num3CrvTokens Number of 3CRV tokens to withdraw from metapool / | function _lpWithdraw(uint256 num3CrvTokens) internal override {
ICurvePool curvePool = ICurvePool(platformAddress);
/* The rate between coins in the metapool determines the rate at which metapool returns
* tokens when doing balanced removal (remove_liquidity call). And by knowing how much 3... | function _lpWithdraw(uint256 num3CrvTokens) internal override {
ICurvePool curvePool = ICurvePool(platformAddress);
/* The rate between coins in the metapool determines the rate at which metapool returns
* tokens when doing balanced removal (remove_liquidity call). And by knowing how much 3... | 29,718 |
270 | // Let it experience taxes and reflections again. | wallets[newExchanges[i]].isExcludedFromTaxAndReflections = false;
| wallets[newExchanges[i]].isExcludedFromTaxAndReflections = false;
| 26,677 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.