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 |
|---|---|---|---|---|
9 | // Throws if called by any account other than the blacklister/ | modifier onlyBlacklister() {
require(msg.sender == blacklister);
_;
}
| modifier onlyBlacklister() {
require(msg.sender == blacklister);
_;
}
| 61,084 |
192 | // ERC1155TradableERC1155Tradable - ERC1155 contract that whitelists an operator address, has create and mint functionality, and supports useful standards from OpenZeppelin, / | contract ERC1155Tradable is ERC1155, ERC1155MintBurn, ERC1155Metadata, Ownable {
//address proxyRegistryAddress;
uint256 private totalTokenAssets = 10000;
uint256 private totalReserve = 336;
uint256 public _currentTokenID = 0;
uint256 public _customizedTokenId = 9000;
// uint256 private _maxToke... | contract ERC1155Tradable is ERC1155, ERC1155MintBurn, ERC1155Metadata, Ownable {
//address proxyRegistryAddress;
uint256 private totalTokenAssets = 10000;
uint256 private totalReserve = 336;
uint256 public _currentTokenID = 0;
uint256 public _customizedTokenId = 9000;
// uint256 private _maxToke... | 51,825 |
151 | // we're getting this info from the aToken, because some of assets can be not compliant with ETC20Detailed | reserveData.symbol = IERC20Detailed(reserveData.aTokenAddress).symbol();
reserveData.name = '';
(
reserveData.baseLTVasCollateral,
reserveData.reserveLiquidationThreshold,
reserveData.reserveLiquidationBonus,
reserveData.decimals,
reserveData.reserveFactor
... | reserveData.symbol = IERC20Detailed(reserveData.aTokenAddress).symbol();
reserveData.name = '';
(
reserveData.baseLTVasCollateral,
reserveData.reserveLiquidationThreshold,
reserveData.reserveLiquidationBonus,
reserveData.decimals,
reserveData.reserveFactor
... | 23,580 |
13 | // Housing Stores history of resident check-ins and check-outs / | contract Housing {
uint256 capacity;
uint servicer; // address
// Model an Resident
struct Resident {
uint id; // address
uint bedId;
uint checkIn;
uint duration;
bool isCheckedIn;
}
//
mapping(uint => uint) private vouchers;
// address to Bed ... | contract Housing {
uint256 capacity;
uint servicer; // address
// Model an Resident
struct Resident {
uint id; // address
uint bedId;
uint checkIn;
uint duration;
bool isCheckedIn;
}
//
mapping(uint => uint) private vouchers;
// address to Bed ... | 8,347 |
7 | // This function verifies if an address has the following accesses or not - Super Admin - Admins - Store Owner/ | function checkAccess(address addressToVerify) view public returns(bool, bool, bool) {
bool isAdmin = Utils.existInTheArray(adminUsers, addressToVerify);
bool isStoreOwner = Utils.existInTheArray(storeOwners, addressToVerify);
bool isSuperAdmin = false;
if ( addressToVerify == superAdmin ) {... | function checkAccess(address addressToVerify) view public returns(bool, bool, bool) {
bool isAdmin = Utils.existInTheArray(adminUsers, addressToVerify);
bool isStoreOwner = Utils.existInTheArray(storeOwners, addressToVerify);
bool isSuperAdmin = false;
if ( addressToVerify == superAdmin ) {... | 49,526 |
52 | // return address the address of currently active (latest) version of me (the app contract) | function currentLogic() public view returns (address) { return GluonView(gluon).current(id); }
| function currentLogic() public view returns (address) { return GluonView(gluon).current(id); }
| 815 |
8 | // Functions with this modifer cannot be reentered. The mutex will be locked/before function execution and unlocked after. | modifier nonReentrant() {
// Ensure mutex is unlocked
require(
!locked,
"REENTRANCY_ILLEGAL"
);
// Lock mutex before function call
locked = true;
// Perform function call
_;
// Unlock mutex after function call
locked ... | modifier nonReentrant() {
// Ensure mutex is unlocked
require(
!locked,
"REENTRANCY_ILLEGAL"
);
// Lock mutex before function call
locked = true;
// Perform function call
_;
// Unlock mutex after function call
locked ... | 39,149 |
108 | // save current booster price, since transfer is done last since getBoosterPrice() returns new boost balance, avoid re-calculation | (uint256 boosterAmount, uint256 newBoostBalance) = getBoosterPrice(msg.sender);
| (uint256 boosterAmount, uint256 newBoostBalance) = getBoosterPrice(msg.sender);
| 41,800 |
15 | // Handle the receipt of a NFT. The ERC721 smart contract calls this function on therecipient after a `transfer`. This function MAY throw to revert and reject the transfer. Returnof other than the magic value MUST result in the transaction being reverted.Returns `bytes4(keccak256("onERC721Received(address,address,uint2... | function onERC721Received(
address _operator,
address _from,
uint256 _tokenId,
bytes calldata _data
)
external
returns(bytes4);
| function onERC721Received(
address _operator,
address _from,
uint256 _tokenId,
bytes calldata _data
)
external
returns(bytes4);
| 24,296 |
127 | // Vesting contracts. | PresaleTokenVault public presaleTokenVault;
TokenVesting public foundersVault;
UbiatarPlayVault public ubiatarPlayVault;
| PresaleTokenVault public presaleTokenVault;
TokenVesting public foundersVault;
UbiatarPlayVault public ubiatarPlayVault;
| 33,816 |
14 | // Disable EB.mintPrint | IEulerBeats(EulerBeats).setEnabled(false);
| IEulerBeats(EulerBeats).setEnabled(false);
| 6,960 |
2 | // Metadata setter and locker | string private metadataTokenURI;
uint256 immutable mvpMintStartDate;
uint256 immutable giveAwayIndexStart;
uint256 immutable mvpPassword;
bool private lock;
| string private metadataTokenURI;
uint256 immutable mvpMintStartDate;
uint256 immutable giveAwayIndexStart;
uint256 immutable mvpPassword;
bool private lock;
| 5,215 |
55 | // remove from for sale list | for (uint j=0;j<upForSaleList.length;j++)
{
if (upForSaleList[j] == animalId)
delete upForSaleList[j];
}
| for (uint j=0;j<upForSaleList.length;j++)
{
if (upForSaleList[j] == animalId)
delete upForSaleList[j];
}
| 38,456 |
3 | // Tips for min and max if interger | int256 public maxInt = type(int256).max;
int256 public minInt = type(int256).min;
address public addr = 0xdC7C84966b5aaCa1174e9B5660fEC286c6c70F22; // 40 bytes max and min
bytes32 public b32 =
0xdC7C84966b5aaCa1174e9B5660fEC286c6c70F22dC7C84966b5aaCa1174e9B56; // 64 bytes max and min
| int256 public maxInt = type(int256).max;
int256 public minInt = type(int256).min;
address public addr = 0xdC7C84966b5aaCa1174e9B5660fEC286c6c70F22; // 40 bytes max and min
bytes32 public b32 =
0xdC7C84966b5aaCa1174e9B5660fEC286c6c70F22dC7C84966b5aaCa1174e9B56; // 64 bytes max and min
| 2,460 |
189 | // abstract contract for putting a rate limit on how fast a contract can mint FEI/Fei Protocol | abstract contract RateLimitedMinter is RateLimited {
uint256 private constant MAX_FEI_LIMIT_PER_SECOND = 10_000e18; // 10000 FEI/s or ~860m FEI/day
constructor(
uint256 _feiLimitPerSecond,
uint256 _mintingBufferCap,
bool _doPartialMint
) RateLimited(MAX_FEI_LIMIT_PER_SECOND, _feiLim... | abstract contract RateLimitedMinter is RateLimited {
uint256 private constant MAX_FEI_LIMIT_PER_SECOND = 10_000e18; // 10000 FEI/s or ~860m FEI/day
constructor(
uint256 _feiLimitPerSecond,
uint256 _mintingBufferCap,
bool _doPartialMint
) RateLimited(MAX_FEI_LIMIT_PER_SECOND, _feiLim... | 42,991 |
155 | // An admin function that lets the ecosystem's organizers withdraw the underlying token around which this DMMA wraps from this contract. This is used to withdraw deposited tokens, to be allocated to real-world assets that produce income streams and can cover interest payments. / | function withdrawUnderlying(uint underlyingAmount) external returns (bool);
| function withdrawUnderlying(uint underlyingAmount) external returns (bool);
| 27,498 |
89 | // Limit the quick dump possibility | uint diff = 0;
uint allowed = 0;
if (balances[payer] > current_supply / 100) { // for balances > 1% of total supply
if (block.timestamp > ICO_START_TIME) {
diff = block.timestamp - ICO_START_TIME;
} else {
| uint diff = 0;
uint allowed = 0;
if (balances[payer] > current_supply / 100) { // for balances > 1% of total supply
if (block.timestamp > ICO_START_TIME) {
diff = block.timestamp - ICO_START_TIME;
} else {
| 56,580 |
246 | // Performs a transfer in, ideally returning an explanatory error code upon failure rather than reverting. If caller has not called `checkTransferIn`, this may revert due to insufficient balance or insufficient allowance. If caller has called `checkTransferIn` successfully, this should not revert in normal conditions. ... | function doTransferIn(address from, uint amount) internal returns (Error);
| function doTransferIn(address from, uint amount) internal returns (Error);
| 23,458 |
61 | // The number of blocks that credit will be distributed over to depositors. | uint256 creditUnlockBlocks;
| uint256 creditUnlockBlocks;
| 15,129 |
48 | // | contract FinalizableToken is ERC20Token, OpsManaged, Finalizable {
using Math for uint256;
// The constructor will assign the initial token supply to the owner (msg.sender).
function FinalizableToken(string _name, string _symbol, uint8 _decimals, uint256 _totalSupply) public
ERC20Token(_name, _symbol,... | contract FinalizableToken is ERC20Token, OpsManaged, Finalizable {
using Math for uint256;
// The constructor will assign the initial token supply to the owner (msg.sender).
function FinalizableToken(string _name, string _symbol, uint8 _decimals, uint256 _totalSupply) public
ERC20Token(_name, _symbol,... | 16,207 |
11 | // mint | function mintTokens(uint8 quantity) private {
for (uint256 i = 0; i < quantity; i++) {
uint256 newTokenId = totalSupply + 1;
_safeMint(msg.sender, newTokenId);
totalSupply++;
}
_nrMinted[msg.sender] += quantity;
}
| function mintTokens(uint8 quantity) private {
for (uint256 i = 0; i < quantity; i++) {
uint256 newTokenId = totalSupply + 1;
_safeMint(msg.sender, newTokenId);
totalSupply++;
}
_nrMinted[msg.sender] += quantity;
}
| 49,577 |
35 | // Cost of arbitration. Accessor to arbitrationPrice. _extraData Not used by this contract.return fee Amount to be paid./ | function arbitrationCost(bytes memory _extraData) public view returns(uint fee) {
return arbitrationPrice;
}
| function arbitrationCost(bytes memory _extraData) public view returns(uint fee) {
return arbitrationPrice;
}
| 51,247 |
0 | // Stem constructor | constructor(string _name, string _symbol, uint256 initialSupply) public {
name = _name;
symbol = _symbol;
stemMaster = msg.sender;
totalSupply = initialSupply;
ledger[msg.sender] = initialSupply;
}
| constructor(string _name, string _symbol, uint256 initialSupply) public {
name = _name;
symbol = _symbol;
stemMaster = msg.sender;
totalSupply = initialSupply;
ledger[msg.sender] = initialSupply;
}
| 10,006 |
1 | // emitted at each SmardexPair created token0 address of the token0 token1 address of the token1 pair address of the SmardexPair created totalPair number of SmardexPair created so far / | event PairCreated(address indexed token0, address indexed token1, address pair, uint256 totalPair);
| event PairCreated(address indexed token0, address indexed token1, address pair, uint256 totalPair);
| 45,265 |
3 | // Used to validate if a user has been using the reserve for borrowing self The configuration object reserveIndex The index of the reserve in the bitmapreturn True if the user has been using a reserve for borrowing, false otherwise / | {
require(reserveIndex < 128, Errors.UL_INVALID_INDEX);
return (self.data >> (reserveIndex * 2)) & 1 != 0;
}
| {
require(reserveIndex < 128, Errors.UL_INVALID_INDEX);
return (self.data >> (reserveIndex * 2)) & 1 != 0;
}
| 33,801 |
89 | // number of tokens Per day | rewardRate = [50, 60, 75, 100, 150, 500, 0];
started = false;
| rewardRate = [50, 60, 75, 100, 150, 500, 0];
started = false;
| 20,409 |
41 | // Set LP token. stakingToken_ LP token address / | function setLPToken(address stakingToken_) external onlyOwner {
if (stakingToken_ == address(0)) revert AddressZero();
if (stakingToken != address(0)) revert AlreadySet();
stakingToken = stakingToken_;
emit LPTokenUpdated(stakingToken_);
}
| function setLPToken(address stakingToken_) external onlyOwner {
if (stakingToken_ == address(0)) revert AddressZero();
if (stakingToken != address(0)) revert AlreadySet();
stakingToken = stakingToken_;
emit LPTokenUpdated(stakingToken_);
}
| 28,879 |
30 | // Update the hero owner and set the new price | pokemons[_pokemonId].ownerAddress = msg.sender;
pokemons[_pokemonId].currentPrice = pokemons[_pokemonId].currentPrice.mul(3).div(2);
levels[_pokemonId] = levels[_pokemonId] + 1;
| pokemons[_pokemonId].ownerAddress = msg.sender;
pokemons[_pokemonId].currentPrice = pokemons[_pokemonId].currentPrice.mul(3).div(2);
levels[_pokemonId] = levels[_pokemonId] + 1;
| 11,667 |
1,011 | // Handles token deposits into Notional. If there is a transfer fee then we must/ calculate the net balance after transfer. Amounts are denominated in the destination token's/ precision. | function _deposit(
Token memory token,
address account,
uint256 amount
| function _deposit(
Token memory token,
address account,
uint256 amount
| 63,437 |
7 | // initial setup | function start() public override {
Terminal.print(0, 'You need to attach future owner of the token.\nIt will be used also to pay for all transactions.');
attachMultisig();
}
| function start() public override {
Terminal.print(0, 'You need to attach future owner of the token.\nIt will be used also to pay for all transactions.');
attachMultisig();
}
| 24,400 |
13 | // Get the base URI | function getBaseURI() external view onlyOwner returns (string memory) {
return _baseTokenURI;
}
| function getBaseURI() external view onlyOwner returns (string memory) {
return _baseTokenURI;
}
| 53,885 |
84 | // add the bought and remove the cashed out | nBalance = nBalance.add(nAddBalance).sub(nRmvBalance);
return nBalance;
| nBalance = nBalance.add(nAddBalance).sub(nRmvBalance);
return nBalance;
| 8,622 |
59 | // require proof that the initial exit choices are committed to an identified merkle trie. | bytes32 merkleLeaf = LibProofStack.directMerkleLeaf(
args.choices[i]
);
console.log("merkleLeaf");
console.logBytes32(merkleLeaf);
if (!self.checkRoot(args.proofs[i], args.rootLabel, merkleLeaf))
revert Transcript_InvalidStartC... | bytes32 merkleLeaf = LibProofStack.directMerkleLeaf(
args.choices[i]
);
console.log("merkleLeaf");
console.logBytes32(merkleLeaf);
if (!self.checkRoot(args.proofs[i], args.rootLabel, merkleLeaf))
revert Transcript_InvalidStartC... | 11,775 |
217 | // Add new rewards to a rewarded vault. _vaultId ID of the vault to have reward. _rewardAmount Amount of the reward token to add. / | function addRewards(uint256 _vaultId, uint256 _rewardAmount) public {
require(msg.sender == governance, "not governance");
require(vaults[_vaultId] != address(0x0), "vault not exist");
require(_rewardAmount > 0, "zero amount");
address vault = vaults[_vaultId];
IERC20Mintabl... | function addRewards(uint256 _vaultId, uint256 _rewardAmount) public {
require(msg.sender == governance, "not governance");
require(vaults[_vaultId] != address(0x0), "vault not exist");
require(_rewardAmount > 0, "zero amount");
address vault = vaults[_vaultId];
IERC20Mintabl... | 45,341 |
5 | // Redeem principal and interest on a pool token. Called by valid pools as part of their redemption flow tokenId pool token id principalRedeemed principal to redeem. This cannot exceed the token's principal amount, and the redemption cannot cause the pool's total principal redeemed to exceed the pool's total minted pri... | function redeem(uint256 tokenId, uint256 principalRedeemed, uint256 interestRedeemed) external;
| function redeem(uint256 tokenId, uint256 principalRedeemed, uint256 interestRedeemed) external;
| 39,774 |
3 | // MyFriendships A contract for managing one's friendships. / | contract MyFriendships {
address public me;
uint public numberOfFriends;
address public latestFriend;
mapping(address => bool) myFriends;
/**
* @dev Create a contract to keep track of my friendships.
*/
function MyFriendships() public {
me = msg.sender;
}
/**
... | contract MyFriendships {
address public me;
uint public numberOfFriends;
address public latestFriend;
mapping(address => bool) myFriends;
/**
* @dev Create a contract to keep track of my friendships.
*/
function MyFriendships() public {
me = msg.sender;
}
/**
... | 4,579 |
255 | // Infinite geometric series | uint256 leverage = uint256(1e36).div(1e18 - safeLeverageColFactor);
return leverage;
| uint256 leverage = uint256(1e36).div(1e18 - safeLeverageColFactor);
return leverage;
| 75,188 |
39 | // Interface Imports / | import { iOVM_BondManager } from "../../iOVM/verification/iOVM_BondManager.sol";
/* Contract Imports */
import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol";
/**
* @title mockOVM_BondManager
*/
contract mockOVM_BondManager is iOVM_BondManager, Lib_AddressResolver {
constructor(... | import { iOVM_BondManager } from "../../iOVM/verification/iOVM_BondManager.sol";
/* Contract Imports */
import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol";
/**
* @title mockOVM_BondManager
*/
contract mockOVM_BondManager is iOVM_BondManager, Lib_AddressResolver {
constructor(... | 16,527 |
8 | // Modifier to restrict access to employer-only functions | modifier onlyEmployer() {
require(employers[msg.sender].ethAddress != address(0), "Only employers can call this function.");
_;
}
| modifier onlyEmployer() {
require(employers[msg.sender].ethAddress != address(0), "Only employers can call this function.");
_;
}
| 25,841 |
323 | // Otherwise we just transfer | return super._internalTransfer(from, to, value, data);
| return super._internalTransfer(from, to, value, data);
| 25,522 |
35 | // Emit withdraw event | emit WithdrawEarnings(transferAmount, msg.sender);
| emit WithdrawEarnings(transferAmount, msg.sender);
| 9,094 |
33 | // contract addresses | address public adapterDeployer;
address public assessor;
address public poolAdmin;
address public seniorTranche;
address public juniorTranche;
address public seniorOperator;
address public juniorOperator;
... | address public adapterDeployer;
address public assessor;
address public poolAdmin;
address public seniorTranche;
address public juniorTranche;
address public seniorOperator;
address public juniorOperator;
... | 10,651 |
9 | // Emit an event that includes an address and a number as the main values. Example: when an award of tokens is given. _eventName The bytes32 encoded (hex) representation of the event's name in audit files. _account The account in question. _amount The amount in question. _id The unique ID that can be matched with the r... | function emitEvent(bytes32 _eventName, address _account, uint _amount, uint _id, string calldata _cid) external onlyAdmins {
emit LogEvent(_eventName, _account, _amount, _id, _cid, msg.sender);
emit LogLatestAudit(_cid);
}
| function emitEvent(bytes32 _eventName, address _account, uint _amount, uint _id, string calldata _cid) external onlyAdmins {
emit LogEvent(_eventName, _account, _amount, _id, _cid, msg.sender);
emit LogLatestAudit(_cid);
}
| 47,781 |
38 | // Player has won the three-moon mega jackpot! | profit = SafeMath.mul(spin.tokenValue, 500);
category = 1;
emit ThreeMoonJackpot(target, spin.blockn);
| profit = SafeMath.mul(spin.tokenValue, 500);
category = 1;
emit ThreeMoonJackpot(target, spin.blockn);
| 67,617 |
5 | // The rICO token contract address. | address public tokenAddress;
| address public tokenAddress;
| 8,629 |
20 | // Returns an array of contract-level delegates for a given vault and contract vault The cold wallet who issued the delegation contract_ The address for the contract you're delegatingreturn addresses Array of contract-level delegates for a given vault and contract / | function getDelegatesForContract(address vault, address contract_) external view returns (address[] memory);
| function getDelegatesForContract(address vault, address contract_) external view returns (address[] memory);
| 16,177 |
31 | // Update consignment to indicate it has been marketed Emits a ConsignmentMarketed event. Reverts if consignment has already been marketed. A consignment is considered as marketed if it has a marketHandler other than Unhandled. See: {SeenTypes.MarketHandler}_consignmentId - the id of the consignment/ | function marketConsignment(uint256 _consignmentId, SeenTypes.MarketHandler _marketHandler) external;
| function marketConsignment(uint256 _consignmentId, SeenTypes.MarketHandler _marketHandler) external;
| 12,934 |
21 | // SavingsManager | function collectInterest() external virtual returns (uint256 swapFeesGained, uint256 newSupply);
function collectPlatformInterest()
external
virtual
returns (uint256 mintAmount, uint256 newSupply);
| function collectInterest() external virtual returns (uint256 swapFeesGained, uint256 newSupply);
function collectPlatformInterest()
external
virtual
returns (uint256 mintAmount, uint256 newSupply);
| 36,515 |
125 | // Simple ERC20 + EIP-2612 implementation./Solady (https:github.com/vectorized/solady/blob/main/src/tokens/ERC20.sol)/Modified from Solmate (https:github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)/Modified from OpenZeppelin (https:github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/tok... | abstract contract ERC20 {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CUSTOM ERRORS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev The total supply has overflowed.
error TotalSupplyOverflow();
//... | abstract contract ERC20 {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CUSTOM ERRORS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev The total supply has overflowed.
error TotalSupplyOverflow();
//... | 27,457 |
9 | // -------------------------------- SUBIR CERTIFICADOS -------------------------------- | 1,766 | ||
133 | // Require msg.sender to be the creator of the token id / | modifier creatorOnly(uint256 _id)
| modifier creatorOnly(uint256 _id)
| 754 |
105 | // Given a continuous token amount, calculates the amount of reserve tokens returned./ | function getContinuousBurnRefund(uint _continuousTokenAmount) external view returns (uint);
| function getContinuousBurnRefund(uint _continuousTokenAmount) external view returns (uint);
| 27,130 |
30 | // Transfer tokens to the next exchange wrapper | transfer(token, wrappers[1], tokenBalance);
| transfer(token, wrappers[1], tokenBalance);
| 16,705 |
986 | // Helper to register allowed vault calls | function __registerVaultCalls(address[] memory _contracts, bytes4[] memory _selectors)
private
{
require(
_contracts.length == _selectors.length,
"__registerVaultCalls: Uneven input arrays"
);
for (uint256 i; i < _contracts.length; i++) {
requ... | function __registerVaultCalls(address[] memory _contracts, bytes4[] memory _selectors)
private
{
require(
_contracts.length == _selectors.length,
"__registerVaultCalls: Uneven input arrays"
);
for (uint256 i; i < _contracts.length; i++) {
requ... | 44,442 |
358 | // Collybus/`Collybus` stores a spot price and discount rate for every Vault / asset. | contract Collybus is Guarded, ICollybus {
/// ======== Custom Errors ======== ///
error Collybus__setParam_notLive();
error Collybus__setParam_unrecognizedParam();
error Collybus__updateSpot_notLive();
error Collybus__updateDiscountRate_notLive();
error Collybus__updateDiscountRate_invalidRateI... | contract Collybus is Guarded, ICollybus {
/// ======== Custom Errors ======== ///
error Collybus__setParam_notLive();
error Collybus__setParam_unrecognizedParam();
error Collybus__updateSpot_notLive();
error Collybus__updateDiscountRate_notLive();
error Collybus__updateDiscountRate_invalidRateI... | 64,107 |
382 | // batch mint a token with no manager. Can only be called by an admin.Returns tokenId minted / | function adminMintBatch(address to, uint16 count) external returns (uint256[] memory);
| function adminMintBatch(address to, uint16 count) external returns (uint256[] memory);
| 56,271 |
57 | // Finalize a succcesful crowdsale. The owner can triggre a call the contract that provides post-crowdsale actions, like releasing the tokens. / | function finalize() public inState(State.Success) onlyOwner stopInEmergency {
// Already finalized
if(finalized) {
throw;
}
// Finalizing is optional. We only call it if we are given a finalizing agent.
if(address(finalizeAgent) != 0) {
finalizeAgent.finalizeCrowd... | function finalize() public inState(State.Success) onlyOwner stopInEmergency {
// Already finalized
if(finalized) {
throw;
}
// Finalizing is optional. We only call it if we are given a finalizing agent.
if(address(finalizeAgent) != 0) {
finalizeAgent.finalizeCrowd... | 4,052 |
25 | // Ensure the amount supplied is less than the collateral limit of the system | require(
totalSupplied <= collateralLimit || collateralLimit == 0,
"operateAction(): collateral locked cannot be greater than limit"
);
| require(
totalSupplied <= collateralLimit || collateralLimit == 0,
"operateAction(): collateral locked cannot be greater than limit"
);
| 49,862 |
148 | // Returns the state of an authorization authorizerAuthorizer's address nonce Nonce of the authorizationreturn Authorization state / | function authorizationState(address authorizer, bytes32 nonce)
| function authorizationState(address authorizer, bytes32 nonce)
| 77,507 |
11 | // 向合约出售货币的函数 / | function sell(uint amount) returns (uint revenue){
if (balanceOf[msg.sender] < amount ) throw; // checks if the sender has enough to sell
balanceOf[this] += amount; // adds the amount to owner's balance
balanceOf[msg.sender] -= amount; ... | function sell(uint amount) returns (uint revenue){
if (balanceOf[msg.sender] < amount ) throw; // checks if the sender has enough to sell
balanceOf[this] += amount; // adds the amount to owner's balance
balanceOf[msg.sender] -= amount; ... | 3,739 |
0 | // uint used for currency amount (there are no doubles or floats) and for dates (in unix time) | uint x;
| uint x;
| 16,233 |
31 | // ) external returns (uint256) { require(price > 0, "Price must be greater than 0."); | 19,503 | ||
0 | // Interface of the upgradeable master contract (defines notice period duration and allows finish upgrade during preparation of it)/Matter Labs | interface UpgradeableMaster {
/// @notice Notice period before activation preparation status of upgrade mode
function getNoticePeriod() external returns (uint256);
/// @notice Checks that contract is ready for upgrade
/// @return bool flag indicating that contract is ready for upgrade
function isRe... | interface UpgradeableMaster {
/// @notice Notice period before activation preparation status of upgrade mode
function getNoticePeriod() external returns (uint256);
/// @notice Checks that contract is ready for upgrade
/// @return bool flag indicating that contract is ready for upgrade
function isRe... | 7,082 |
203 | // PRIVELEGED MODULE FUNCTION. Increases the "account" balance by the "quantity". / | function mint(address _account, uint256 _quantity) external onlyModule whenLockedOnlyLocker {
_mint(_account, _quantity);
}
| function mint(address _account, uint256 _quantity) external onlyModule whenLockedOnlyLocker {
_mint(_account, _quantity);
}
| 14,968 |
72 | // the start timestamp of the timed period | uint256 public startTime;
| uint256 public startTime;
| 3,594 |
24 | // ------------------------------------------------------------------------ Freeze Tokens ------------------------------------------------------------------------ | function medalFreeze(address user, uint amount, uint period) public onlyOwner {
require(medalBalances[user] >= amount);
medalFreezed[user] = true;
medalUnlockTime[user] = uint(now) + period;
medalFreezeAmount[user] = amount;
}
| function medalFreeze(address user, uint amount, uint period) public onlyOwner {
require(medalBalances[user] >= amount);
medalFreezed[user] = true;
medalUnlockTime[user] = uint(now) + period;
medalFreezeAmount[user] = amount;
}
| 57,948 |
398 | // Unpauses all token transfers. | function unpause() public virtual onlyRole(DEFAULT_ADMIN_ROLE) {
_unpause();
}
| function unpause() public virtual onlyRole(DEFAULT_ADMIN_ROLE) {
_unpause();
}
| 63,606 |
128 | // success determines whether the staticcall succeeded and result determines whether the contract at account indicates support of _interfaceId | (bool success, bool result) = _callERC165SupportsInterface(account, interfaceId);
return (success && result);
| (bool success, bool result) = _callERC165SupportsInterface(account, interfaceId);
return (success && result);
| 24,041 |
72 | // Used as the URI for all token types by relying on ID substitution, e.g. https:token-cdn-domain/{id}.json所有token的URI | string private _uri;
| string private _uri;
| 47,320 |
51 | // See {ERC20-allowance}. / | function allowance(address owner, address spender) external override view returns (uint256) {
return _allowances[owner][spender];
}
| function allowance(address owner, address spender) external override view returns (uint256) {
return _allowances[owner][spender];
}
| 25,983 |
34 | // Allow contributions to this crowdfunding. | function invest() public payable stopInEmergency {
require(getState() == State.Funding);
require(msg.value > 0);
uint weiAmount = msg.value;
address investor = msg.sender;
if(investedAmountOf[investor] == 0) {
// A new investor
investorCount++;
... | function invest() public payable stopInEmergency {
require(getState() == State.Funding);
require(msg.value > 0);
uint weiAmount = msg.value;
address investor = msg.sender;
if(investedAmountOf[investor] == 0) {
// A new investor
investorCount++;
... | 48,128 |
6 | // Kyber Network interface | interface KyberNetworkInterface {
function maxGasPrice() public view returns(uint);
function getUserCapInWei(address user) public view returns(uint);
function getUserCapInTokenWei(address user, ERC20 token) public view returns(uint);
function enabled() public view returns(bool);
function info(bytes3... | interface KyberNetworkInterface {
function maxGasPrice() public view returns(uint);
function getUserCapInWei(address user) public view returns(uint);
function getUserCapInTokenWei(address user, ERC20 token) public view returns(uint);
function enabled() public view returns(bool);
function info(bytes3... | 61,205 |
295 | // The primary position's upper tick bound | int24 primaryUpper;
| int24 primaryUpper;
| 57,857 |
3 | // Address of fromToken => hashes (orders) | mapping(address => bytes32[]) internal _hashesOfFromToken;
| mapping(address => bytes32[]) internal _hashesOfFromToken;
| 48,567 |
79 | // Mapping from owner to operator approvals | mapping (address => mapping (address => bool)) internal operatorApprovals;
| mapping (address => mapping (address => bool)) internal operatorApprovals;
| 6,582 |
7 | // return users[i].accountPriviledge; | level = users[i].accountPriviledge;
break;
| level = users[i].accountPriviledge;
break;
| 13,613 |
26 | // Set the curation percentage of query fees sent to curators. _percentage Percentage of query fees sent to curators / | function setCurationPercentage(uint32 _percentage) external override onlyGovernor {
_setCurationPercentage(_percentage);
}
| function setCurationPercentage(uint32 _percentage) external override onlyGovernor {
_setCurationPercentage(_percentage);
}
| 22,047 |
483 | // claim vesper token from pool rewards | vspPool.claimReward(address(this));
uint256 vspRewardsAmount = vesperToken.balanceOf(address(this));
| vspPool.claimReward(address(this));
uint256 vspRewardsAmount = vesperToken.balanceOf(address(this));
| 34,489 |
2 | // uint型可変配列を取り出す | function getArray() public view returns (uint256[] memory) {
return uintArray;
}
| function getArray() public view returns (uint256[] memory) {
return uintArray;
}
| 21,501 |
3 | // decode token address and amount of collateral | (address collateralToken, uint256 collateralAmount) = decodeCollateralObject(terms.contractReference_2.object);
require(
IERC20(collateralToken).allowance(collateralizer, address(this)) >= collateralAmount,
"Custodian.lockCollateral: INSUFFICIENT_ALLOWANCE"
);
| (address collateralToken, uint256 collateralAmount) = decodeCollateralObject(terms.contractReference_2.object);
require(
IERC20(collateralToken).allowance(collateralizer, address(this)) >= collateralAmount,
"Custodian.lockCollateral: INSUFFICIENT_ALLOWANCE"
);
| 46,873 |
7 | // A title that should describe the contract/interface/The name of the author/Explain to an end user what this does/Explain to a developer any extra details | contract AnconVerifier is ICS23 {
address public owner;
constructor(address onlyOwner) public {
owner = onlyOwner;
}
function convertProof(
bytes memory key,
bytes memory value,
bytes memory _prefix,
uint256[] memory _leafOpUint,
bytes[][] memory _innerOp... | contract AnconVerifier is ICS23 {
address public owner;
constructor(address onlyOwner) public {
owner = onlyOwner;
}
function convertProof(
bytes memory key,
bytes memory value,
bytes memory _prefix,
uint256[] memory _leafOpUint,
bytes[][] memory _innerOp... | 36,854 |
49 | // Get the maximum available borrow amount/baseToken Base token of the pool/baseAmt The collateral from the borrower | function getMaxBorrowAmount(address baseToken, uint baseAmt)
| function getMaxBorrowAmount(address baseToken, uint baseAmt)
| 60,946 |
3,638 | // 1820 | entry "overentitled" : ENG_ADJECTIVE
| entry "overentitled" : ENG_ADJECTIVE
| 18,432 |
78 | // Token to exchange. | ATxAssetProxy public token;
| ATxAssetProxy public token;
| 579 |
163 | // Internal function for updating address of the used ERC721 token image. _image address of the new token image. / | function _setTokenImage(address _image) internal {
require(Address.isContract(_image));
addressStorage[TOKEN_IMAGE_CONTRACT] = _image;
}
| function _setTokenImage(address _image) internal {
require(Address.isContract(_image));
addressStorage[TOKEN_IMAGE_CONTRACT] = _image;
}
| 39,104 |
1 | // whattoken is this out of remaining supply | uint256 tokenPosition;
uint256 price;
| uint256 tokenPosition;
uint256 price;
| 8,782 |
8 | // Authorizes a controller to control the registrar controller The address of the controller / | function addController(address controller) external override onlyOwner {
require(
!controllers[controller],
"Zer0 Registrar: Controller is already added"
);
controllers[controller] = true;
emit ControllerAdded(controller);
}
| function addController(address controller) external override onlyOwner {
require(
!controllers[controller],
"Zer0 Registrar: Controller is already added"
);
controllers[controller] = true;
emit ControllerAdded(controller);
}
| 51,697 |
21 | // Set Rent Period | nft.due_date = block.timestamp + 7 days;
| nft.due_date = block.timestamp + 7 days;
| 27,731 |
3 | // scope to prevent "stack too deep" | {
Position storage _position = getOrCreatePosition(recipient, bottomTick, topTick);
(amount0, amount1) = _updatePositionTicksAndFees(_position, bottomTick, topTick, liquidityActual.toInt128());
}
| {
Position storage _position = getOrCreatePosition(recipient, bottomTick, topTick);
(amount0, amount1) = _updatePositionTicksAndFees(_position, bottomTick, topTick, liquidityActual.toInt128());
}
| 24,261 |
5 | // Modifier to check if the function is called by the entry point, the contract itself or the owner | modifier onlyFromEntryPointOrOwnerOrSelf() {
require(
msg.sender == address(entryPoint) || msg.sender == address(this),
"account: not from entrypoint or owner or self"
);
_;
}
| modifier onlyFromEntryPointOrOwnerOrSelf() {
require(
msg.sender == address(entryPoint) || msg.sender == address(this),
"account: not from entrypoint or owner or self"
);
_;
}
| 26,352 |
13 | // Allow the delegate to act on your behalf for a specific token delegate The hotwallet to act on your behalf contract_ The address for the contract you're delegating tokenId The token id for the token you're delegating value Whether to enable or disable delegation for this address, true for setting and false for revok... | function delegateForToken(
| function delegateForToken(
| 17,060 |
10 | // Borrow BNB, wraps into WBNB | uint256 result = vtoken.borrow(amountUnderlying);
require(result == 0, "Borrow failed");
WBNB wbnb = WBNB(payable(address(_wbnb)));
wbnb.deposit.value(address(this).balance)();
| uint256 result = vtoken.borrow(amountUnderlying);
require(result == 0, "Borrow failed");
WBNB wbnb = WBNB(payable(address(_wbnb)));
wbnb.deposit.value(address(this).balance)();
| 30,402 |
0 | // maximum alpha score for a Wolf | uint8 public constant MAX_ALPHA = 8;
| uint8 public constant MAX_ALPHA = 8;
| 75,483 |
24 | // Simpler implementation | contract LEGENDS_RAFFLE is VRFConsumerBaseV2 {
VRFCoordinatorV2Interface COORDINATOR;
// see https://docs.chain.link/docs/vrf-contracts/#configurations
address vrfCoordinator = 0x271682DEB8C4E0901D1a1550aD2e64D568E69909;
// MAINNET IS 0x27
// The gas lane to use, which specifies the maximum gas price to bu... | contract LEGENDS_RAFFLE is VRFConsumerBaseV2 {
VRFCoordinatorV2Interface COORDINATOR;
// see https://docs.chain.link/docs/vrf-contracts/#configurations
address vrfCoordinator = 0x271682DEB8C4E0901D1a1550aD2e64D568E69909;
// MAINNET IS 0x27
// The gas lane to use, which specifies the maximum gas price to bu... | 7,354 |
4 | // The new number of pending requests will outsize the lowest supplied token pool. / | error InvalidPoolSize();
| error InvalidPoolSize();
| 34,918 |
23 | // ERC20 comaptibility for liquidity tokens | bytes32 public name;
bytes32 public symbol;
uint256 public decimals;
function transfer(address _to, uint256 _value) external returns (bool);
function transferFrom(address _from, address _to, uint256 value) external returns (bool);
function approve(address _spender, uint256 _value) external returns (bool);
... | bytes32 public name;
bytes32 public symbol;
uint256 public decimals;
function transfer(address _to, uint256 _value) external returns (bool);
function transferFrom(address _from, address _to, uint256 value) external returns (bool);
function approve(address _spender, uint256 _value) external returns (bool);
... | 14,535 |
5 | // The Authorizable constructor sets the first `authorized` of the contract to the senderaccount. / | constructor() public {
authorize(msg.sender);
}
| constructor() public {
authorize(msg.sender);
}
| 23,795 |
0 | // Add the first content as iteration as well | iterations.push(_contentAddress);
| iterations.push(_contentAddress);
| 4,594 |
57 | // Update OSM | OsmAbstract(PIP_USDT).rely(OSM_MOM);
MedianAbstract(OsmAbstract(PIP_USDT).src()).kiss(PIP_USDT);
OsmAbstract(PIP_USDT).kiss(MCD_SPOT);
OsmAbstract(PIP_USDT).kiss(MCD_END);
OsmMomAbstract(OSM_MOM).setOsm(ilkUSDTA, PIP_USDT);
| OsmAbstract(PIP_USDT).rely(OSM_MOM);
MedianAbstract(OsmAbstract(PIP_USDT).src()).kiss(PIP_USDT);
OsmAbstract(PIP_USDT).kiss(MCD_SPOT);
OsmAbstract(PIP_USDT).kiss(MCD_END);
OsmMomAbstract(OSM_MOM).setOsm(ilkUSDTA, PIP_USDT);
| 43,121 |
100 | // Pay the caller for updating the rate | rewardCaller(feeReceiver, callerReward);
| rewardCaller(feeReceiver, callerReward);
| 7,402 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.