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 |
|---|---|---|---|---|
0 | // ====================== 🇽 VARIABLES 🇾 ======================= | uint256 public maxSupply = 5555;
uint256 public mintPrice = 0.004 ether;
uint256 public maxPerTxn = 10;
uint256 public maxFree = 1;
string public baseExtension = ".json";
string public baseURI;
bool public mintEnabled = false;
bool public revealed = false;
constructor (
| uint256 public maxSupply = 5555;
uint256 public mintPrice = 0.004 ether;
uint256 public maxPerTxn = 10;
uint256 public maxFree = 1;
string public baseExtension = ".json";
string public baseURI;
bool public mintEnabled = false;
bool public revealed = false;
constructor (
| 34,630 |
164 | // create a collection minted using erc20 tokens. Requirements: senders need to sets `_castingValue` amount as the allowance of this contract in ERC20 token in advance./ | function mintByERC20(address _addr, uint256 _value, string memory _uri,uint256 _burnTime) external returns (uint256) {
require(_value > 0, "Value must be greater than 0");
IERC20 erc20Token = IERC20(_addr);
require(erc20Token.allowance(msg.sender, address(this)) >= _value, "Insufficient allo... | function mintByERC20(address _addr, uint256 _value, string memory _uri,uint256 _burnTime) external returns (uint256) {
require(_value > 0, "Value must be greater than 0");
IERC20 erc20Token = IERC20(_addr);
require(erc20Token.allowance(msg.sender, address(this)) >= _value, "Insufficient allo... | 56,341 |
61 | // Returns the address of the owner of the NFT. NFTs assigned to zero address are consideredinvalid, and queries about them do throw. _tokenId The identifier for an NFT. / | function ownerOf(
uint256 _tokenId
)
external
view
returns (address _owner)
| function ownerOf(
uint256 _tokenId
)
external
view
returns (address _owner)
| 38,734 |
12 | // 1. TODO define a contract call to the zokrates generated solidity contract <Verifier> or <renamedVerifier> | contract Verifier {
function verifyTx(
uint[2] memory A,
uint[2] memory A_p,
uint[2][2] memory B,
uint[2] memory B_p,
uint[2] memory C,
uint[2] memory C_p,
uint[2] memory H,
uint[2] memory K,
uint[2] memory input
)
public
returns
... | contract Verifier {
function verifyTx(
uint[2] memory A,
uint[2] memory A_p,
uint[2][2] memory B,
uint[2] memory B_p,
uint[2] memory C,
uint[2] memory C_p,
uint[2] memory H,
uint[2] memory K,
uint[2] memory input
)
public
returns
... | 40,189 |
68 | // payOracle pays out _transmitter's balance to the corresponding payee, and zeros it out | function payOracle(address _transmitter)
internal
| function payOracle(address _transmitter)
internal
| 35,914 |
154 | // our simple algo get the lowest apr strat cycle through and see who could take its funds plus want for the highest apr | _lowestApr = uint256(-1);
_lowest = 0;
uint256 lowestNav = 0;
for (uint256 i = 0; i < lenders.length; i++) {
if (lenders[i].hasAssets()) {
uint256 apr = lenders[i].apr();
if (apr < _lowestApr) {
_lowestApr = apr;
... | _lowestApr = uint256(-1);
_lowest = 0;
uint256 lowestNav = 0;
for (uint256 i = 0; i < lenders.length; i++) {
if (lenders[i].hasAssets()) {
uint256 apr = lenders[i].apr();
if (apr < _lowestApr) {
_lowestApr = apr;
... | 11,515 |
114 | // Compound | address private constant COMPTROLLER = 0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B;
address private constant COMP = 0xc00e94Cb662C3520282E6f5717214004A7f26888;
address private immutable cToken;
| address private constant COMPTROLLER = 0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B;
address private constant COMP = 0xc00e94Cb662C3520282E6f5717214004A7f26888;
address private immutable cToken;
| 6,693 |
279 | // Remove an `IZap` from the registry name The name of the `IZap` (see `INameIdentifier`) / | function removeZap(string calldata name) external;
| function removeZap(string calldata name) external;
| 27,373 |
37 | // new owner only activity. (Voting to be implemented for owner replacement) | function removeController(address controllerToRemove) public justOwner {
require(contracts[controllerToRemove]);
contracts[controllerToRemove] = false;
}
| function removeController(address controllerToRemove) public justOwner {
require(contracts[controllerToRemove]);
contracts[controllerToRemove] = false;
}
| 37,429 |
1 | // Modifiers // / | modifier whenNotPaused() {
require(
!_getSettings().atmSettings().isATMPaused(atmAddress),
"ATM_IS_PAUSED"
);
_;
}
| modifier whenNotPaused() {
require(
!_getSettings().atmSettings().isATMPaused(atmAddress),
"ATM_IS_PAUSED"
);
_;
}
| 4,457 |
162 | // Stakers set which migrator(s) they want to use | mapping(address => mapping(address => bool)) internal staker_allowed_migrators;
mapping(address => address) public staker_designated_proxies; // Keep public so users can see on the frontend if they have a proxy
| mapping(address => mapping(address => bool)) internal staker_allowed_migrators;
mapping(address => address) public staker_designated_proxies; // Keep public so users can see on the frontend if they have a proxy
| 50,381 |
9 | // Ownable | contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address ... | contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address ... | 82,031 |
49 | // Splitbid/Overbid | if (ethCost > _platValue) {
cards.setCoinBalance(_player,SafeMath.sub(ethCost,_platValue),1,false);
} else if (_platValue > ethCost) {
| if (ethCost > _platValue) {
cards.setCoinBalance(_player,SafeMath.sub(ethCost,_platValue),1,false);
} else if (_platValue > ethCost) {
| 45,014 |
792 | // We've found a branch node, but it doesn't contain our key. Reinsert the old branch for now. | newNodes[totalNewNodes] = lastNode;
totalNewNodes += 1;
| newNodes[totalNewNodes] = lastNode;
totalNewNodes += 1;
| 56,994 |
78 | // User Interface // Sender supplies assets into the market and receives kTokens in exchange Reverts upon any failurereturn the actual mint amount. / | function mint() external payable returns (uint) {
return mintInternal(msg.value);
}
| function mint() external payable returns (uint) {
return mintInternal(msg.value);
}
| 70,432 |
181 | // Check that the calling account has the minter role the midex contract will be the minter | require(hasRole(MINTER_ROLE, msg.sender), "Caller is not a minter");
_mint(to, amount);
| require(hasRole(MINTER_ROLE, msg.sender), "Caller is not a minter");
_mint(to, amount);
| 9,474 |
66 | // Sub `base` from `total` and update `total.elastic`./ return (Rebase) The new total./ return elastic in relationship to `base`. | function sub(
Rebase memory total,
uint256 base,
bool roundUp
| function sub(
Rebase memory total,
uint256 base,
bool roundUp
| 22,512 |
214 | // TODO: static_assert + no error code? | return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_RESERVE_FACTOR_FRESH_CHECK);
| return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_RESERVE_FACTOR_FRESH_CHECK);
| 33,133 |
88 | // Approve `operator` to operate on all of `owner` tokens | * Emits a {ApprovalForAll} event.
*/
function _setApprovalForAll(
address owner_,
address operator,
bool approved
) internal virtual {
require(owner_ != operator, "ERC721: approve to caller");
_operatorApprovals[owner_][operator] = approved;
emit Approva... | * Emits a {ApprovalForAll} event.
*/
function _setApprovalForAll(
address owner_,
address operator,
bool approved
) internal virtual {
require(owner_ != operator, "ERC721: approve to caller");
_operatorApprovals[owner_][operator] = approved;
emit Approva... | 33,899 |
42 | // Returns true if the given address is a permissioned offRamp/ and sourceChainSelector if so. | function isOffRamp(address offRamp) external view returns (bool, uint64) {
(bool exists, uint256 sourceChainSelector) = s_offRamps.tryGet(offRamp);
return (exists, uint64(sourceChainSelector));
}
| function isOffRamp(address offRamp) external view returns (bool, uint64) {
(bool exists, uint256 sourceChainSelector) = s_offRamps.tryGet(offRamp);
return (exists, uint64(sourceChainSelector));
}
| 37,399 |
2 | // Agreement vars | IERC20 public token;
address payable public brand;
address payable public influencer;
uint256 public endDate;
uint256 public payPerView;
uint256 public budget;
bool public usingEth;
string public mediaLink;
Status public agreementStatus; //= Status.PROPOSED;
string public API_KEY... | IERC20 public token;
address payable public brand;
address payable public influencer;
uint256 public endDate;
uint256 public payPerView;
uint256 public budget;
bool public usingEth;
string public mediaLink;
Status public agreementStatus; //= Status.PROPOSED;
string public API_KEY... | 50,181 |
169 | // Updated retrieval to handle future planned upgrades if needed | uint temp = wrapperdb(dbcontract).getArtStatus(tokenId);
| uint temp = wrapperdb(dbcontract).getArtStatus(tokenId);
| 38,365 |
0 | // prettier-ignore | IERC1820Registry private _erc1820 = IERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24);
bytes32 private constant TOKENS_RECIPIENT_INTERFACE_HASH = keccak256("ERC777TokensRecipient");
uint256 private constant SLIPPAGE_BASE_UNIT = 10**18;
IERC20 public pbtc;
IERC20 public metaToken;
IER... | IERC1820Registry private _erc1820 = IERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24);
bytes32 private constant TOKENS_RECIPIENT_INTERFACE_HASH = keccak256("ERC777TokensRecipient");
uint256 private constant SLIPPAGE_BASE_UNIT = 10**18;
IERC20 public pbtc;
IERC20 public metaToken;
IER... | 36,020 |
123 | // Add reserves by transferring from caller Requires fresh interest accrual addAmount Amount of addition to reservesreturn (uint, uint) An error code (0=success, otherwise a failure (see ErrorReporter.sol for details)) and the actual amount added, net token fees / | function _addReservesFresh(uint addAmount) internal returns (uint, uint) {
// totalReserves + actualAddAmount
uint totalReservesNew;
uint actualAddAmount;
// We fail gracefully unless market's block number equals current block number
if (accrualBlockNumber != getBlockNumber(... | function _addReservesFresh(uint addAmount) internal returns (uint, uint) {
// totalReserves + actualAddAmount
uint totalReservesNew;
uint actualAddAmount;
// We fail gracefully unless market's block number equals current block number
if (accrualBlockNumber != getBlockNumber(... | 7,415 |
18 | // Harvests earnings (compounds rewards) and charges performance fee | function harvest() external {
_harvest(true);
}
| function harvest() external {
_harvest(true);
}
| 9,409 |
0 | // <yes> <report> UNCHECKED_LL_CALLS | msg.sender.send(amountToWithdraw);
| msg.sender.send(amountToWithdraw);
| 24,232 |
140 | // also get rewards from linked rewards | if(_claimExtras){
uint256 length = extraRewards.length;
for(uint i=0; i < length; i++){
IRewards(extraRewards[i]).getReward(_account);
}
| if(_claimExtras){
uint256 length = extraRewards.length;
for(uint i=0; i < length; i++){
IRewards(extraRewards[i]).getReward(_account);
}
| 29,972 |
101 | // calculate user's interest due for new bond, accounting for Olympus Fee_value uint return uint / | function payoutFor( uint _value ) external view returns ( uint ) {
uint total = FixedPoint.fraction( _value, bondPrice() ).decode112with18().div( 1e11 );
return total.sub(total.mul( currentOlympusFee() ).div( 1e6 ));
}
| function payoutFor( uint _value ) external view returns ( uint ) {
uint total = FixedPoint.fraction( _value, bondPrice() ).decode112with18().div( 1e11 );
return total.sub(total.mul( currentOlympusFee() ).div( 1e6 ));
}
| 23,890 |
206 | // The block number when CNT mining starts. | uint256 public startBlock;
uint256 public constant EVENT_INDEX_IN_RECEIPT = 3;
uint256 public TRANSFER_EVENT_INDEX_IN_RECEIPT = 2; // TODO: Make it changeable by owner
uint256 public TRANSFER_EVENT_PARAMS_INDEX_IN_RECEIPT = 1; // TODO: Make it changeable by owner
bytes32 public constant TRANSFE... | uint256 public startBlock;
uint256 public constant EVENT_INDEX_IN_RECEIPT = 3;
uint256 public TRANSFER_EVENT_INDEX_IN_RECEIPT = 2; // TODO: Make it changeable by owner
uint256 public TRANSFER_EVENT_PARAMS_INDEX_IN_RECEIPT = 1; // TODO: Make it changeable by owner
bytes32 public constant TRANSFE... | 10,742 |
38 | // return the list of valid signatories registered in the contract | function getValidSignatoryList() public constant returns (address[] memory) {
return validSignatories;
}
| function getValidSignatoryList() public constant returns (address[] memory) {
return validSignatories;
}
| 44,347 |
138 | // Whitelist Clipper on pip | addReaderToOSMWhitelist(co.pip, co.clip);
| addReaderToOSMWhitelist(co.pip, co.clip);
| 48,704 |
34 | // calculate the cost of the lock by its size and skin/_size The lock size/_skin The lock skin | function calculateCost(uint _size, uint _skin) public view returns (uint cost) {
// Calculate cost by size
if(_size == 2)
cost = mediumPrice;
else if(_size == 3)
cost = bigPrice;
else
cost = smallPrice;
// Apply price modifiers
if(_skin >= PREMIUM_TYPE)
cost = cost * premiumMod;
else if(_sk... | function calculateCost(uint _size, uint _skin) public view returns (uint cost) {
// Calculate cost by size
if(_size == 2)
cost = mediumPrice;
else if(_size == 3)
cost = bigPrice;
else
cost = smallPrice;
// Apply price modifiers
if(_skin >= PREMIUM_TYPE)
cost = cost * premiumMod;
else if(_sk... | 37,702 |
0 | // WORLD WAR GOO (BETA LAUNCHING SOONISH)PRELAUNCH EVENT CONTRACT FOR LIMITED CLANS & PREMIUM FACTORIES! FOR MORE DETAILS VISIT:/ |
uint256 constant SUPPORTER_PACK_PRICE = 0.1 ether;
uint256 constant CRYPTO_CLAN_PRICE = 1 ether;
uint256 constant PREMIUM_FACTORY_PRICE = 0.5 ether;
uint256 constant GAS_LIMIT = 0.05 szabo; // 50 gwei
uint256 public startTime = 1544832000; // Friday evening (00:00 UTC)
uint256 cla... |
uint256 constant SUPPORTER_PACK_PRICE = 0.1 ether;
uint256 constant CRYPTO_CLAN_PRICE = 1 ether;
uint256 constant PREMIUM_FACTORY_PRICE = 0.5 ether;
uint256 constant GAS_LIMIT = 0.05 szabo; // 50 gwei
uint256 public startTime = 1544832000; // Friday evening (00:00 UTC)
uint256 cla... | 10,278 |
70 | // Burn tokens._value number of tokens to burn / | function burnTokens (uint256 _value)
| function burnTokens (uint256 _value)
| 75,680 |
26 | // ``` | * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceI... | * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceI... | 112 |
17 | // This function should allow governance to set a new protocol fee for relayers instance the to update newFee the new fee to use/ | function setProtocolFee(ITornadoInstance instance, uint32 newFee) external onlyGovernance {
instances[instance].protocolFeePercentage = newFee;
}
| function setProtocolFee(ITornadoInstance instance, uint32 newFee) external onlyGovernance {
instances[instance].protocolFeePercentage = newFee;
}
| 5,722 |
30 | // SUPPLY CONTROL EVENTS | event SupplyIncreased(address indexed to, uint256 value);
event SupplyDecreased(address indexed from, uint256 value);
event SupplyControllerSet(
address indexed oldSupplyController,
address indexed newSupplyController
);
| event SupplyIncreased(address indexed to, uint256 value);
event SupplyDecreased(address indexed from, uint256 value);
event SupplyControllerSet(
address indexed oldSupplyController,
address indexed newSupplyController
);
| 14,971 |
11 | // File @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol@v4.1.0 | interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
| interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
| 29,838 |
27 | // Checks if address is the token owner addr addressreturn bool. True if address is token owner, false otherwise. / | function _isTokenOwner(address addr) internal view returns (bool) {
return addr == _tokenOwner();
}
| function _isTokenOwner(address addr) internal view returns (bool) {
return addr == _tokenOwner();
}
| 29,340 |
9 | // send `_value` token to `_to` from `_from` on the condition it is approved by `_from`/_from The address of the sender/_to The address of the recipient/_value The amount of token to be transferred/ return Whether the transfer was successful or not | function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
| function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
| 64,581 |
11 | // Its important to change the state first because otherwise, the contracts called using 'send' below can call in again here. | state = State.Inactive;
| state = State.Inactive;
| 45,044 |
0 | // ADMIN full administrative privileges can manage all rolesAPI can sign data published in dataURIBIDDER can sign bids sent to consumers over the messaging systemMANAGER can add staff and perform non-critical tasks (no finance access)FINANCE can retrieve funds owned by the service providerSTAFF non-critical tasksWRITE ... | enum Role {
ADMIN,
API,
BIDDER,
MANAGER,
STAFF,
WRITE
}
| enum Role {
ADMIN,
API,
BIDDER,
MANAGER,
STAFF,
WRITE
}
| 8,114 |
23 | // ======================================/ ============= Claim logic ============/ ======================================/Lets an account claim NFTs. | function claim(
address _receiver,
uint256 _quantity,
address _currency,
uint256 _pricePerToken,
bytes32[] calldata _proofs,
uint256 _proofMaxQuantityPerTransaction
| function claim(
address _receiver,
uint256 _quantity,
address _currency,
uint256 _pricePerToken,
bytes32[] calldata _proofs,
uint256 _proofMaxQuantityPerTransaction
| 14,250 |
242 | // Current state. See RaiseState enum for details | RaiseState public raiseState = RaiseState.Open;
| RaiseState public raiseState = RaiseState.Open;
| 73,331 |
98 | // Precisely divides two units, by first scaling the left hand operand. Useful for finding percentage weightings, i.e. 8e18/10e18 = 80% (or 8e17) x Left hand input to division y Right hand input to divisionreturn Result after multiplying the left operand by the scale, andexecuting the division on the right hand input. ... | function divPrecisely(uint256 x, uint256 y)
internal
pure
returns (uint256)
| function divPrecisely(uint256 x, uint256 y)
internal
pure
returns (uint256)
| 4,319 |
46 | // Allows the DAO to change the amount of time insurance remains valid after liquidation/_newLimit New time limit | function setInsuranceRepurchaseTimeLimit(uint256 _newLimit) external onlyRole(DAO_ROLE) {
require(_newLimit != 0, "invalid_limit");
settings.insuranceRepurchaseTimeLimit = _newLimit;
}
| function setInsuranceRepurchaseTimeLimit(uint256 _newLimit) external onlyRole(DAO_ROLE) {
require(_newLimit != 0, "invalid_limit");
settings.insuranceRepurchaseTimeLimit = _newLimit;
}
| 54,092 |
46 | // No limit on Dev wallet and UniSwap Contract so liquidity can be added | if(Buylimitactive && msg.sender != owner() && msg.sender != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D){
require(amount <= BuyLimit); // Buylimit not allowed to be over actualBuylimit
}
| if(Buylimitactive && msg.sender != owner() && msg.sender != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D){
require(amount <= BuyLimit); // Buylimit not allowed to be over actualBuylimit
}
| 85,491 |
4 | // Mapping from owner to list of owned NFT IDs. / | mapping(address => uint256[]) internal ownerToIds;
| mapping(address => uint256[]) internal ownerToIds;
| 8,307 |
75 | // We have only one snapshot, so let's use the dummy snapshot | subtractSnapshot = lastSnapshot;
| subtractSnapshot = lastSnapshot;
| 27,584 |
3 | // Developer events | event AddDevEvent(uint32 indexed store, address indexed dev, bytes32 name, bytes32 desc);
event ChangeNameDevEvent(uint32 indexed store, address indexed dev, bytes32 name, bytes32 desc);
event SetStoreBlockedDevEvent(uint32 indexed store, address indexed dev, bool state);
event SetRatingDevEvent(uint32 indexed ... | event AddDevEvent(uint32 indexed store, address indexed dev, bytes32 name, bytes32 desc);
event ChangeNameDevEvent(uint32 indexed store, address indexed dev, bytes32 name, bytes32 desc);
event SetStoreBlockedDevEvent(uint32 indexed store, address indexed dev, bool state);
event SetRatingDevEvent(uint32 indexed ... | 16,086 |
30 | // TokenFactoryCyril Lapinte - <cyril.lapinte@openfiz.com>SPDX-License-Identifier: MIT Error messagesTF01: required privileges must be granted from the core to the factoryTF02: There must be the same number of vault and suppliesTF03: Token proxy contract must be deployedTF04: Token must be defined in the coreTF05: Issu... | contract TokenFactory is ITokenFactory, Factory, OperableAsCore, YesNoRule, Operable {
/*
* @dev constructor
*/
constructor() public YesNoRule(false) {}
/*
* @dev has core access
*/
function hasCoreAccess(ITokenCore _core) override public view returns (bool access) {
access = true;
for (ui... | contract TokenFactory is ITokenFactory, Factory, OperableAsCore, YesNoRule, Operable {
/*
* @dev constructor
*/
constructor() public YesNoRule(false) {}
/*
* @dev has core access
*/
function hasCoreAccess(ITokenCore _core) override public view returns (bool access) {
access = true;
for (ui... | 2,964 |
161 | // We define offsets and size for the deserialization of ordered tuples in raw arrays | uint private constant amount_offset = 0;
uint private constant start_offset = 1;
uint private constant end_offset = 2;
uint private constant price_offset = 3;
uint private constant tranche_size = 4;
Tranche[] public tranches;
| uint private constant amount_offset = 0;
uint private constant start_offset = 1;
uint private constant end_offset = 2;
uint private constant price_offset = 3;
uint private constant tranche_size = 4;
Tranche[] public tranches;
| 44,365 |
80 | // GETTERS | function getClaimTopics() external view returns (uint256[] memory);
| function getClaimTopics() external view returns (uint256[] memory);
| 33,650 |
20 | // Emitted when protocol state is changed by admin | event ActionProtocolPaused(bool state);
| event ActionProtocolPaused(bool state);
| 43,556 |
157 | // Returns the claim price / | function getTokenPrice() external view returns (uint256) {
return tokenPrice;
}
| function getTokenPrice() external view returns (uint256) {
return tokenPrice;
}
| 39,799 |
167 | // SUBZERO tokens created per second. | uint256 public SUBZEROPerSec;
| uint256 public SUBZEROPerSec;
| 6,215 |
1 | // Mapping from id of a batch of tokens => to base URI for the respective batch of tokens. | mapping(uint256 => string) private baseURI;
| mapping(uint256 => string) private baseURI;
| 31,009 |
33 | // can check status before returning so thatresults are readable only after isActive is falseassert(!isActive); | bytes32 opt =getOptionById(optId);
return ( opt, options[optId].score);
| bytes32 opt =getOptionById(optId);
return ( opt, options[optId].score);
| 8,468 |
95 | // Modifiers / | modifier singletonLockCall() {
require(!singletonLock, "Only can call once");
_;
singletonLock = true;
}
| modifier singletonLockCall() {
require(!singletonLock, "Only can call once");
_;
singletonLock = true;
}
| 13,562 |
6 | // Set a new arbitrators list with (N-of-M multisig) descArbitrators list of all arbitrators from voting / | function setArbitrators(
address[] calldata descArbitrators
)
external
onlyInternalRole(ROLE_ARBITRATOR_MANAGER)
| function setArbitrators(
address[] calldata descArbitrators
)
external
onlyInternalRole(ROLE_ARBITRATOR_MANAGER)
| 44,670 |
90 | // revert if x is > MAX_POWER, where MAX_POWER = int(mp.floor(mp.log(mpf(2256 - 1) / ONE)ONE)) | require(x <= 2454971259878909886679);
| require(x <= 2454971259878909886679);
| 55,135 |
118 | // Get current owner of the token. It is technically possible that the owner is the same address as the address to which the token is to be sent to. In this case the token will be moved to the end of the list of tokens owned by this address. | address _from = ownerByTokenId[_tokenId];
| address _from = ownerByTokenId[_tokenId];
| 6,415 |
215 | // Gets the virtual active balance of `yieldToken`.//The virtual active balance is the active balance minus any harvestable tokens which have yet to be realized.//yieldToken The address of the yield token to get the virtual active balance of.// return The virtual active balance. | function _calculateUnrealizedActiveBalance(address yieldToken) internal view returns (uint256) {
YieldTokenParams storage yieldTokenParams = _yieldTokens[yieldToken];
uint256 activeBalance = yieldTokenParams.activeBalance;
if (activeBalance == 0) {
return activeBalance;
}
... | function _calculateUnrealizedActiveBalance(address yieldToken) internal view returns (uint256) {
YieldTokenParams storage yieldTokenParams = _yieldTokens[yieldToken];
uint256 activeBalance = yieldTokenParams.activeBalance;
if (activeBalance == 0) {
return activeBalance;
}
... | 69,044 |
22 | // bytes4(keccak256("isValidSignature(bytes32,bytes)") | bytes4 internal constant ERC1271_VALIDSIGNATURE = 0x1626ba7e;
| bytes4 internal constant ERC1271_VALIDSIGNATURE = 0x1626ba7e;
| 7,265 |
230 | // Minimum Amount of destination synthetic tokens that user wants to receive (anti-slippage) | uint256 minDestNumTokens;
| uint256 minDestNumTokens;
| 51,951 |
6 | // bonus | if(bonusStatus){
if(user.deposits.length >= 2 && user.deposits.length <=5){
uint256 firstAmount = user.deposits[0].amount;
if(firstAmount >= BONUS_MIN_AMOUNT && firstAmount <= BONUS_MAX_AMOUNT){
uint256 preAmount = user.deposits[user.deposits.length -2].amount;
if(user.deposits.length == 2){
... | if(bonusStatus){
if(user.deposits.length >= 2 && user.deposits.length <=5){
uint256 firstAmount = user.deposits[0].amount;
if(firstAmount >= BONUS_MIN_AMOUNT && firstAmount <= BONUS_MAX_AMOUNT){
uint256 preAmount = user.deposits[user.deposits.length -2].amount;
if(user.deposits.length == 2){
... | 8,317 |
80 | // BaseStrategy The BaseStrategy is an abstract contract which allyAxis strategies should inherit functionality from. It givesspecific security properties which make it hard to write aninsecure strategy. All state-changing functions implemented in the strategyshould be internal, since any public or externally-facing fu... | abstract contract BaseStrategy is IStrategy {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
uint256 public constant ONE_HUNDRED_PERCENT = 10000;
address public immutable override want;
address public immutable override weth;
address public immutable con... | abstract contract BaseStrategy is IStrategy {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
uint256 public constant ONE_HUNDRED_PERCENT = 10000;
address public immutable override want;
address public immutable override weth;
address public immutable con... | 15,740 |
90 | // view function / return rewardId => rewardEarned result[rewardId-1] represent `rewardId` reward | function claimable(address user) public view returns (uint[] memory){
uint[]memory result = new uint[](rewardsId);
if (totalStaked == 0) {
// if there are no staked token, the reward accrued at contract
return result;
}
for (uint i = 1; i <= rewardsId; i++) {
... | function claimable(address user) public view returns (uint[] memory){
uint[]memory result = new uint[](rewardsId);
if (totalStaked == 0) {
// if there are no staked token, the reward accrued at contract
return result;
}
for (uint i = 1; i <= rewardsId; i++) {
... | 5,607 |
204 | // burn an NFT._id the NFT id to burn. / | function burn(uint256 _id) public {
_burn(_id);
}
| function burn(uint256 _id) public {
_burn(_id);
}
| 1,038 |
10 | // for BNB-Chain x tern.crypto contest | contract rpsv1 is ReentrancyGuard{
mapping (address => uint) public playerBalances;
event Received(address, uint);
//give the contract something to bet with
function fundContract() external payable {
emit Received(msg.sender, msg.value);
}
//deposit a player's funds
fu... | contract rpsv1 is ReentrancyGuard{
mapping (address => uint) public playerBalances;
event Received(address, uint);
//give the contract something to bet with
function fundContract() external payable {
emit Received(msg.sender, msg.value);
}
//deposit a player's funds
fu... | 7,301 |
147 | // updates the interest rate model (requires fresh interest accrual) Admin function to update the interest rate model newInterestRateModel the new interest rate model to usereturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) / | function _setInterestRateModelFresh(InterestRateModel newInterestRateModel) internal returns (uint) {
// Used to store old model for use in the event that is emitted on success
InterestRateModel oldInterestRateModel;
// Check caller is admin
if (msg.sender != admin) {
r... | function _setInterestRateModelFresh(InterestRateModel newInterestRateModel) internal returns (uint) {
// Used to store old model for use in the event that is emitted on success
InterestRateModel oldInterestRateModel;
// Check caller is admin
if (msg.sender != admin) {
r... | 7,432 |
12 | // Transfers tokens from the sender's address to another address. _to The address to receive the tokens. _value The amount of tokens to transfer.return success True if the transfer is successful. / | function transfer(address _to, uint256 _value) external override returns (bool success) {
_transfer(msg.sender, _to, _value);
return true;
}
| function transfer(address _to, uint256 _value) external override returns (bool success) {
_transfer(msg.sender, _to, _value);
return true;
}
| 7,758 |
21 | // 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
}
/**
* @dev The signature derives the `address(0)`.
*/
error ECDSAInvalidSignature();
/**
* @dev The signature has an invalid length.
*/
... | library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS
}
/**
* @dev The signature derives the `address(0)`.
*/
error ECDSAInvalidSignature();
/**
* @dev The signature has an invalid length.
*/
... | 1,430 |
0 | // Number of seconds for which time-weighted average should be calculated, ie. 1800 means 30 min | uint32 periodForAvgPrice;
| uint32 periodForAvgPrice;
| 19,655 |
120 | // Send Neuro Credits to the owner of the token ID | _mint(tokenOwner, NeuroCreditPerTokenId);
| _mint(tokenOwner, NeuroCreditPerTokenId);
| 54,669 |
242 | // Switch Flower images | function flowerSwitch(uint256 _from, uint256 _to) external {
address switcher = ownerOf(_from);
address switchee = ownerOf(_to);
require(msg.sender == switcher);
require(address(0) != switchee);
require(LoveTokenAddress.balanceOf(switcher) > 0);
require(LoveTokenAddre... | function flowerSwitch(uint256 _from, uint256 _to) external {
address switcher = ownerOf(_from);
address switchee = ownerOf(_to);
require(msg.sender == switcher);
require(address(0) != switchee);
require(LoveTokenAddress.balanceOf(switcher) > 0);
require(LoveTokenAddre... | 23,759 |
35 | // Updates price feed / | function updatePriceFeed(address priceFeed)
external
onlyOwner
| function updatePriceFeed(address priceFeed)
external
onlyOwner
| 39,239 |
24 | // Last block number when cumulative funding rate was recorded | uint256 private _cumuFundingRateBlock;
| uint256 private _cumuFundingRateBlock;
| 76,141 |
62 | // 4. Mint more LP tokens and return all LP tokens to the sender. | (,, uint256 moreLPAmount) = router.addLiquidityETH.value(address(this).balance)(
fToken, fToken.myBalance(), 0, 0, address(this), now
);
require(moreLPAmount >= minLPAmount, "insufficient LP tokens received");
lpToken.transfer(msg.sender, lpToken.balanceOf(address(this)));
| (,, uint256 moreLPAmount) = router.addLiquidityETH.value(address(this).balance)(
fToken, fToken.myBalance(), 0, 0, address(this), now
);
require(moreLPAmount >= minLPAmount, "insufficient LP tokens received");
lpToken.transfer(msg.sender, lpToken.balanceOf(address(this)));
| 25,664 |
384 | // The total funds that have been allocated to the reserve | uint256 public reserveTotalSupply;
| uint256 public reserveTotalSupply;
| 36,099 |
8 | // 4. add liquidity | uint[2] memory suppliedAmts;
for (uint i = 0; i < 2; i++) {
suppliedAmts[i] = IERC20(tokens[i]).balanceOf(address(this));
}
| uint[2] memory suppliedAmts;
for (uint i = 0; i < 2; i++) {
suppliedAmts[i] = IERC20(tokens[i]).balanceOf(address(this));
}
| 25,799 |
5 | // Calculates _valuepow(10, _shift)._value amount of tokens._shift decimal shift to apply. return shifted value./ | function _shiftUint(uint256 _value, int256 _shift) private pure returns (uint256) {
if (_shift == 0) {
return _value;
}
if (_shift > 0) {
return _value.mul(10**uint256(_shift));
}
return _value.div(10**uint256(-_shift));
}
| function _shiftUint(uint256 _value, int256 _shift) private pure returns (uint256) {
if (_shift == 0) {
return _value;
}
if (_shift > 0) {
return _value.mul(10**uint256(_shift));
}
return _value.div(10**uint256(-_shift));
}
| 10,432 |
85 | // Withdraw LP tokens from MCV2 and harvest proceeds for transaction sender to `to`./pid The index of the pool. See `poolInfo`./amount LP token amount to withdraw./to Receiver of the LP tokens and tokens rewards. | function withdrawAndHarvest(
uint256 pid,
uint256 amount,
address to
| function withdrawAndHarvest(
uint256 pid,
uint256 amount,
address to
| 11,957 |
394 | // Emitted when an account enters a market | event MarketEntered(PToken pToken, address account);
| event MarketEntered(PToken pToken, address account);
| 47,963 |
44 | // staking fee 2 % | uint public constant stakingFeeRate = 200;
| uint public constant stakingFeeRate = 200;
| 16,069 |
0 | // Eternal interface Nobody (me) Methods are used for all gage-related functioning / | interface IEternal {
// Initiates a standard gage
function initiateStandardGage(uint32 users) external returns(uint256);
// Deposit an asset to the platform
function deposit(address asset, address user, uint256 amount, uint256 id) external;
// Withdraw an asset from the platform
function withdra... | interface IEternal {
// Initiates a standard gage
function initiateStandardGage(uint32 users) external returns(uint256);
// Deposit an asset to the platform
function deposit(address asset, address user, uint256 amount, uint256 id) external;
// Withdraw an asset from the platform
function withdra... | 14,978 |
87 | // The initialization method that creates a new mintable token._name Token name _symbol Token symbol _decimals Token decimals / | function initializeMintableTokenFundraiser(string _name, string _symbol, uint8 _decimals) internal {
token = new StandardMintableToken(
address(this), // The fundraiser is the token minter
_name,
_symbol,
_decimals
);
}
| function initializeMintableTokenFundraiser(string _name, string _symbol, uint8 _decimals) internal {
token = new StandardMintableToken(
address(this), // The fundraiser is the token minter
_name,
_symbol,
_decimals
);
}
| 48,188 |
125 | // add liquidity | require(address(this).balance > 0, "Must have ETH on contract to launch");
liquidityAddress = payable(msg.sender); // send initial liquidity to owner to ensure project is functioning before burning / locking LP.
addLiquidity(balanceOf(address(this)), address(this).balance);
| require(address(this).balance > 0, "Must have ETH on contract to launch");
liquidityAddress = payable(msg.sender); // send initial liquidity to owner to ensure project is functioning before burning / locking LP.
addLiquidity(balanceOf(address(this)), address(this).balance);
| 20,031 |
2 | // abi decode may revert, but the encoding is done by L1 gateway, so we trust it | (gatewayData, callHookData) = abi.decode(_data, (bytes, bytes));
| (gatewayData, callHookData) = abi.decode(_data, (bytes, bytes));
| 35,891 |
969 | // no other changes to this contract | continue;
| continue;
| 28,979 |
44 | // ================================================================================== Data Model | function _incrementPoolBalances(uint _baseAmt, uint _tokenAmt) external onlyRouter {
baseAmt += _baseAmt;
tokenAmt += _tokenAmt;
baseAmtStaked += _baseAmt;
tokenAmtStaked += _tokenAmt;
}
| function _incrementPoolBalances(uint _baseAmt, uint _tokenAmt) external onlyRouter {
baseAmt += _baseAmt;
tokenAmt += _tokenAmt;
baseAmtStaked += _baseAmt;
tokenAmtStaked += _tokenAmt;
}
| 24,140 |
150 | // Function body | _;
| _;
| 3,541 |
9 | // Sender enters mToken market and borrows NFT assets from the protocol to their own address.borrowUnderlyingID The ID of the underlying NFT asset to borrow return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ | function borrow(uint256 borrowUnderlyingID) external returns (uint) {
borrowUnderlyingID;
/* No NFT borrowing for now */
return fail(Error.MTROLLER_REJECTION, FailureInfo.BORROW_MTROLLER_REJECTION);
}
| function borrow(uint256 borrowUnderlyingID) external returns (uint) {
borrowUnderlyingID;
/* No NFT borrowing for now */
return fail(Error.MTROLLER_REJECTION, FailureInfo.BORROW_MTROLLER_REJECTION);
}
| 41,473 |
90 | // Locks token amount into the CDP | VatLike(ManagerLike(manager).vat()).frob(
ManagerLike(manager).ilks(cdp),
ManagerLike(manager).urns(cdp),
address(this),
address(this),
toInt(convertTo18(gemJoin, wad)),
0
);
| VatLike(ManagerLike(manager).vat()).frob(
ManagerLike(manager).ilks(cdp),
ManagerLike(manager).urns(cdp),
address(this),
address(this),
toInt(convertTo18(gemJoin, wad)),
0
);
| 6,936 |
364 | // Refunds any ETH balance held by this contract to the `msg.sender`/Useful for bundling with mint or increase liquidity that uses ether, or exact output swaps/ that use ether for the input amount | function refundETH() internal {
if (address(this).balance > 0) TransferHelper.safeTransferETH(msg.sender, address(this).balance);
}
| function refundETH() internal {
if (address(this).balance > 0) TransferHelper.safeTransferETH(msg.sender, address(this).balance);
}
| 5,366 |
12 | // Open to every userAllows every address to certify documents in the contract/ | function openToEveryUser() public onlyContractOwner {
(bool success, bytes memory data) = delegateCallAddress.delegatecall(abi.encodeWithSignature("openToEveryUser()"));
if (success) {
emit DelegateCallEvent("openToEveryUser", success);
} else {
revert();
... | function openToEveryUser() public onlyContractOwner {
(bool success, bytes memory data) = delegateCallAddress.delegatecall(abi.encodeWithSignature("openToEveryUser()"));
if (success) {
emit DelegateCallEvent("openToEveryUser", success);
} else {
revert();
... | 38,095 |
42 | // Crowdsale. | tmp[0] = address(this);
| tmp[0] = address(this);
| 5,977 |
27 | // If stake is lower, user is in this level, and we need to LERP with prev level to get discount value | if (i > 0) {
amountPrevLevel = stakeLevels[i - 1].amount;
discountPrevLevel = stakeLevels[i - 1].discount;
} else {
| if (i > 0) {
amountPrevLevel = stakeLevels[i - 1].amount;
discountPrevLevel = stakeLevels[i - 1].discount;
} else {
| 27,995 |
9 | // GDPOraclizedToken This is an interface for the GDP Oracle to control the mining rate.For security reasons, two distinct functions were created: setPositiveGrowth() and setNegativeGrowth() / | contract GDPOraclizedToken is MineableToken {
event GDPOracleTransferred(address indexed previousOracle, address indexed newOracle);
event BlockRewardChanged(int oldBlockReward, int newBlockReward);
address GDPOracle_;
address pendingGDPOracle_;
/**
* @dev Modifier Throws if called by any account other ... | contract GDPOraclizedToken is MineableToken {
event GDPOracleTransferred(address indexed previousOracle, address indexed newOracle);
event BlockRewardChanged(int oldBlockReward, int newBlockReward);
address GDPOracle_;
address pendingGDPOracle_;
/**
* @dev Modifier Throws if called by any account other ... | 38,901 |
23 | // Adds a new rebalancer. Only governance can add new rebalancers. / | function addRebalancer(address _rebalancer) external onlyGovernance {
require(_rebalancer != address(0x0), "rebalancer not set");
require(!rebalancers[_rebalancer], "rebalancer exist");
rebalancers[_rebalancer] = true;
emit RebalancerUpdated(_rebalancer, true);
}
| function addRebalancer(address _rebalancer) external onlyGovernance {
require(_rebalancer != address(0x0), "rebalancer not set");
require(!rebalancers[_rebalancer], "rebalancer exist");
rebalancers[_rebalancer] = true;
emit RebalancerUpdated(_rebalancer, true);
}
| 71,201 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.