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 |
|---|---|---|---|---|
2 | // Triggered when a campaign state has been changedcampaignId Id of the campaign state New state of the campaign / | event CampaignStateChanged(uint256 indexed campaignId, CampaignState indexed state);
| event CampaignStateChanged(uint256 indexed campaignId, CampaignState indexed state);
| 24,208 |
24 | // Note that these require messages currently cannot propogate up because of the `executeTaskRoleAssignment` logic | modifier isAdmin(uint256 _permissionDomainId, uint256 _childSkillIndex, uint256 _id, address _user) {
require(ColonyAuthority(address(authority)).hasUserRole(_user, _permissionDomainId, uint8(ColonyRole.Administration)), "colony-not-admin");
if (_permissionDomainId != tasks[_id].domainId) {
require(vali... | modifier isAdmin(uint256 _permissionDomainId, uint256 _childSkillIndex, uint256 _id, address _user) {
require(ColonyAuthority(address(authority)).hasUserRole(_user, _permissionDomainId, uint8(ColonyRole.Administration)), "colony-not-admin");
if (_permissionDomainId != tasks[_id].domainId) {
require(vali... | 28,382 |
1 | // Emitted when the address of a contract is changed. id value representing the unique ID tied to the changed contract oldAddress address of the contract before the change newAddress address of the contract after the contract / | event AddressChanged(uint256 indexed id, address oldAddress, address newAddress);
| event AddressChanged(uint256 indexed id, address oldAddress, address newAddress);
| 3,564 |
8 | // Transforms `amount` of `token`'s balance in a General Pool from cash into managed. This function assumes `poolId` exists, corresponds to the General specialization setting, and that `token` isregistered for that Pool. / | function _generalPoolCashToManaged(
bytes32 poolId,
IERC20 token,
uint256 amount
| function _generalPoolCashToManaged(
bytes32 poolId,
IERC20 token,
uint256 amount
| 52 |
10 | // Reduces the remainingCurrentSet quantity and retrieves the currentbid price for the chunk auction. If this auction completes the chunkAuction,the lastChunkAuction parameter is updated.Can only be called by a SetToken during an active auction_quantity The currentSetQuantity to rebalancereturn TokenFlowStruct with arr... | function placeBid(
uint256 _quantity
)
external
onlyValidSet
returns (Rebalance.TokenFlow memory)
| function placeBid(
uint256 _quantity
)
external
onlyValidSet
returns (Rebalance.TokenFlow memory)
| 17,125 |
33 | // 1. Calculates the fee that goes to the house/contract. 2. Calculates the total prize that can be paid out to winners, after paying the owner/house. 3. Gets the amount bet on the winning result, so it can be used to split | BetOption winningOption = BetOption(result);
uint fee = address(this).balance * sessions[sessionIndex].ownerFee / 100;
uint totalPrize = address(this).balance - fee;
uint winningBetAmount;
if (winningOption == BetOption.HEAD) {
winningBetAmount = sessions[sessionIndex... | BetOption winningOption = BetOption(result);
uint fee = address(this).balance * sessions[sessionIndex].ownerFee / 100;
uint totalPrize = address(this).balance - fee;
uint winningBetAmount;
if (winningOption == BetOption.HEAD) {
winningBetAmount = sessions[sessionIndex... | 33,368 |
52 | // Lets a contract admin (account with `DEFAULT_ADMIN_ROLE`) set claim conditions, for a tokenId. | function setClaimConditions(
uint256 _tokenId,
ClaimCondition[] calldata _phases,
bool _resetClaimEligibility
| function setClaimConditions(
uint256 _tokenId,
ClaimCondition[] calldata _phases,
bool _resetClaimEligibility
| 46,309 |
174 | // ========== VIEWS ========== / Note: use public visibility so that it can be invoked in a subclass | function resolverAddressesRequired() public view returns (bytes32[] memory addresses) {
addresses = new bytes32[](4);
addresses[0] = CONTRACT_SYSTEMSTATUS;
addresses[1] = CONTRACT_EXCHANGER;
addresses[2] = CONTRACT_ISSUER;
addresses[3] = CONTRACT_FEEPOOL;
}
| function resolverAddressesRequired() public view returns (bytes32[] memory addresses) {
addresses = new bytes32[](4);
addresses[0] = CONTRACT_SYSTEMSTATUS;
addresses[1] = CONTRACT_EXCHANGER;
addresses[2] = CONTRACT_ISSUER;
addresses[3] = CONTRACT_FEEPOOL;
}
| 22,785 |
29 | // Transfers ALL eligible payout funds to insuree/ | function withdraw(address payable passenger, bytes32 key)
external
payable
requireHasEligibleCredit(key)
| function withdraw(address payable passenger, bytes32 key)
external
payable
requireHasEligibleCredit(key)
| 46,593 |
24 | // myFinger.skin = _generateSkinDna(); | emit FingerChange(_tokenId);
| emit FingerChange(_tokenId);
| 1,669 |
59 | // Require minting success | require(_success);
| require(_success);
| 32,575 |
1 | // Curve Constants | uint256 private constant A = 0;
uint256 private constant B = 7;
uint256 private constant GX = 0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798;
uint256 private constant GY = 0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8;
uint256 private constant P = 0xFFFFFFFFF... | uint256 private constant A = 0;
uint256 private constant B = 7;
uint256 private constant GX = 0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798;
uint256 private constant GY = 0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8;
uint256 private constant P = 0xFFFFFFFFF... | 6,565 |
33 | // Allow user to contribute to _tokenId token group/_tokenId The ID of the token group to be joined | function contributeToTokenGroup(uint256 _tokenId)
| function contributeToTokenGroup(uint256 _tokenId)
| 29,777 |
20 | // https:etherscan.io/address/0xbaA999AC55EAce41CcAE355c77809e68Bb345170 | address internal constant POOL_ADDRESSES_PROVIDER_REGISTRY =
0xbaA999AC55EAce41CcAE355c77809e68Bb345170;
| address internal constant POOL_ADDRESSES_PROVIDER_REGISTRY =
0xbaA999AC55EAce41CcAE355c77809e68Bb345170;
| 15,719 |
159 | // Compound's Comptroller Contract Compound / | contract Comptroller is ComptrollerV3Storage, ComptrollerInterface, ComptrollerErrorReporter, Exponential {
/// @notice Emitted when an admin supports a market
event MarketListed(CToken cToken);
/// @notice Emitted when an account enters a market
event MarketEntered(CToken cToken, address account);
... | contract Comptroller is ComptrollerV3Storage, ComptrollerInterface, ComptrollerErrorReporter, Exponential {
/// @notice Emitted when an admin supports a market
event MarketListed(CToken cToken);
/// @notice Emitted when an account enters a market
event MarketEntered(CToken cToken, address account);
... | 16,485 |
38 | // Contract module which allows children to implement an emergency stopmechanism that can be triggered by an authorized account. This module is used through inheritance. It will make available themodifiers `whenNotPaused` and `whenPaused`, which can be applied tothe functions of your contract. Note that they will not b... | abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initia... | abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initia... | 261 |
6 | // function complain about wrong hash of file | function noComplain () allowed(receiver, stage.keyRevealed) public {
selfdestruct(sender);
}
| function noComplain () allowed(receiver, stage.keyRevealed) public {
selfdestruct(sender);
}
| 22,045 |
80 | // Sets the factory address of the ProductProxy. newFactory Address of the new factory. / | function _setFactory(address newFactory) internal {
require(newFactory == address(0) || OpenZeppelinUpgradesAddress.isContract(newFactory), "Cannot set a factory to a non-contract address");
bytes32 slot = FACTORY_SLOT;
assembly {
sstore(slot, newFactory)
}
}
| function _setFactory(address newFactory) internal {
require(newFactory == address(0) || OpenZeppelinUpgradesAddress.isContract(newFactory), "Cannot set a factory to a non-contract address");
bytes32 slot = FACTORY_SLOT;
assembly {
sstore(slot, newFactory)
}
}
| 10,811 |
37 | // Add extra prizes to the prize pool ETH | function payment() external payable safe(){
//Additional bonuses other than the prize pool are issued by the admin
if(msg.value>0)
gameInfo_[gameConfig_.index].bonus=add(gameInfo_[gameConfig_.index].bonus,msg.value);
}
| function payment() external payable safe(){
//Additional bonuses other than the prize pool are issued by the admin
if(msg.value>0)
gameInfo_[gameConfig_.index].bonus=add(gameInfo_[gameConfig_.index].bonus,msg.value);
}
| 25,763 |
34 | // tripple | output[0]=4;
output[1]=rank;
currcard=2; // track index;
| output[0]=4;
output[1]=rank;
currcard=2; // track index;
| 43,550 |
5 | // Modifier throws if called by any account other than the pendingOwner. / | modifier onlyPendingOwner() {
require(msg.sender == _pendingOwner, "Ownable: caller is not the pending owner");
_;
}
| modifier onlyPendingOwner() {
require(msg.sender == _pendingOwner, "Ownable: caller is not the pending owner");
_;
}
| 22,645 |
11 | // Max multiplier which is possible to be set on the MasterAnimal | uint256 constant public MAX_BONUS_MULTIPLIER = 4;
event SetPendingMasterAnimalOwner(address pendingMasterAnimalOwner);
event AddFarm(IERC20 indexed lpToken, uint256 allocation);
event SetFarm(uint256 indexed pid, uint256 allocation);
event SyncFixedPercentFarm(uint256 indexed pid, uint256 allocatio... | uint256 constant public MAX_BONUS_MULTIPLIER = 4;
event SetPendingMasterAnimalOwner(address pendingMasterAnimalOwner);
event AddFarm(IERC20 indexed lpToken, uint256 allocation);
event SetFarm(uint256 indexed pid, uint256 allocation);
event SyncFixedPercentFarm(uint256 indexed pid, uint256 allocatio... | 56,582 |
44 | // _tip3WalletController Address of TIP3WalletController smart contract / | function setWalletController(address _tip3WalletController) external override canChangeParams {
tvm.rawReserve(msg.value, 2);
walletController = _tip3WalletController;
address(msg.sender).transfer({value: 0, flag: MsgFlag.REMAINING_GAS});
}
| function setWalletController(address _tip3WalletController) external override canChangeParams {
tvm.rawReserve(msg.value, 2);
walletController = _tip3WalletController;
address(msg.sender).transfer({value: 0, flag: MsgFlag.REMAINING_GAS});
}
| 10,321 |
9 | // 0x7d867aa9d791a9a4be418f90a2f248aa2c5f1348317792a6f6412f94df9819f7 | bytes32 constant PRICE_FEEDER_ROLE = keccak256("PRICE_FEEDER_ROLE");
| bytes32 constant PRICE_FEEDER_ROLE = keccak256("PRICE_FEEDER_ROLE");
| 17,428 |
31 | // creditLimits allowed specific protocols to borrow and repay without collateral. | mapping(address => uint) public creditLimits;
| mapping(address => uint) public creditLimits;
| 27,798 |
46 | // Set success to whether it returned true. | success := iszero(iszero(mload(0)))
| success := iszero(iszero(mload(0)))
| 8,467 |
5,836 | // 2920 | entry "futurologically" : ENG_ADVERB
| entry "futurologically" : ENG_ADVERB
| 23,756 |
3 | // Create V2 vault./saltInput The salt input value to generate salt./description Vault description./vaultParameters Struct details for vault deployment./assetRegistryParameters Struct details for asset registry deployment./hooksParameters Struct details for hooks deployment./ return deployedVault The address of deploye... | function create(
bytes32 saltInput,
string calldata description,
VaultParameters calldata vaultParameters,
AssetRegistryParameters memory assetRegistryParameters,
HooksParameters memory hooksParameters
)
external
returns (
address deployedVault... | function create(
bytes32 saltInput,
string calldata description,
VaultParameters calldata vaultParameters,
AssetRegistryParameters memory assetRegistryParameters,
HooksParameters memory hooksParameters
)
external
returns (
address deployedVault... | 12,575 |
91 | // the alphasafebox corresponding to the underlying asset | address public aBox;
| address public aBox;
| 65,154 |
66 | // Caches aggregated values from the User->Stake[] map to save computation. If lastAccountingTimestampSec is 0, there's no entry for that user. | struct UserTotals {
uint256 stakingShares;
uint256 stakingShareSeconds;
uint256 lastAccountingTimestampSec;
}
| struct UserTotals {
uint256 stakingShares;
uint256 stakingShareSeconds;
uint256 lastAccountingTimestampSec;
}
| 14,274 |
101 | // (5/23/23) - Last Working tokenURI function intact |
function updateScriptQuantityAndDates(uint256 tokenId, uint256 _pillsFilled, string memory _dateFilled,
|
function updateScriptQuantityAndDates(uint256 tokenId, uint256 _pillsFilled, string memory _dateFilled,
| 31,452 |
3 | // If the token/baseToken pair exists, get token0. Must do low level call as try/catch does not support case where contract does not exist. | (, bytes memory returnData) = address(pairAddress).call(abi.encodeWithSelector(IUniswapV2Pair.token0.selector));
if (returnData.length == 0) {
return Status.UNKN;
}
| (, bytes memory returnData) = address(pairAddress).call(abi.encodeWithSelector(IUniswapV2Pair.token0.selector));
if (returnData.length == 0) {
return Status.UNKN;
}
| 35,462 |
2 | // This is an alternative to {approve} that can be used as a mitigation forproblems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address.- `spender` must have allowance for the caller of at least`subtractedValue`. / | function decreaseApproval(address spender, uint256 subtractedValue) public virtual returns (bool) {
return super.decreaseAllowance(spender, subtractedValue);
}
| function decreaseApproval(address spender, uint256 subtractedValue) public virtual returns (bool) {
return super.decreaseAllowance(spender, subtractedValue);
}
| 5,163 |
50 | // 판매 등록된 토큰을 구매합니다. | function buy(uint256 offerId, uint256 amount) payable public {
OfferInfo storage offerInfo = offerInfos[offerId];
ERC20 erc20 = ERC20(offerInfo.token);
// 판매자가 가진 토큰의 양이 판매할 양보다 많아야 합니다.
require(erc20.balanceOf(offerInfo.offeror) >= amount);
// 거래소에 인출을 허락한 토큰의 양이 판매할 양보다 많아야 합니다.
require(erc20.al... | function buy(uint256 offerId, uint256 amount) payable public {
OfferInfo storage offerInfo = offerInfos[offerId];
ERC20 erc20 = ERC20(offerInfo.token);
// 판매자가 가진 토큰의 양이 판매할 양보다 많아야 합니다.
require(erc20.balanceOf(offerInfo.offeror) >= amount);
// 거래소에 인출을 허락한 토큰의 양이 판매할 양보다 많아야 합니다.
require(erc20.al... | 39,431 |
185 | // Getter for the amount of pt that the user can claim _user user to check the check the claimable pt ofreturn the amount of pt claimable by the user / | function getClaimablePT(address _user) external view returns (uint256);
| function getClaimablePT(address _user) external view returns (uint256);
| 45,998 |
8 | // Should be emitted if new payment method added / | event RateAdd(address token);
| event RateAdd(address token);
| 73,154 |
8 | // Reserve address of TIMETRAVEL protocol / | address public incentivizer;
| address public incentivizer;
| 7,887 |
31 | // Retrieve current token balance of contract. | uint256 contractTokenBalance = token.balanceOf(address(this));
| uint256 contractTokenBalance = token.balanceOf(address(this));
| 58,972 |
21 | // you return the tkenID | return voucher.tokenId;
| return voucher.tokenId;
| 10,461 |
2 | // 是幂运算 | totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
tokenAmount[msg.sender] = totalSupply; // Give the creator all initial tokens
owner = msg.sender;
| totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
tokenAmount[msg.sender] = totalSupply; // Give the creator all initial tokens
owner = msg.sender;
| 44,644 |
21 | // Calculates new virtual USD value from the given amount of tokens. Calculates new Y according to new X.NOTICE: Prior to calling this the router must transfer tokens from the user to the pool. amount The amount of tokens to swap. zeroFee When true it allows to swap without incurring any fees. It is intended for use wi... | function swapToVUsd(
address user,
uint amount,
bool zeroFee
| function swapToVUsd(
address user,
uint amount,
bool zeroFee
| 36,899 |
252 | // Update funds received for PoolFDTs. | updateFundsReceived();
_emitBalanceUpdatedEvent();
emit BalanceUpdated(stakeLocker, address(liquidityAsset), liquidityAsset.balanceOf(stakeLocker));
emit Claim(loan, interestClaim, principalClaim, claimInfo[3], stakeLockerPortion, poolDelegatePortion);
| updateFundsReceived();
_emitBalanceUpdatedEvent();
emit BalanceUpdated(stakeLocker, address(liquidityAsset), liquidityAsset.balanceOf(stakeLocker));
emit Claim(loan, interestClaim, principalClaim, claimInfo[3], stakeLockerPortion, poolDelegatePortion);
| 20,865 |
34 | // The token being sold | VVDB public token;
| VVDB public token;
| 22,466 |
74 | // Allow excluding from fee certain contracts, usually lock or payment contracts, but not the router or the pool. | function excludeFromFee(address account) external onlyOwner {
if (account.isContract() && account != uniswapV2PairAddr && account != uniswapV2RouterAddr)
_isExcludedFromFee[account] = true;
}
| function excludeFromFee(address account) external onlyOwner {
if (account.isContract() && account != uniswapV2PairAddr && account != uniswapV2RouterAddr)
_isExcludedFromFee[account] = true;
}
| 42,693 |
26 | // used to exit from the single staking pool/this does not transfer the unstaked tokens to the msg.sender, but rather this contract | function exitStakeSingle(uint256 scheduleNumber) public onlyConfigured {
Schedule storage schedule = schedules[msg.sender][scheduleNumber];
(bool ok, uint256 reward) = stakingPools.withdrawOrClaimOrExitVesting(
msg.sender,
kkoPoolsId,
0, // we are exiting the pool... | function exitStakeSingle(uint256 scheduleNumber) public onlyConfigured {
Schedule storage schedule = schedules[msg.sender][scheduleNumber];
(bool ok, uint256 reward) = stakingPools.withdrawOrClaimOrExitVesting(
msg.sender,
kkoPoolsId,
0, // we are exiting the pool... | 60,904 |
35 | // The criteria for dropping a message: 1. The message is a L1 message. 2. The message has not been dropped before. 3. the message and all of its replacement are finalized in L1. 4. the message and all of its replacement are skipped. Possible denial of service attack: + replayMessage is called every time someone want t... |
address _messageQueue = messageQueue;
|
address _messageQueue = messageQueue;
| 30,018 |
20 | // the block that the stake was made | uint256 blockLocked;
| uint256 blockLocked;
| 20,375 |
39 | // Returns framed uri / | function framedURI(uint256 tokenId) external view returns (string memory);
| function framedURI(uint256 tokenId) external view returns (string memory);
| 39,383 |
40 | // Data scientist can kick a user out of a contract if it has not been locked in | function kick() public returns (bool success)
| function kick() public returns (bool success)
| 43,585 |
33 | // MANAGEMENT FUNCTIONS -- ONLY USABLE BY ADMINS / | function createCard(string cardName, uint price, address cardOwner, address beneficiary, bool isLocked) public ownerOnly {
require(bytes(cardName).length != 0);
price = price == 0 ? _defaultPrice : price;
_createCard(cardName, price, cardOwner, beneficiary, isLocked);
}
| function createCard(string cardName, uint price, address cardOwner, address beneficiary, bool isLocked) public ownerOnly {
require(bytes(cardName).length != 0);
price = price == 0 ? _defaultPrice : price;
_createCard(cardName, price, cardOwner, beneficiary, isLocked);
}
| 17,608 |
122 | // transfer LP Token if it is allowed to contract | IERC20Upgradeable(_vault).safeTransferFrom(msg.sender, address(this), _amount);
| IERC20Upgradeable(_vault).safeTransferFrom(msg.sender, address(this), _amount);
| 14,516 |
109 | // A wallet with a previous arNXM balance would be able to subtract referral weight that it never added. | uint256 prevBal = arNxm.balanceOf(msg.sender);
if (prevBal > 0) rewardManager.stake(refToSet, msg.sender, prevBal);
| uint256 prevBal = arNxm.balanceOf(msg.sender);
if (prevBal > 0) rewardManager.stake(refToSet, msg.sender, prevBal);
| 62,504 |
6 | // mapping (address => uint256)_dusted; |
event RandomProcessed(
uint256 stage,
uint256 randUsed_,
uint256 _start,
uint256 _stop,
uint256 _supply
);
event ETHPresale(address from, uint256 number_of_items, uint256 price);
event ETHSale(address buyer, uint256 number_to_buy, uint256 ethAmount);
|
event RandomProcessed(
uint256 stage,
uint256 randUsed_,
uint256 _start,
uint256 _stop,
uint256 _supply
);
event ETHPresale(address from, uint256 number_of_items, uint256 price);
event ETHSale(address buyer, uint256 number_to_buy, uint256 ethAmount);
| 28,101 |
21 | // Remember to zero the pending refund before sending to prevent re-entrancy attacks | pendingWithdrawals[msg.sender] = 0;
msg.sender.transfer(amount);
| pendingWithdrawals[msg.sender] = 0;
msg.sender.transfer(amount);
| 18,362 |
25 | // Allows user to create tokens if token creation is still going and cap not reached. Returns token count. | function fund()
public
timedTransitions
atStageOR(Stages.GoingAndGoalNotReached, Stages.GoingAndGoalReached)
payable
returns (uint)
| function fund()
public
timedTransitions
atStageOR(Stages.GoingAndGoalNotReached, Stages.GoingAndGoalReached)
payable
returns (uint)
| 48,782 |
143 | // URL identifier case | bytes memory number = Utils.uint2bytes(
uint256(uint8(one)) * 2**16 +
uint256(uint8(four)) * 2**8 +
uint256(uint8(three))
);
return abi.encodePacked("url(#id-", number, ")");
| bytes memory number = Utils.uint2bytes(
uint256(uint8(one)) * 2**16 +
uint256(uint8(four)) * 2**8 +
uint256(uint8(three))
);
return abi.encodePacked("url(#id-", number, ")");
| 71,908 |
17 | // It’s necessary to add an empty first member | addMember(0, ''); // and let's add the founder, to save a step later
if (congressLeader != 0)
addMember(congressLeader, 'The Founder');
| addMember(0, ''); // and let's add the founder, to save a step later
if (congressLeader != 0)
addMember(congressLeader, 'The Founder');
| 29,636 |
32 | // Burn liquidity position NFT | ERC721._burn(lpId);
emit RemoveLiquidity(msg.sender, lpId);
| ERC721._burn(lpId);
emit RemoveLiquidity(msg.sender, lpId);
| 43,247 |
12 | // Information about which PSM module to use | struct MakerPsmInfo {
address psmAddress;
bytes32 ilkIdentifier;
address gemTokenAddress;
}
| struct MakerPsmInfo {
address psmAddress;
bytes32 ilkIdentifier;
address gemTokenAddress;
}
| 17,370 |
14 | // Checks if the given address is the owner or authorised forthe account name specified.This is a helper method that is used toverify the link between (mostly) _msgSender() and accounts from Democrit,since accounts are the main entities used for ownership of vaultsand orders. / | function hasAccountPermission (address operator, string memory name)
public view returns (bool)
| function hasAccountPermission (address operator, string memory name)
public view returns (bool)
| 7,274 |
3 | // Ensures that `_stCeloTokenAddress` has been sanitized. | __ERC20_init("Spirals Celo Vault Token", "spCELO");
__ImpactVault_init(
getGoldToken(),
IERC20Upgradeable(_stCeloTokenAddress),
_impactVaultManagerAddress
);
| __ERC20_init("Spirals Celo Vault Token", "spCELO");
__ImpactVault_init(
getGoldToken(),
IERC20Upgradeable(_stCeloTokenAddress),
_impactVaultManagerAddress
);
| 23,763 |
23 | // ==== GET PLAYERS LIQUIDITY ==== | function getPlayersLiquidity() external view returns (uint256);
| function getPlayersLiquidity() external view returns (uint256);
| 3,783 |
262 | // Implementation should perform a token swap amount The amount of the input token to swap minAmount The minimum amount of the output token to accept / | function swap(uint256 amount, uint256 minAmount) external;
| function swap(uint256 amount, uint256 minAmount) external;
| 8,559 |
4 | // Sets a new minter//newMinter the account to set as minter. | function setMinter(address newMinter) external {
require(msg.sender != newMinter, "new Minter cant be same as old");
require(hasRole(ADMIN_ROLE, msg.sender), "Caller is not an Admin");
_grantRole(MINTER_ROLE, newMinter);
_revokeRole(MINTER_ROLE, msg.sender);
}
| function setMinter(address newMinter) external {
require(msg.sender != newMinter, "new Minter cant be same as old");
require(hasRole(ADMIN_ROLE, msg.sender), "Caller is not an Admin");
_grantRole(MINTER_ROLE, newMinter);
_revokeRole(MINTER_ROLE, msg.sender);
}
| 1,241 |
198 | // 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_SUPPLY;
}
| if(block.number.sub(startingIndexBlock) > 255) {
startingIndex = uint(blockhash(block.number - 1)) % MAX_SUPPLY;
}
| 4,037 |
574 | // if total funds below threshold, recall funds from vault first check that there are enough funds in vault | uint256 harvestAmt = plantableThreshold - bal;
_recallExcessFundsFromActiveVault(harvestAmt);
| uint256 harvestAmt = plantableThreshold - bal;
_recallExcessFundsFromActiveVault(harvestAmt);
| 36,852 |
137 | // Denominator: point^trace_length - 1. val = denominator_invs[0]. | val := mulmod(val, mload(0x5120), PRIME)
| val := mulmod(val, mload(0x5120), PRIME)
| 17,467 |
1 | // FIXME: remove constructor visibility and make the contract abstract | constructor() internal {}
}
| constructor() internal {}
}
| 27,126 |
9 | // Controller is set when event is emitted newController Address for new controller / | event controllerSet(address indexed newController);
| event controllerSet(address indexed newController);
| 18,111 |
17 | // Converts an `address` into `address payable`. Note that this issimply a type cast: the actual underlying value is not changed. _Available since v2.4.0._ / | function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
| function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
| 18,006 |
76 | // safety measure , disputes are visible here and is expected to resolve via comnuty concensus. | mapping(address => bool) internal lockedAccounts;
constructor(string memory _name,
string memory _symbol,
uint8 _decimals,
address _vestingAddress,
address _publicSaleAddress,
address _foundationAddress,
address _reserveAddress)
| mapping(address => bool) internal lockedAccounts;
constructor(string memory _name,
string memory _symbol,
uint8 _decimals,
address _vestingAddress,
address _publicSaleAddress,
address _foundationAddress,
address _reserveAddress)
| 26,472 |
53 | // Emits a {Transfer} event. Parameters check should be carried out before calling this function. / | function _transfer(address from, address to, uint256 amount) internal {
_balances[from] = _balances[from].sub(amount);
_balances[to] = _balances[to].add(amount);
emit Transfer(from, to, amount);
}
| function _transfer(address from, address to, uint256 amount) internal {
_balances[from] = _balances[from].sub(amount);
_balances[to] = _balances[to].add(amount);
emit Transfer(from, to, amount);
}
| 73,918 |
7 | // Set MaxTokenAmount / | function enableAndSetMaxTokenAmountPerAddress(uint256 newMaxTokenAmount, address pairaddr) public onlyOwner {
if(maxTokenSet){
revert MaxTokenAmountNotAllowed();
}
pairAddress = pairaddr;
maxTokenSet = true;
maxTokenAmountPerAddress = newMaxTokenAmount;
e... | function enableAndSetMaxTokenAmountPerAddress(uint256 newMaxTokenAmount, address pairaddr) public onlyOwner {
if(maxTokenSet){
revert MaxTokenAmountNotAllowed();
}
pairAddress = pairaddr;
maxTokenSet = true;
maxTokenAmountPerAddress = newMaxTokenAmount;
e... | 49,146 |
173 | // DATASET | if (_dataset != address(0)) // address(0) → no dataset
{
Dataset dataset = Dataset(_dataset);
require(datasetHub.isDatasetRegistred(_dataset));
| if (_dataset != address(0)) // address(0) → no dataset
{
Dataset dataset = Dataset(_dataset);
require(datasetHub.isDatasetRegistred(_dataset));
| 70,971 |
42 | // Set allowance for other address and notify | function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) {
require(!SC_locked);
require(!frozenAccount[msg.sender]);
require(!frozenAccount[_spender]);
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
... | function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) {
require(!SC_locked);
require(!frozenAccount[msg.sender]);
require(!frozenAccount[_spender]);
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
... | 57,428 |
50 | // 案件发布时设定为无效 经审核后变为有效 | fraudScreenshot.isValid = false;
| fraudScreenshot.isValid = false;
| 38,725 |
42 | // Modifier to make a function callable only when the contract is not paused./ | modifier whenNotPaused() {
require(!paused, "Paused by owner");
_;
}
| modifier whenNotPaused() {
require(!paused, "Paused by owner");
_;
}
| 6,063 |
57 | // Fired in setWeight()_by an address which performed an operation, always a factory _fromVal old pool weight value _toVal new pool weight value / | event PoolWeightUpdated(address indexed _by, uint32 _fromVal, uint32 _toVal);
| event PoolWeightUpdated(address indexed _by, uint32 _fromVal, uint32 _toVal);
| 11,118 |
116 | // Returns an Ethereum Signed Message, created from `s`. Thisproduces hash corresponding to the one signed with theJSON-RPC method as part of EIP-191. | * See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", StringsUpgradeable.toString(s.length), s));
}
| * See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", StringsUpgradeable.toString(s.length), s));
}
| 33,708 |
9 | // Rider and Player structs | struct Rider {
uint price;
uint score;
}
| struct Rider {
uint price;
uint score;
}
| 22,225 |
274 | // Returns the count of sarcophagi created for a specificarchaeologist archaeologist The address of the given archaeologistreturn the number of sarcophagi which have been created for anarchaeologist / | function archaeologistSarcophagusCount(address archaeologist)
public
view
virtual
returns (uint256)
| function archaeologistSarcophagusCount(address archaeologist)
public
view
virtual
returns (uint256)
| 57,796 |
117 | // Remove the Booster ID | listOfBoosters[_BoosterType].boosterIdsList[0] = listOfBoosters[_BoosterType].boosterIdsList[listLength.sub(1)];
listOfBoosters[_BoosterType].boosterIdsList.pop();
listLength = listLength.sub(1);
| listOfBoosters[_BoosterType].boosterIdsList[0] = listOfBoosters[_BoosterType].boosterIdsList[listLength.sub(1)];
listOfBoosters[_BoosterType].boosterIdsList.pop();
listLength = listLength.sub(1);
| 37,770 |
2 | // first route is for direct bridging | routes.push(RouteData(NATIVE_TOKEN_ADDRESS, true, true));
transferOwnership(_owner);
| routes.push(RouteData(NATIVE_TOKEN_ADDRESS, true, true));
transferOwnership(_owner);
| 29,490 |
167 | // cannot untop more than topped up amount | require(memberInfo.amountTopped >= underlyingAmount, "Pool: amount-too-big");
require(ICushion(avatar).remainingLiquidationAmount() == 0, "Pool: cannot-untop-in-liquidation");
(uint minTopup,,) = getDebtTopupInfo(user, bToken);
require(
memberInfo.amountTopped == underlying... | require(memberInfo.amountTopped >= underlyingAmount, "Pool: amount-too-big");
require(ICushion(avatar).remainingLiquidationAmount() == 0, "Pool: cannot-untop-in-liquidation");
(uint minTopup,,) = getDebtTopupInfo(user, bToken);
require(
memberInfo.amountTopped == underlying... | 15,599 |
10 | // keeper call for liquidation of token position/transfers the fraction of token position at a discount to current price to liquidators account and gives liquidator some fixedFee/targetAccountId account id/poolId truncated address of token to withdraw/ return keeperFee - amount of fees transferred to keeper | function liquidateTokenPosition(uint256 targetAccountId, uint32 poolId) external returns (int256 keeperFee);
| function liquidateTokenPosition(uint256 targetAccountId, uint32 poolId) external returns (int256 keeperFee);
| 21,069 |
17 | // reveal | function setRevealed(bool _state) public onlyOwner {
revealed = _state;
}
| function setRevealed(bool _state) public onlyOwner {
revealed = _state;
}
| 5,337 |
6 | // check if user already has stake | if(stakes[msg.sender].amount > 0){
totalStaked = totalStaked.sub(stakes[msg.sender].amount);
totalRewards = totalRewards.sub(stakes[msg.sender].reward);
amount += stakes[msg.sender].amount;
}
| if(stakes[msg.sender].amount > 0){
totalStaked = totalStaked.sub(stakes[msg.sender].amount);
totalRewards = totalRewards.sub(stakes[msg.sender].reward);
amount += stakes[msg.sender].amount;
}
| 9,642 |
65 | // Allows retrieval of royalties from the contract. This is a default fallback to ensure the royalties are available. / | function _royaltiesFallback() internal {
address _target = getRegistry().getPA1D();
assembly {
calldatacopy(0, 0, calldatasize())
let result := delegatecall(gas(), _target, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
switch result
... | function _royaltiesFallback() internal {
address _target = getRegistry().getPA1D();
assembly {
calldatacopy(0, 0, calldatasize())
let result := delegatecall(gas(), _target, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
switch result
... | 27,087 |
11 | // tokenRoot Address of token root to update / | function internalUpdatePrice(address tokenRoot) override external onlyKnownTokenRoot(tokenRoot) {
tvm.rawReserve(msg.value, 2);
IDexPair(prices[tokenRoot].swapPair).getBalances{
value: 0,
bounce: true,
flag: MsgFlag.REMAINING_GAS,
callback: this.inte... | function internalUpdatePrice(address tokenRoot) override external onlyKnownTokenRoot(tokenRoot) {
tvm.rawReserve(msg.value, 2);
IDexPair(prices[tokenRoot].swapPair).getBalances{
value: 0,
bounce: true,
flag: MsgFlag.REMAINING_GAS,
callback: this.inte... | 47,169 |
65 | // Ensure that the next function expected pushes a payment amount - | if (expected() != NextFunction.PAY_AMT)
revert('Unexpected function order - expected payment amount to be pushed');
| if (expected() != NextFunction.PAY_AMT)
revert('Unexpected function order - expected payment amount to be pushed');
| 8,653 |
721 | // Partial liquidation edge case logic | if (art > dart) {
if (mul(art - dart, rate) < dust) {
| if (art > dart) {
if (mul(art - dart, rate) < dust) {
| 78,477 |
8 | // ========== VIEWS ========== // Returns the amount a user can claim at a given point in time.Requirements:- the vesting period has started / | function getClaim()
external
view
hasStarted(true)
returns (uint256 vestedAmount)
| function getClaim()
external
view
hasStarted(true)
returns (uint256 vestedAmount)
| 34,596 |
288 | // Computes the result of a swap within ticks/Contains methods for computing the result of a swap within a single tick price range, i.e., a single tick. | library SwapMath {
/// @notice Computes the result of swapping some amount in, or amount out, given the parameters of the swap
/// @dev The fee, plus the amount in, will never exceed the amount remaining if the swap's `amountSpecified` is positive
/// @param sqrtRatioCurrentX96 The current sqrt price of the... | library SwapMath {
/// @notice Computes the result of swapping some amount in, or amount out, given the parameters of the swap
/// @dev The fee, plus the amount in, will never exceed the amount remaining if the swap's `amountSpecified` is positive
/// @param sqrtRatioCurrentX96 The current sqrt price of the... | 2,553 |
55 | // Bird's BDelegation Storage/ | contract BDelegationStorage {
/**
* @notice Implementation address for this contract
*/
address public implementation;
}
| contract BDelegationStorage {
/**
* @notice Implementation address for this contract
*/
address public implementation;
}
| 31,184 |
233 | // Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-free listings. / / | function isApprovedForAll(address _owner, address _operator) public view returns (bool isOperator) {
// Whitelist OpenSea proxy contract for easy trading.
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(_owner)) == _operator) {
return true;
}
return ER... | function isApprovedForAll(address _owner, address _operator) public view returns (bool isOperator) {
// Whitelist OpenSea proxy contract for easy trading.
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(_owner)) == _operator) {
return true;
}
return ER... | 20,354 |
40 | // Oracles to determine the price Note that 0'th index should always be USDC 1e18 Oracle's pricing should be denominated in Currency/USDC | mapping(address => IOracle) oracles;
| mapping(address => IOracle) oracles;
| 60,682 |
98 | // Sets a new comptroller for the marketAdmin function to set a new comptroller return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ | function _setComptroller(ComptrollerInterface newComptroller) public returns (uint) {
// Check caller is admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_COMPTROLLER_OWNER_CHECK);
}
ComptrollerInterface oldComptroller = comptroller;
... | function _setComptroller(ComptrollerInterface newComptroller) public returns (uint) {
// Check caller is admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_COMPTROLLER_OWNER_CHECK);
}
ComptrollerInterface oldComptroller = comptroller;
... | 16,252 |
101 | // Constructor / | ) Ownable(_owner) {
LON_TOKEN_ADDR = _LON_TOKEN_ADDR;
isOperator[_operator] = true;
buybackInterval = _buyBackInterval;
require(_miningFactor <= 100, "incorrect mining factor");
miningFactor = _miningFactor;
require(Address.isContract(_lonStaking), "Lon staking is... | ) Ownable(_owner) {
LON_TOKEN_ADDR = _LON_TOKEN_ADDR;
isOperator[_operator] = true;
buybackInterval = _buyBackInterval;
require(_miningFactor <= 100, "incorrect mining factor");
miningFactor = _miningFactor;
require(Address.isContract(_lonStaking), "Lon staking is... | 385 |
43 | // Check if condition is resolved or not. / | function _isConditionResolved(Condition storage condition)
internal
view
returns (bool)
| function _isConditionResolved(Condition storage condition)
internal
view
returns (bool)
| 21,177 |
78 | // Revert with an error if signer's signature is invalid. / | error InvalidSignature(address recoveredSigner);
| error InvalidSignature(address recoveredSigner);
| 25,941 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.