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
17
// transfer the token from address of this contract to address of the user (executing the withdrawToken() function)
tokenContract.transfer(to, _amount);
tokenContract.transfer(to, _amount);
8,951
288
// ============ OWNER-ONLY ADMIN FUNCTIONS ============
function ownerMint(address _receiver, uint256 _numberOfDrivers) external onlyOwner
function ownerMint(address _receiver, uint256 _numberOfDrivers) external onlyOwner
36,670
142
// Take a KLIMA-BCT LP mint, with depositor being msg.sender,/
function takeKLIMABCTMint() external nonReentrant { unstakeKLIMA(); createKLIMABCTLP(); uint256 balanceLP = IERC20(KLIMABCTLPtokens).balanceOf(address(this)); require(balanceLP > 0, "KLIMAZap : No KLIMA-BCT LP tokens balance"); uint maxprice = IKLIMABondDepository(KLIMABCTB...
function takeKLIMABCTMint() external nonReentrant { unstakeKLIMA(); createKLIMABCTLP(); uint256 balanceLP = IERC20(KLIMABCTLPtokens).balanceOf(address(this)); require(balanceLP > 0, "KLIMAZap : No KLIMA-BCT LP tokens balance"); uint maxprice = IKLIMABondDepository(KLIMABCTB...
17,032
3
// Struct storing variables used in calculation in removeLiquidityImbalance function to avoid stack too deep error
struct ManageLiquidityInfo { uint256 d0; uint256 d1; uint256 d2; LPToken lpToken; uint256 totalSupply; uint256 preciseA; uint256 baseVirtualPrice; uint256[] scaleMultipliers; uint256[] newBalances; }
struct ManageLiquidityInfo { uint256 d0; uint256 d1; uint256 d2; LPToken lpToken; uint256 totalSupply; uint256 preciseA; uint256 baseVirtualPrice; uint256[] scaleMultipliers; uint256[] newBalances; }
56,596
6
// Convert the given slot identifier to strike price./ident The slot identifier, can be with or without the offset.
function getStrike(uint ident) public pure returns (uint) { uint slot = ident & ((1 << 16) - 1); // only consider the last 16 bits uint prefix = slot % 900; // maximum value is 899 uint magnitude = slot / 900; // maximum value is 72 if (magnitude == 0) { require(prefix >= 800, 'bad prefix'); ...
function getStrike(uint ident) public pure returns (uint) { uint slot = ident & ((1 << 16) - 1); // only consider the last 16 bits uint prefix = slot % 900; // maximum value is 899 uint magnitude = slot / 900; // maximum value is 72 if (magnitude == 0) { require(prefix >= 800, 'bad prefix'); ...
14,264
20
// Global constructor – these variables will not change with further proxy deploys/Marked as an initializer to prevent storage being used of base implementation. Can only be init'd by a proxy./_zoraERC721TransferHelper Transfer helper/_factoryUpgradeGate Factory upgrade gate address/_marketFilterDAOAddress Market filte...
constructor( address _zoraERC721TransferHelper, IFactoryUpgradeGate _factoryUpgradeGate, address _marketFilterDAOAddress, uint256 _mintFeeAmount, address payable _mintFeeRecipient
constructor( address _zoraERC721TransferHelper, IFactoryUpgradeGate _factoryUpgradeGate, address _marketFilterDAOAddress, uint256 _mintFeeAmount, address payable _mintFeeRecipient
10,180
2
// compute total voting power
Gov.setEquityTokenTotalVotingPower(_t, token, shareCapital); transitionTo(state);
Gov.setEquityTokenTotalVotingPower(_t, token, shareCapital); transitionTo(state);
25,603
2
// Address of the RariFundManager. /
address private _rariFundManagerContract;
address private _rariFundManagerContract;
6,411
7
// Minting
function mint( address to, uint256 tokenId, string memory uri
function mint( address to, uint256 tokenId, string memory uri
27,179
3
// Transfer `amount` tokens from `msg.sender` to `dst`dst The address of the destination accountamount The number of tokens to transfer return success Whether or not the transfer succeeded/
function transfer(address dst, uint256 amount) external returns (bool success);
function transfer(address dst, uint256 amount) external returns (bool success);
24,023
1
// failedWithdrawalIndexByWithdrawalIndex Chiado network deployed for the shapella the contract at commit https:github.com/gnosischain/deposit-contract/commit/13e155500b626612844e3d0fccc11b02b11ea785 This contract version was latter replaced with the contract at commit https:github.com/gnosischain/deposit-contract/pull...
mapping(uint64 => uint256) public _deprecated_map_up_to_nextWithdrawalIndex; uint256 public _deprecated_slot_69; uint64 public _deprecated_slot_70_nextWithdrawalIndex; uint256 private _deprecated_slot_71;
mapping(uint64 => uint256) public _deprecated_map_up_to_nextWithdrawalIndex; uint256 public _deprecated_slot_69; uint64 public _deprecated_slot_70_nextWithdrawalIndex; uint256 private _deprecated_slot_71;
12,806
90
// if(n == 0 || n==1) { n = 0; } else if(n == 2 || n==3) { n = 1; }
postition = updatexGoldReferrer_FirstLevel(userAddress, users[referrerAddress].xGoldMatrix[level].secondLevelReferrals[n], level); postition = updatexGoldReferrer_SecondLevel(userAddress, users[referrerAddress].xGoldMatrix[level].secondLevelReferrals[n], level, postition); ...
postition = updatexGoldReferrer_FirstLevel(userAddress, users[referrerAddress].xGoldMatrix[level].secondLevelReferrals[n], level); postition = updatexGoldReferrer_SecondLevel(userAddress, users[referrerAddress].xGoldMatrix[level].secondLevelReferrals[n], level, postition); ...
5,517
71
// We ensure the minimum borrow rate >= DSR / (1 - reserve factor)
baseRatePerBlock = dsrPerBlock().mul(1e18).div(assumedOneMinusReserveFactorMantissa);
baseRatePerBlock = dsrPerBlock().mul(1e18).div(assumedOneMinusReserveFactorMantissa);
34,817
3
// For tracking the mercenaries visual traits
mapping (uint256 => bytes16[]) public visualTraits;
mapping (uint256 => bytes16[]) public visualTraits;
20,081
37
// Calculate the total platform token balance (i.e. 3CRV) that exist inthis contract or is staked in the Gauge (or in other words, the totalamount platform tokens we own).return totalPTokens Total amount of platform tokens in native decimals /
function _getTotalPTokens() internal view returns ( uint256 contractPTokens, uint256 gaugePTokens, uint256 totalPTokens )
function _getTotalPTokens() internal view returns ( uint256 contractPTokens, uint256 gaugePTokens, uint256 totalPTokens )
34,201
148
// LeekToken with Governance.
contract LeekToken is ERC20("LeekToken", "LEEK"), Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; // @notice Copied and modified from YAM code: // https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernanceStorage.sol // https://github.com/yam-finance/yam...
contract LeekToken is ERC20("LeekToken", "LEEK"), Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; // @notice Copied and modified from YAM code: // https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernanceStorage.sol // https://github.com/yam-finance/yam...
62,358
1
// Emitted when relays are added by a relayManager
event RelayWorkersAdded( address indexed relayManager, address[] newRelayWorkers, uint256 workersCount );
event RelayWorkersAdded( address indexed relayManager, address[] newRelayWorkers, uint256 workersCount );
40,928
451
// set warmup period for new stakers _warmupPeriod uint /
function setWarmup(uint256 _warmupPeriod) external onlyOwner { warmupPeriod = _warmupPeriod; }
function setWarmup(uint256 _warmupPeriod) external onlyOwner { warmupPeriod = _warmupPeriod; }
31,654
18
// Checks if the specified Tier exists tier_ The Tier that is being checked /
function tierExists(uint256 tier_) external view returns (bool);
function tierExists(uint256 tier_) external view returns (bool);
40,963
41
// Crowdsale expired
if (now > end) { throw; }
if (now > end) { throw; }
26,894
21
// Mint a new token. recipient recipient address. tokenURI token URI of a new token. /
function _mint( address recipient, string memory tokenURI ) internal virtual
function _mint( address recipient, string memory tokenURI ) internal virtual
30,144
13
// determine if addr has role _operator address _role the name of the rolereturn bool /
function hasRole(address _operator, string _role) public view returns (bool)
function hasRole(address _operator, string _role) public view returns (bool)
18,713
108
// Array holding all stakes
Stake[] public stakes;
Stake[] public stakes;
18,009
198
// MasterChef is the master of Sashimi. He can make Sashimi and he is a fair guy. Note that it's ownable and the owner wields tremendous power. The ownership will be transferred to a governance smart contract once SASHIMI is sufficiently distributed and the community can show to govern itself. Have fun reading it. Hope...
contract MasterChef is Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; // Info of each user. struct UserInfo { uint256 amount; // How many LP tokens the user has provided. uint256 rewardDebt; // Reward debt. See explanation below. // // We do some f...
contract MasterChef is Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; // Info of each user. struct UserInfo { uint256 amount; // How many LP tokens the user has provided. uint256 rewardDebt; // Reward debt. See explanation below. // // We do some f...
17,372
16
// Allows contract `owner` to set `mintCost`. /
function ownerSetMintCost(uint256 _mintCost) external payable ownerHasPermission(Permissions.setMintCost) onlyOwner
function ownerSetMintCost(uint256 _mintCost) external payable ownerHasPermission(Permissions.setMintCost) onlyOwner
25,923
38
// EAS - Ethereum Attestation Service /
contract EAS is IEAS { error AccessDenied(); error AlreadyRevoked(); error InvalidAttestation(); error InvalidExpirationTime(); error InvalidOffset(); error InvalidRegistry(); error InvalidSchema(); error InvalidVerifier(); error NotFound(); error NotPayable(); string public...
contract EAS is IEAS { error AccessDenied(); error AlreadyRevoked(); error InvalidAttestation(); error InvalidExpirationTime(); error InvalidOffset(); error InvalidRegistry(); error InvalidSchema(); error InvalidVerifier(); error NotFound(); error NotPayable(); string public...
30,711
16
// Register an investor's redemption request, after checking that 1) the requested amount exceeds the minimum redemption amount and 2) the investor can't redeem more than the shares they own
function requestRedemption(address _addr, uint _shares) onlyFund constant returns (uint, uint)
function requestRedemption(address _addr, uint _shares) onlyFund constant returns (uint, uint)
48,470
88
// -- if the proposal passed send the creator back their Proposal Deposit,if the proposal was not successful, then thats the price you pay for submitting stupid things to the board.
if(proposals[_proposalID].proposalPassed == true){
if(proposals[_proposalID].proposalPassed == true){
14,809
31
// Initializes the debt token. name The name of the token symbol The symbol of the token decimals The decimals of the token /
function initialize( uint8 decimals, string memory name, string memory symbol
function initialize( uint8 decimals, string memory name, string memory symbol
16,065
26
// Function to check the amount of tokens than an owner allowed to a spender._owner address The address which owns the funds._spender address The address which will spend the funds. return A uint specifying the amount of tokens still available for the spender./
function allowance(address _owner, address _spender) public view returns (uint remaining) { return allowed[_owner][_spender]; }
function allowance(address _owner, address _spender) public view returns (uint remaining) { return allowed[_owner][_spender]; }
29,884
149
// Returns the downcasted uint112 from uint256, reverting onoverflow (when the input is greater than largest uint112). Counterpart to Solidity's `uint112` operator. Requirements: - input must fit into 112 bits _Available since v4.7._ /
function toUint112(uint256 value) internal pure returns (uint112) { require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits"); return uint112(value); }
function toUint112(uint256 value) internal pure returns (uint112) { require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits"); return uint112(value); }
929
14
// From: sha3_c.c State variables in 'storage' Moved from local vars in KeccakF1600_StatePermute() to here in order to avoid stack overflow
uint64 private Aba; uint64 private Abe; uint64 private Abi; uint64 private Abo; uint64 private Abu; // [60*8=480 bytes] uint64 private Aga; uint64 private Age; uint64 private Agi; uint64 private Ago; uint64 private Agu; uint64 private Aka; uint64 private Ake; uint64 private Aki; uint64 private Ako; uint64...
uint64 private Aba; uint64 private Abe; uint64 private Abi; uint64 private Abo; uint64 private Abu; // [60*8=480 bytes] uint64 private Aga; uint64 private Age; uint64 private Agi; uint64 private Ago; uint64 private Agu; uint64 private Aka; uint64 private Ake; uint64 private Aki; uint64 private Ako; uint64...
47,293
349
// Internal-only function that removes an existing admin.
function _removeAdmin(address _account) private { require(_isAdmin[_account], "provided account is not an admin"); _isAdmin[_account] = false; _adminCount--; emit RemovedAdmin(msg.sender, _account); }
function _removeAdmin(address _account) private { require(_isAdmin[_account], "provided account is not an admin"); _isAdmin[_account] = false; _adminCount--; emit RemovedAdmin(msg.sender, _account); }
43,765
127
// When executing a liqudation, the price of the asset has to be calculated at a discount in order for it to be profitable for the liquidator. This function will get the current oracle price for the asset and find the discounted price./
function calculateLiquidationPrice() public view returns (Decimal.D256 memory)
function calculateLiquidationPrice() public view returns (Decimal.D256 memory)
38,557
22
// Majority denied
if (_countDenied >= (tempTotalAuditors/2)) { return "Denied"; }
if (_countDenied >= (tempTotalAuditors/2)) { return "Denied"; }
41,259
3
// Called by bZx after interest should be paid to a lender/Assume the interest token has already been transfered to/this contract before this function is called./loanOrder The loanOrder object/lender The lender/amountOwed The amount interest to pay/convert A boolean indicating if the interest should be converted to Eth...
function didPayInterest( BZxObjects.LoanOrder memory loanOrder, address lender, uint amountOwed, bool convert, uint gasUsed) public returns (bool);
function didPayInterest( BZxObjects.LoanOrder memory loanOrder, address lender, uint amountOwed, bool convert, uint gasUsed) public returns (bool);
27,402
63
// return true if crowdsale event has ended or cap reached
function hasEnded() public constant returns (bool) { bool capReached = weiRaised >= cap; bool passedEndTime = now > endTime; return passedEndTime || capReached; }
function hasEnded() public constant returns (bool) { bool capReached = weiRaised >= cap; bool passedEndTime = now > endTime; return passedEndTime || capReached; }
43,575
235
// See {IERC20Permit-permit}. /
function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual override { require(block.timestamp <= deadline, "ERC20Permit: expired deadline");
function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual override { require(block.timestamp <= deadline, "ERC20Permit: expired deadline");
50,196
32
// Sets the rewards that farmers have earned.Can only be called by the current [governor](/docs/protocol/governance). farmers Array of farmers to set. rewards Array of rewards to set. /
function setFarmedRewards(address[] calldata farmers, uint256[] calldata rewards) external override onlyGovernance { require(farmers.length == rewards.length, "length mismatch"); for(uint256 i = 0; i < farmers.length; i++) { farmedRewards[farmers[i]] = rewards[i]; } }
function setFarmedRewards(address[] calldata farmers, uint256[] calldata rewards) external override onlyGovernance { require(farmers.length == rewards.length, "length mismatch"); for(uint256 i = 0; i < farmers.length; i++) { farmedRewards[farmers[i]] = rewards[i]; } }
37,247
6
// CRITICAL CONTRACT PARAMETERSPausable library is simple enough to integrate into this contract
bool public paused = false; uint8 _layer; address _signer; address _arbPartner; IArbPartner _arbPartnerInterface; IInbox _inbox; //Inbox for L1 IOutbox _outbox; //Outbox for L2 HungryBunz _hbContract; //Layer-local main contract INom _nom; //Layer-local Nom contract
bool public paused = false; uint8 _layer; address _signer; address _arbPartner; IArbPartner _arbPartnerInterface; IInbox _inbox; //Inbox for L1 IOutbox _outbox; //Outbox for L2 HungryBunz _hbContract; //Layer-local main contract INom _nom; //Layer-local Nom contract
39,919
361
// update user record
user.tokenAmount += addedAmount; user.totalWeight += stakeWeight; user.subYieldRewards = weightToReward(user.totalWeight, yieldRewardsPerWeight);
user.tokenAmount += addedAmount; user.totalWeight += stakeWeight; user.subYieldRewards = weightToReward(user.totalWeight, yieldRewardsPerWeight);
50,732
18
// updates the swap path for a given pair can only be called by YieldWolf contract which already performs the required validations and logging /
function setSwapPath( address _token0, address _token1, address[] calldata _path
function setSwapPath( address _token0, address _token1, address[] calldata _path
22,975
36
// Require that a typed memory view be valid. Returns the view for easy chaining. memView The viewreturnbytes29 - The validated view /
function assertValid(bytes29 memView) internal pure returns (bytes29) { require(isValid(memView), "Validity assertion failed"); return memView; }
function assertValid(bytes29 memView) internal pure returns (bytes29) { require(isValid(memView), "Validity assertion failed"); return memView; }
16,857
35
// отсылаем эфир за купленное молоко
uint a=milkcost*milk_to_sale; msg.sender.transfer(milkcost*milk_to_sale);
uint a=milkcost*milk_to_sale; msg.sender.transfer(milkcost*milk_to_sale);
58,404
69
// Swaps to a flexible amount, from an exact input amount/ @inheritdoc ISwapper
function swap( IERC20 fromToken, IERC20 toToken, address recipient, uint256 shareToMin, uint256 shareFrom
function swap( IERC20 fromToken, IERC20 toToken, address recipient, uint256 shareToMin, uint256 shareFrom
37,060
8
// Approve and then communicate the approved contract in a single tx /
returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } }
returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } }
8,034
11
// Returns the address of the resolver for the specified node. node The specified node.return address of the resolver. /
function resolver(bytes32 node) public virtual override view returns (address) { return records[node].resolver; }
function resolver(bytes32 node) public virtual override view returns (address) { return records[node].resolver; }
11,421
8
// Saving assets original amount/ This amount is in the same unit used in allocation strategy
uint256 public savingAssetOrignalAmount;
uint256 public savingAssetOrignalAmount;
30,521
9
// MATH /
using SafeMath for uint256;
using SafeMath for uint256;
12,267
95
// Get how much SF will be distributed after taxing a specific collateral type collateralType Collateral type to compute the taxation outcome forreturn The newly accumulated rate as well as the delta between the new and the last accumulated rates /
function taxSingleOutcome(bytes32 collateralType) public view returns (uint256, int256) { (, uint256 lastAccumulatedRate) = safeEngine.collateralTypes(collateralType); uint256 newlyAccumulatedRate = rmultiply( rpow( addition( globalStabilityFee, ...
function taxSingleOutcome(bytes32 collateralType) public view returns (uint256, int256) { (, uint256 lastAccumulatedRate) = safeEngine.collateralTypes(collateralType); uint256 newlyAccumulatedRate = rmultiply( rpow( addition( globalStabilityFee, ...
33,467
17
// ========== PUBLIC FUNCTIONS ========== / There needs to be a time interval that this can be called. Otherwise it can be called multiple times per expansion.
uint256 public last_call_time; // Last time the refreshCollateralRatio function was called
uint256 public last_call_time; // Last time the refreshCollateralRatio function was called
32,046
36
// Otherwise, the contribution helped us reach the funding cap. We should take what we can until the funding cap is reached, and refund the rest.
uint256 eligibleAmount = fundingCap - startAmount;
uint256 eligibleAmount = fundingCap - startAmount;
39,429
161
// received amount
uint256 amountReceived = address(this).balance;
uint256 amountReceived = address(this).balance;
23,117
3
// ERC20-tokens: cUSD and cEUR
IERC20 private immutable cUSD; IERC20 private immutable cEUR;
IERC20 private immutable cUSD; IERC20 private immutable cEUR;
24,463
3
// synth type
uint8 public synthType;
uint8 public synthType;
5,464
4,742
// 2372
entry "civicminded" : ENG_ADJECTIVE
entry "civicminded" : ENG_ADJECTIVE
18,984
89
// Log Users withdraw
event Withdraw(address indexed userAddrs, address indexed asset, uint256 amount);
event Withdraw(address indexed userAddrs, address indexed asset, uint256 amount);
79,006
8
// Renamed dividends to rewards. (OLD) Many functions in this contract were taken from this repository:which is an example implementation of ERC 2222, the draft for which can be found at This contract has been substantially modified from the original and does not comply with ERC 2222.Many functions were renamed as "rew...
abstract contract AbstractRewards is IAbstractRewards { using SafeCast for uint128; using SafeCast for uint256; using SafeCast for int256; /* ======== Constants ======== */ uint128 public constant POINTS_MULTIPLIER = type(uint128).max; /* ======== Internal Function References ======== */ function(addres...
abstract contract AbstractRewards is IAbstractRewards { using SafeCast for uint128; using SafeCast for uint256; using SafeCast for int256; /* ======== Constants ======== */ uint128 public constant POINTS_MULTIPLIER = type(uint128).max; /* ======== Internal Function References ======== */ function(addres...
16,461
887
// msg.sender sends Ether to repay an account's borrow in a cEther market The provided Ether is applied towards the borrow balance, any excess is refunded borrower The address of the borrower account to repay on behalf of cEther_ The address of the cEther contract to repay in /
function repayBehalfExplicit(address borrower, CEther cEther_) public payable { uint received = msg.value; uint borrows = cEther_.borrowBalanceCurrent(borrower); if (received > borrows) { cEther_.repayBorrowBehalf.value(borrows)(borrower); msg.sender.transfer(received...
function repayBehalfExplicit(address borrower, CEther cEther_) public payable { uint received = msg.value; uint borrows = cEther_.borrowBalanceCurrent(borrower); if (received > borrows) { cEther_.repayBorrowBehalf.value(borrows)(borrower); msg.sender.transfer(received...
37,562
12
// Phase 4
function flipGenesisState() public onlyOwner { genesisSale = !genesisSale; }
function flipGenesisState() public onlyOwner { genesisSale = !genesisSale; }
41,234
60
// Collect fees if they are set, reducing the number of tokens for the sender thus leaving more YBT in the TempusPool than there are minted TPS/TYS
uint256 tokenAmount = yieldTokenAmount; uint256 depositFees = feesConfig.depositPercent; if (depositFees != 0) { fee = tokenAmount.mulfV(depositFees, yieldBearingONE); tokenAmount -= fee; totalFees += fee; }
uint256 tokenAmount = yieldTokenAmount; uint256 depositFees = feesConfig.depositPercent; if (depositFees != 0) { fee = tokenAmount.mulfV(depositFees, yieldBearingONE); tokenAmount -= fee; totalFees += fee; }
60,985
124
// Verify that the tokenId is owned by given baseCFolio.
require( IERC1155(address(tradeFloor)).balanceOf( baseCFolio, cfolioItemTokenId ) == 1, 'CFHI: Access denied (CF)' );
require( IERC1155(address(tradeFloor)).balanceOf( baseCFolio, cfolioItemTokenId ) == 1, 'CFHI: Access denied (CF)' );
29,632
262
// token should be for sale
require(doorNFT.forSale);
require(doorNFT.forSale);
40,070
78
// Function to release tokens of a vesting id _vestingIdvesting Id /
function release(uint256 _vestingId) public { Vesting storage vesting = vestings[_vestingId]; require(beneficiaryAddress != address(0x0), INVALID_VESTING_ID); require(!vesting.released , VESTING_ALREADY_RELEASED); // solhint-disable-next-line not-rely-on-time require(block.ti...
function release(uint256 _vestingId) public { Vesting storage vesting = vestings[_vestingId]; require(beneficiaryAddress != address(0x0), INVALID_VESTING_ID); require(!vesting.released , VESTING_ALREADY_RELEASED); // solhint-disable-next-line not-rely-on-time require(block.ti...
53,119
176
// Sets the royalty information for a specific token id, overriding the global default. Requirements: - `tokenId` must be already minted.- `receiver` cannot be the zero address.- `feeNumerator` cannot be greater than the fee denominator. /
function _setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator
function _setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator
6,922
1,061
// increase rate by 3% too account for inaccuracy between sell/buy conversion
rate = rate + (rate / 30);
rate = rate + (rate / 30);
58,009
24
// Verifica frequencia
require (now > (lastTransfer + transferWait), "Speed bump activated, frequency exceeded"); lastTransfer = now;
require (now > (lastTransfer + transferWait), "Speed bump activated, frequency exceeded"); lastTransfer = now;
4,635
228
// Add a new vesting entry at a given time and quantity to an account's schedule. A call to this should be accompanied by either enough balance already availablein this contract, or a corresponding call to havven.endow(), to ensure that whenthe funds are withdrawn, there is enough balance, as well as correctly calculat...
function appendVestingEntry(address account, uint time, uint quantity) public onlyOwner onlyDuringSetup
function appendVestingEntry(address account, uint time, uint quantity) public onlyOwner onlyDuringSetup
73,665
84
// ERC 20 Standard decrease Allowance
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool)
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool)
3,673
62
// A dual control contract. A general-purpose contract that implements dual control over co-operating contracts through a callback mechanism. This contract implements dual control through a 2-of-N threshold multi-signature scheme. The contract recognizes a set of N signers, and will unlock requests with signatures from...
contract Custodian { // TYPES /** @dev The `Request` struct stores a pending unlocking. * `callbackAddress` and `callbackSelector` are the data required to * make a callback. The custodian completes the process by * calling `callbackAddress.call(callbackSelector, lockId)`, which * sign...
contract Custodian { // TYPES /** @dev The `Request` struct stores a pending unlocking. * `callbackAddress` and `callbackSelector` are the data required to * make a callback. The custodian completes the process by * calling `callbackAddress.call(callbackSelector, lockId)`, which * sign...
10,979
16
// Alex Stanoev/update product quantity by ID/check if index is valid and replace the old quantity with the newQuantity/ID of a product/newQuantity of a product
function update(bytes32 ID, uint newQuantity) public onlyValidProduct(ID) onlyOwner { // check if newQuantity param is different then current product quantity require(newQuantity != products[ID].quantity); // set product quantity to be equal to newQuantity param pro...
function update(bytes32 ID, uint newQuantity) public onlyValidProduct(ID) onlyOwner { // check if newQuantity param is different then current product quantity require(newQuantity != products[ID].quantity); // set product quantity to be equal to newQuantity param pro...
38,938
395
// The number of blocks that credit will be distributed over to depositors.
uint256 creditUnlockBlocks;
uint256 creditUnlockBlocks;
30,361
191
// Remember the initial block number // Read the previous values out of storage // Calculate the current borrow interest rate // Calculate the number of blocks elapsed since the last accrual //Calculate the interest accumulated into borrows and reserves and the new index: simpleInterestFactor = borrowRateblockDelta int...
Exp memory simpleInterestFactor; uint interestAccumulated; uint totalBorrowsNew; uint totalReservesNew; uint borrowIndexNew; uint[] memory res = new uint[](6);
Exp memory simpleInterestFactor; uint interestAccumulated; uint totalBorrowsNew; uint totalReservesNew; uint borrowIndexNew; uint[] memory res = new uint[](6);
46,055
286
// The multiplication in the next line is necessary because when slicing multiples of 32 bytes (lengthmod == 0) the following copy loop was copying the origin's length and then ending prematurely not copying everything it should.
let mc := add( add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)) ) let end := add(mc, _length) for {
let mc := add( add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)) ) let end := add(mc, _length) for {
21,307
4
// Change reward address of the node operator `_id` to `_rewardAddress`/
function setNodeOperatorRewardAddress(uint256 _id, address _rewardAddress) external;
function setNodeOperatorRewardAddress(uint256 _id, address _rewardAddress) external;
27,715
434
// expmods_and_points.points[39] = -(g^76z).
mstore(add(expmodsAndPoints, 0x8a0), point)
mstore(add(expmodsAndPoints, 0x8a0), point)
77,639
2
// curve
address private constant SWAPS = 0xD1602F68CC7C4c7B59D686243EA35a9C73B0c6a2;
address private constant SWAPS = 0xD1602F68CC7C4c7B59D686243EA35a9C73B0c6a2;
46,070
355
// Update balance of the winner
balances[winningAddress] = balances[winningAddress].add(netWinnings);
balances[winningAddress] = balances[winningAddress].add(netWinnings);
55,270
43
// Reverts if beneficiary is not whitelisted. Can be used when extending this contract. _beneficiary the address which must be whitelisted by the KYC process in order to pass. /
modifier isWhitelisted(address _beneficiary) { require(whitelist[_beneficiary]); _; }
modifier isWhitelisted(address _beneficiary) { require(whitelist[_beneficiary]); _; }
7,734
315
// Setter for owner to stop the registries creation or not/locked the new state
function setLocked(bool locked) external onlyOwner { _locked = locked; }
function setLocked(bool locked) external onlyOwner { _locked = locked; }
44,365
2
// mapping that reference each Hashtro by their token id
mapping(uint256 => Hashtro) private _tokenDetails; // 0 -> however many get created mapping(uint256 => string) public tokenURI; string public name; string public symbol; uint256 public tokensInCirculation;
mapping(uint256 => Hashtro) private _tokenDetails; // 0 -> however many get created mapping(uint256 => string) public tokenURI; string public name; string public symbol; uint256 public tokensInCirculation;
57,971
131
// Get the current voting power for `_tokenId`/Adheres to the ERC20 `balanceOf` interface for Aragon compatibility/_tokenId NFT for lock/_t Epoch time to return voting power at/ return User voting power
function _balanceOfNFT(uint _tokenId, uint _t) internal view returns (uint) { uint _epoch = user_point_epoch[_tokenId]; if (_epoch == 0) { return 0; } else { Point memory last_point = user_point_history[_tokenId][_epoch]; last_point.bias -= last_point.slop...
function _balanceOfNFT(uint _tokenId, uint _t) internal view returns (uint) { uint _epoch = user_point_epoch[_tokenId]; if (_epoch == 0) { return 0; } else { Point memory last_point = user_point_history[_tokenId][_epoch]; last_point.bias -= last_point.slop...
25,779
1
// Define the ethFee variable
uint256 public ethFee = 0.08 ether;
uint256 public ethFee = 0.08 ether;
6,431
132
// Calculate the current borrow interest rate // Remember the initial block number // Calculate the number of blocks elapsed since the last accrual //Calculate the interest accumulated into borrows and reserves and the new index: simpleInterestFactor = borrowRateblockDelta interestAccumulated = simpleInterestFactortota...
(vars.mathErr, vars.simpleInterestFactor) = mulScalar(Exp({mantissa: vars.borrowRateMantissa}), vars.blockDelta);
(vars.mathErr, vars.simpleInterestFactor) = mulScalar(Exp({mantissa: vars.borrowRateMantissa}), vars.blockDelta);
6,006
8
// Return the current Dutch auction price and the current price step. /
function _currentAuctionPrice() internal view returns (uint256 price) { DutchAuctionInfo memory data = _dutchAuction; // copy auction settings from storage to memory uint256 elapsedTime = block.timestamp < data.startTime ? 0 : block.timestamp - data.startTime; // compute the elapsed time uin...
function _currentAuctionPrice() internal view returns (uint256 price) { DutchAuctionInfo memory data = _dutchAuction; // copy auction settings from storage to memory uint256 elapsedTime = block.timestamp < data.startTime ? 0 : block.timestamp - data.startTime; // compute the elapsed time uin...
14,883
134
// USDT代币地址
address constant USDT_TOKEN_ADDRESS = 0xdAC17F958D2ee523a2206206994597C13D831ec7;
address constant USDT_TOKEN_ADDRESS = 0xdAC17F958D2ee523a2206206994597C13D831ec7;
26,633
10
// Set the provided address as the initial owner of the smart contract
_transferOwnership(ownerOfTheSmartContract); usdtToken = IERC20(_usdtTokenAddress);
_transferOwnership(ownerOfTheSmartContract); usdtToken = IERC20(_usdtTokenAddress);
23,426
233
// Gets the total number of positions, defined as the following:- Each component has a default position if its virtual unit is > 0- Each component's external positions module is counted as a position /
function _getPositionCount() internal view returns (uint256) { uint256 positionCount; for (uint256 i = 0; i < components.length; i++) { address component = components[i]; // Increment the position count if the default position is > 0 if (_defaultPositionVirtualUn...
function _getPositionCount() internal view returns (uint256) { uint256 positionCount; for (uint256 i = 0; i < components.length; i++) { address component = components[i]; // Increment the position count if the default position is > 0 if (_defaultPositionVirtualUn...
15,051
64
// TESTING
function mockTime(uint256 itemID, uint256 _newTime) public isOwner { marketItems[itemID].timeWhenRentStarted = _newTime; }
function mockTime(uint256 itemID, uint256 _newTime) public isOwner { marketItems[itemID].timeWhenRentStarted = _newTime; }
19,483
68
// make sure the mint didnt push maxScalingFactor too low
require(reethScalingFactor <= _maxScalingFactor(), "max scaling factor too low");
require(reethScalingFactor <= _maxScalingFactor(), "max scaling factor too low");
58,239
58
// send preferred token
function _send(uint256 wAmount, TYPE _to) internal { if (_to == TYPE.WRAPPED) { gOHM.safeTransfer(msg.sender, wAmount); } else if (_to == TYPE.STAKED) { newStaking.unwrap(msg.sender, wAmount); } else if (_to == TYPE.UNSTAKED) { newStaking.unstake(msg.sende...
function _send(uint256 wAmount, TYPE _to) internal { if (_to == TYPE.WRAPPED) { gOHM.safeTransfer(msg.sender, wAmount); } else if (_to == TYPE.STAKED) { newStaking.unwrap(msg.sender, wAmount); } else if (_to == TYPE.UNSTAKED) { newStaking.unstake(msg.sende...
7,106
121
// Unit of post fee. 0.0001 ether
uint constant DIMI_ETHER = 0.0001 ether; // 1 ether / 10000;
uint constant DIMI_ETHER = 0.0001 ether; // 1 ether / 10000;
36,769
18
// extend a lock with a new unlock date, _index and _lockID ensure the correct lock is changedthis prevents errors when a user performs multiple tx per block possibly with varying gas prices /
function relock(address _token, uint256 _index, uint256 _lockID, uint256 _unlock_date) external nonReentrant { require(_unlock_date < 10000000000, "TIMESTAMP INVALID"); // prevents errors when timestamp entered in milliseconds uint256 lockID = users[msg.sender].locksForToken[_token][_index]; ...
function relock(address _token, uint256 _index, uint256 _lockID, uint256 _unlock_date) external nonReentrant { require(_unlock_date < 10000000000, "TIMESTAMP INVALID"); // prevents errors when timestamp entered in milliseconds uint256 lockID = users[msg.sender].locksForToken[_token][_index]; ...
39,695
86
// Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens. /
function totalSupply() public view returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than _currentIndex - _startTokenId() times unchecked { return _currentIndex - _burnCounter - _startTokenId(); } }
function totalSupply() public view returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than _currentIndex - _startTokenId() times unchecked { return _currentIndex - _burnCounter - _startTokenId(); } }
22,389
52
// Internal mint function. Checks max supply./_receiver The address to receive the RAD./_amount The amount of RAD to mint.
function _mint(address _receiver, uint256 _amount) internal override { require(totalSupply + _amount <= MAX_SUPPLY, "Radcoin: max supply exceeded"); super._mint(_receiver, _amount); }
function _mint(address _receiver, uint256 _amount) internal override { require(totalSupply + _amount <= MAX_SUPPLY, "Radcoin: max supply exceeded"); super._mint(_receiver, _amount); }
38,849
10
// Routes
address[] public outputToWrappedRoute; address[] public wrappedToLp0Route; address[] public wrappedToLp1Route; address[] customPath;
address[] public outputToWrappedRoute; address[] public wrappedToLp0Route; address[] public wrappedToLp1Route; address[] customPath;
7,672
143
// Returns the total quantity for a token ID_id uint256 ID of the token to query return amount of token in existence/
function totalSupply( uint256 _id
function totalSupply( uint256 _id
45,595
386
// --- Variables ---
uint256 internal storedIndex;
uint256 internal storedIndex;
30,951
5
// This contract can be deployed without modification, but it is intended as a templateto add more advanced bridge interaction to a custom ERC-721 contract /
contract ERC721Bridgable is IERC721Bridgable, BridgeMinters, ERC721AUpgradeable { using ECDSAUpgradeable for bytes32; using ECDSAUpgradeable for bytes; function __ERC721Bridgable_init( string memory _name, string memory _symbol, uint256 _maxBatch ) internal onlyInitializing { __ERC721A_init(_name, _symbol,...
contract ERC721Bridgable is IERC721Bridgable, BridgeMinters, ERC721AUpgradeable { using ECDSAUpgradeable for bytes32; using ECDSAUpgradeable for bytes; function __ERC721Bridgable_init( string memory _name, string memory _symbol, uint256 _maxBatch ) internal onlyInitializing { __ERC721A_init(_name, _symbol,...
17,886
10
// Check if given owner matches the component's owner. Check that given target matches component's contract address.
if (owner != _owner || contractAddress != _target) { return false; }
if (owner != _owner || contractAddress != _target) { return false; }
35,422