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
13
// This function deposits assets into CoachAIDAO with ETH or ERC20 tokens fromToken The token used for entry (address(0) if ether) amountIn The amount of fromToken to invest toToken The token fromToken is getting converted to. minToToken The minimum acceptable quantity sCADT or wsCADT or principal tokens to receive. Re...
function ZapIn( address fromToken, uint256 amountIn, address toToken, uint256 minToToken, address swapTarget, bytes calldata swapData, address affiliate, address bondPayoutToken, uint256 maxBondPrice
function ZapIn( address fromToken, uint256 amountIn, address toToken, uint256 minToToken, address swapTarget, bytes calldata swapData, address affiliate, address bondPayoutToken, uint256 maxBondPrice
17,175
3
// ══════ Global state ══════ // ══════ Market specific ══════ // ══════ Market + position (long/short) specific ══════ //synthetic token prices of a given market of a (long/short) at every previous price update
mapping(uint32 => mapping(bool => mapping(uint256 => uint256))) public override syntheticToken_priceSnapshot; mapping(uint32 => mapping(bool => uint256)) public override batched_amountPaymentToken_deposit; mapping(uint32 => mapping(bool => uint256)) public override batched_amountSyntheticToken_redeem; ...
mapping(uint32 => mapping(bool => mapping(uint256 => uint256))) public override syntheticToken_priceSnapshot; mapping(uint32 => mapping(bool => uint256)) public override batched_amountPaymentToken_deposit; mapping(uint32 => mapping(bool => uint256)) public override batched_amountSyntheticToken_redeem; ...
3,463
24
// Where Is My DragonIn this Contract yoy can find all the ruleHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAH!!!! /
contract WhereIsMyDragon is IWhereIsMyDragon, ERC165 { uint256 private constant RAG = 0x172 - 0x16f; address private _san; address private _frid; mapping(uint256 => mapping(uint256 => mapping(uint256 => mapping(uint256 => mapping(uint256 => mapping(uint256 => uint256)))))) private _bor; mapping(u...
contract WhereIsMyDragon is IWhereIsMyDragon, ERC165 { uint256 private constant RAG = 0x172 - 0x16f; address private _san; address private _frid; mapping(uint256 => mapping(uint256 => mapping(uint256 => mapping(uint256 => mapping(uint256 => mapping(uint256 => uint256)))))) private _bor; mapping(u...
10,372
177
// Check if the hard cap (in IVO) is reached This requirement is actually controlled when calculating the tokenAmount inside _dealWithBigTokenPurchase(). So comment the following ou at the moment require(_mintedByCrowdsale.add(tokenAmount) <= HARD_CAP, "Too many tokens that exceeds the cap"); After calculating the gene...
uint256 finalAmount = _mintedByCrowdsale.add(tokenAmount); uint256 totalMintedAmount = _mintedByCrowdsale; for (uint256 i = _currentRound; i < ROUNDS; i = i.add(1)) { if (finalAmount > _capOfRound[i]) { sendToCorrectAddress(beneficiary, _capOfRound[i].sub(totalMinted...
uint256 finalAmount = _mintedByCrowdsale.add(tokenAmount); uint256 totalMintedAmount = _mintedByCrowdsale; for (uint256 i = _currentRound; i < ROUNDS; i = i.add(1)) { if (finalAmount > _capOfRound[i]) { sendToCorrectAddress(beneficiary, _capOfRound[i].sub(totalMinted...
17,664
216
// update user global
uint256 prevAlpacaID = user.alpacaID; user.alpacaID = _id; user.alpacaEnergy = energy;
uint256 prevAlpacaID = user.alpacaID; user.alpacaID = _id; user.alpacaEnergy = energy;
15,495
17
// invest = ((totalValue - targetLiquidityAmount)(cTokenCash + cTokenBorrow)) / (a - totalValue)
uint256 invest = totalValue.sub(targetLiquidityAmount).mul(cTokenCash.add(cTokenBorrow)).div(a.sub(totalValue)); if (invest > totalValue) {
uint256 invest = totalValue.sub(targetLiquidityAmount).mul(cTokenCash.add(cTokenBorrow)).div(a.sub(totalValue)); if (invest > totalValue) {
19,082
5
// Returns the configuration data of the reserve Not returning borrow and supply caps for compatibility, nor pause flag asset The address of the underlying asset of the reservereturn decimals The number of decimals of the reservereturn ltv The ltv of the reservereturn liquidationThreshold The liquidationThreshold of th...
function getReserveConfigurationData( address asset ) external
function getReserveConfigurationData( address asset ) external
4,934
10
// Get ids count of the specified key id/ return total of value
function totalOf(uint256 _keyId) external view returns (uint256) { return keyTargetValues[_keyId].length; }
function totalOf(uint256 _keyId) external view returns (uint256) { return keyTargetValues[_keyId].length; }
41,428
342
// The current function will be called in the context of this address (either 0x transaction signer or `msg.sender`)./If calling a fill function, this address will represent the taker./If calling a cancel function, this address will represent the maker./ return Signer of 0x transaction if entry point is `executeTransac...
function _getCurrentContextAddress() internal view returns (address);
function _getCurrentContextAddress() internal view returns (address);
39,579
93
// Detect overflow when multiplying MIN_INT256 with -1
require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256)); require((b == 0) || (c / b == a)); return c;
require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256)); require((b == 0) || (c / b == a)); return c;
1,931
2
// The remaining amount of ETH left to be withdrawn
uint256 remainingAmount;
uint256 remainingAmount;
24,788
131
// Free up space we don't need anymore
lockup.numberOfTokensLocked = 0; lockup.lockupExpirationDate = 0;
lockup.numberOfTokensLocked = 0; lockup.lockupExpirationDate = 0;
41,751
29
// Fee to be paid when registering oracle
uint256 public constant REGISTRATION_FEE = 1 ether;
uint256 public constant REGISTRATION_FEE = 1 ether;
9,702
593
// Open up the new fee period. Take a snapshot of the total value of the system. Increment periodId from the recent closed period feePeriodId
recentFeePeriods[0].feePeriodId = recentFeePeriods[1].feePeriodId.add(1); recentFeePeriods[0].startingDebtIndex = synthetixState.debtLedgerLength(); recentFeePeriods[0].startTime = now; emitFeePeriodClosed(recentFeePeriods[1].feePeriodId);
recentFeePeriods[0].feePeriodId = recentFeePeriods[1].feePeriodId.add(1); recentFeePeriods[0].startingDebtIndex = synthetixState.debtLedgerLength(); recentFeePeriods[0].startTime = now; emitFeePeriodClosed(recentFeePeriods[1].feePeriodId);
30,901
72
// ========== STATE VARIABLES ========== // ========== CONSTRUCTOR ========== /
) public { rewardsToken = IERC20(_rewardsToken); stakingToken = IERC20(_stakingToken); rewardsDistribution = _rewardsDistribution; }
) public { rewardsToken = IERC20(_rewardsToken); stakingToken = IERC20(_stakingToken); rewardsDistribution = _rewardsDistribution; }
1,920
5
// Decrease the allowance by a given decrement spender Spender's address decrement Amount of decrease in allowancereturn True if successful /
function decreaseAllowance(address spender, uint256 decrement) external whenNotPaused notBlacklisted(msg.sender) notBlacklisted(spender) returns (bool)
function decreaseAllowance(address spender, uint256 decrement) external whenNotPaused notBlacklisted(msg.sender) notBlacklisted(spender) returns (bool)
24,484
3
// ============================================================//============================================================
function createCampaign(address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline, string memory _image) public returns (uint256) { Campaign storage campaign = campaigns[numberOfCampaigns]; require(campaign.deadline < block.timestamp, "The deadline should ...
function createCampaign(address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline, string memory _image) public returns (uint256) { Campaign storage campaign = campaigns[numberOfCampaigns]; require(campaign.deadline < block.timestamp, "The deadline should ...
14,410
96
// Finalize this crowdsale. /
function finalize() external inState(States.Active) onlyCrowdsaleOwner
function finalize() external inState(States.Active) onlyCrowdsaleOwner
52,195
85
// Get the amount of unsold tokens allocated to this contract; /
function getTokensLeft() public constant returns (uint) { return token.allowance(owner, this); }
function getTokensLeft() public constant returns (uint) { return token.allowance(owner, this); }
43,281
78
// Return the remainder to the sender
msg.sender.transfer(weiRemainder);
msg.sender.transfer(weiRemainder);
48,510
94
// Update storage balance of previous bin
balances[_from][_ids[i]] = balances[_from][_ids[i]].sub( _amounts[i] ); balances[_to][_ids[i]] = balances[_to][_ids[i]].add(_amounts[i]);
balances[_from][_ids[i]] = balances[_from][_ids[i]].sub( _amounts[i] ); balances[_to][_ids[i]] = balances[_to][_ids[i]].add(_amounts[i]);
36,350
4
// Enum for representing the status of a game.
enum GameStatus { PENDING, ACTIVE, FINISHED, REDEEMED }
enum GameStatus { PENDING, ACTIVE, FINISHED, REDEEMED }
21,033
89
// ------------------------------------------------------------------------ Calculate year/month/day from the number of days since 1970/01/01 using the date conversion algorithm from http:aa.usno.navy.mil/faq/docs/JD_Formula.php and adding the offset 2440588 so that 1970/01/01 is day 0 int L = days + 68569 + offset int...
function _daysToDate(uint _days) internal pure returns (uint year, uint month, uint day) { int __days = int(_days); int L = __days + 68569 + OFFSET19700101; int N = 4 * L / 146097; L = L - (146097 * N + 3) / 4; int _year = 4000 * (L + 1) / 1461001; L = L - 1461 * _ye...
function _daysToDate(uint _days) internal pure returns (uint year, uint month, uint day) { int __days = int(_days); int L = __days + 68569 + OFFSET19700101; int N = 4 * L / 146097; L = L - (146097 * N + 3) / 4; int _year = 4000 * (L + 1) / 1461001; L = L - 1461 * _ye...
16,452
2
// Access
function createRole(bytes32 _role) external; function addRoleToAccount(address _address, bytes32 _role) external; function cleanRolesForAccount(address _address) external;
function createRole(bytes32 _role) external; function addRoleToAccount(address _address, bytes32 _role) external; function cleanRolesForAccount(address _address) external;
30,957
19
// bytes32 public description;
uint public blocktime; event NewJournalGroup( address indexed creatorAddress, address indexed groupAddress, address ownerWallet, bytes32 indexed groupType, string description, uint blocktime );
uint public blocktime; event NewJournalGroup( address indexed creatorAddress, address indexed groupAddress, address ownerWallet, bytes32 indexed groupType, string description, uint blocktime );
10,369
20
// Returns the SVG and metadata for a token Id _tokenId The tokenId to return the SVG and metadata for. /
function tokenURI(uint256 _tokenId) public view override returns (string memory)
function tokenURI(uint256 _tokenId) public view override returns (string memory)
111
117
// Transfer equal tokens amount to multiple addresses
contract MultiTransferTokenEqual is Pausable { using SafeMath for uint256; using SafeERC20 for IERC20; /// @notice Send equal ERC20 tokens amount to multiple contracts /// /// @param _token The token to send /// @param _addresses Array of addresses to send to /// @param _amount Tokens amount to send to e...
contract MultiTransferTokenEqual is Pausable { using SafeMath for uint256; using SafeERC20 for IERC20; /// @notice Send equal ERC20 tokens amount to multiple contracts /// /// @param _token The token to send /// @param _addresses Array of addresses to send to /// @param _amount Tokens amount to send to e...
21,461
95
// OPERATOR
function setArbiters(address _icoRoundAddress, address[] _arbiters) only(owner) public { for (uint i = 0; i < _arbiters.length ; i++) { arbiterPool[_icoRoundAddress][_arbiters[i]] = true; } }
function setArbiters(address _icoRoundAddress, address[] _arbiters) only(owner) public { for (uint i = 0; i < _arbiters.length ; i++) { arbiterPool[_icoRoundAddress][_arbiters[i]] = true; } }
49,975
73
// Pick out the remaining bytes.
uint256 mask; unchecked { mask = 256**(32 - (_length % 32)) - 1; }
uint256 mask; unchecked { mask = 256**(32 - (_length % 32)) - 1; }
23,782
6
// Every bottle of wine increases the grapes to make next by 10
grapesToProduceBottle = SafeMath.add(SafeMath.mul(864000, wineBottles), grapesToProduceBottle); wineInCellar[msg.sender] = SafeMath.add(wineInCellar[msg.sender],wineBottles);
grapesToProduceBottle = SafeMath.add(SafeMath.mul(864000, wineBottles), grapesToProduceBottle); wineInCellar[msg.sender] = SafeMath.add(wineInCellar[msg.sender],wineBottles);
36,581
83
// //Migrate AAVE `aToken` underlying `amount` into COMP/CREAM `cToken` for benefit of `to` by batching calls to `aave` and `cToken`.
function aaveToCompound(address aToken, address cToken, address to, uint256 amount) external { IERC20(aToken).safeTransferFrom(msg.sender, address(this), amount); // deposit `msg.sender` `aToken` `amount` into this contract address underlying = IAaveBridge(aToken).UNDERLYING_ASSET_ADDRESS(); // sani...
function aaveToCompound(address aToken, address cToken, address to, uint256 amount) external { IERC20(aToken).safeTransferFrom(msg.sender, address(this), amount); // deposit `msg.sender` `aToken` `amount` into this contract address underlying = IAaveBridge(aToken).UNDERLYING_ASSET_ADDRESS(); // sani...
28,455
6
// Set LenderPoolAddress linked to the contract to a new lenderPoolAddressCan only be called by the owner /
function setLenderPoolAddress( address stableAddress, address lenderPoolAddress
function setLenderPoolAddress( address stableAddress, address lenderPoolAddress
17,155
26
// to affiliates /
function set_new_affiliateSplit(uint256 _new_affiliateSplit) external onlyOwner { require(_new_affiliateSplit <= 100, "Affiliate Split Value not allowed"); affiliateSplit = _new_affiliateSplit; }
function set_new_affiliateSplit(uint256 _new_affiliateSplit) external onlyOwner { require(_new_affiliateSplit <= 100, "Affiliate Split Value not allowed"); affiliateSplit = _new_affiliateSplit; }
24,690
229
// Deposit NFT tokens to Interstellar for MILK allocation.
function depositFarmingToken(uint256 _pid, uint256 _amount) public { require(lpToken.balanceOf(msg.sender) > 0); // todo - сделать проверку что пользователь залочил LP токены Shake/ETH - pid 10 PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; ...
function depositFarmingToken(uint256 _pid, uint256 _amount) public { require(lpToken.balanceOf(msg.sender) > 0); // todo - сделать проверку что пользователь залочил LP токены Shake/ETH - pid 10 PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; ...
23,245
35
// transferWithLock is only for airdrop or marketing purpose
function transferWithLock(address _to, uint256 _value, uint256 _time) onlyOwner transferParamsValidation(msg.sender, _to, _value) external returns (bool)
function transferWithLock(address _to, uint256 _value, uint256 _time) onlyOwner transferParamsValidation(msg.sender, _to, _value) external returns (bool)
6,454
119
// - _id - multiplier's id (0-4)- return value of multiplier/
function getValueMultiplier(uint256 _id) public view returns(uint256) { return multipliers[_id]; }
function getValueMultiplier(uint256 _id) public view returns(uint256) { return multipliers[_id]; }
31,108
108
// Amount of tokens available, in EXTwei
uint256 public remainingSupply;
uint256 public remainingSupply;
14,104
71
// Approve or remove `operator` as an operator for the caller.Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. Requirements: - The `operator` cannot be the caller. Emits an {ApprovalForAll} event. /
function setApprovalForAll(address operator, bool _approved) external;
function setApprovalForAll(address operator, bool _approved) external;
33,410
3
// Replaces any existing stored metadata.To expose the setter externally with modifier access control, create a new method invoking _setMetaData. /
function _setMetaData(string calldata data) internal { _metaData = data; emit MetaDataUpdate(data, _msgSender()); }
function _setMetaData(string calldata data) internal { _metaData = data; emit MetaDataUpdate(data, _msgSender()); }
46,298
220
// transfer interest in tokens
_token.safeTransfer(to, tokens); emit InterestPaid(to, depositId, tokens);
_token.safeTransfer(to, tokens); emit InterestPaid(to, depositId, tokens);
22,155
84
// Max tx, dividend threshold and tax variables
uint256 public maxWallet; uint256 public swapTokensAtAmount; uint256 public sellRewardsFee; uint256 public sellDeadFees; uint256 public sellMarketingFees; uint256 public sellLiquidityFee; uint256 public buyDeadFees; uint256 public buyMarketingFees; uint256 public buyLiquidityFee; ...
uint256 public maxWallet; uint256 public swapTokensAtAmount; uint256 public sellRewardsFee; uint256 public sellDeadFees; uint256 public sellMarketingFees; uint256 public sellLiquidityFee; uint256 public buyDeadFees; uint256 public buyMarketingFees; uint256 public buyLiquidityFee; ...
31,415
57
// View how much the Vault would increase this Strategy's borrow limit,based on its present performance (since its last report). Can be used todetermine expectedReturn in your Strategy. /
function creditAvailable() external view returns (uint256);
function creditAvailable() external view returns (uint256);
15,603
5
// initializes bond parameters_controlVariable uint_vestingTerm uint_minimumPrice uint_maxPayout uint_fee uint_maxDebt uint_initialDebt uint /
function initializeBondTerms( uint _controlVariable, uint _vestingTerm, uint _minimumPrice, uint _maxPayout, uint _fee, uint _maxDebt, uint _initialDebt
function initializeBondTerms( uint _controlVariable, uint _vestingTerm, uint _minimumPrice, uint _maxPayout, uint _fee, uint _maxDebt, uint _initialDebt
37,165
17
// Contains 512-bit math functions/Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision/Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits/Adapted to pragma solidity 0.8 from https:github.com...
library FullMath { /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 /// @param a The multiplicand /// @param b The multiplier /// @param denominator The divisor /// @return result The 256-bit result /// @dev Credit to Rem...
library FullMath { /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 /// @param a The multiplicand /// @param b The multiplier /// @param denominator The divisor /// @return result The 256-bit result /// @dev Credit to Rem...
19,478
15
// An event emitted when a proposal has been executed in the NounsDAOExecutor
event ProposalExecuted(uint256 id);
event ProposalExecuted(uint256 id);
41,583
4
// https:github.com/makerdao/dss/blob/master/src/jug.sol
interface JugAbstract { function wards(address) external view returns (uint256); function rely(address) external; function deny(address) external; function ilks(bytes32) external view returns (uint256, uint256); function vat() external view returns (address); function vow() external view returns...
interface JugAbstract { function wards(address) external view returns (uint256); function rely(address) external; function deny(address) external; function ilks(bytes32) external view returns (uint256, uint256); function vat() external view returns (address); function vow() external view returns...
22,612
8
// SafeMath Unsigned math operations with safety checks that revert on error. /
library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. ...
library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. ...
7,818
27
// add lpToken to the lpTokens enumerable set
lpTokens.add(address(_lpToken)); emit Add(pid, _lpToken, _boostedRewarder);
lpTokens.add(address(_lpToken)); emit Add(pid, _lpToken, _boostedRewarder);
30,292
54
// Adds the vesting id corresponding to the receiver
receiverIDs[_receiver].push(totalVestings); require(_transfer(msg.sender, address(this), _amount)); return true;
receiverIDs[_receiver].push(totalVestings); require(_transfer(msg.sender, address(this), _amount)); return true;
32,015
12
// Fetches the current token/eth price accumulator from uniswap. /
// function currentCumulativePrice(TokenConfig memory config) internal view returns (uint) { // (uint cumulativePrice0, uint cumulativePrice1,) = UniswapV2OracleLibrary.currentCumulativePrices(config.uniswapMarket); // if (config.isUniswapReversed) { // return cumulativePrice1; // } else { // ...
// function currentCumulativePrice(TokenConfig memory config) internal view returns (uint) { // (uint cumulativePrice0, uint cumulativePrice1,) = UniswapV2OracleLibrary.currentCumulativePrices(config.uniswapMarket); // if (config.isUniswapReversed) { // return cumulativePrice1; // } else { // ...
54,835
143
// Configurable address for defaultOwner. defaultOwner account to which newly minted tokens are allocated. /
function setDefaultOwner(address defaultOwner) onlyValidSender external { _defaultOwner = defaultOwner; }
function setDefaultOwner(address defaultOwner) onlyValidSender external { _defaultOwner = defaultOwner; }
8,412
337
// assign the new Lock
locks[newLock] = LockBalances({ deployed: true, totalSales: 0, yieldedDiscountTokens: 0 });
locks[newLock] = LockBalances({ deployed: true, totalSales: 0, yieldedDiscountTokens: 0 });
13,546
16
// In case of an attmept to delete a non-existent outflow, we should just do nothing.
if (oldFlowRate == int96(0) && newFlowRate == int96(0)) return;
if (oldFlowRate == int96(0) && newFlowRate == int96(0)) return;
988
297
// CryptoFlyz contract Extends ERC721 Non-Fungible Token Standard basic implementation /
contract CryptoFlyz is ERC721, Ownable, PaymentSplitter { bool public mintIsActive = true; uint256 public tokenPrice = 0; uint256 public publicTokenPrice = 42000000000000000; uint256 public constant maxTokens = 7025; uint256 public constant maxMintsPerTx = 10; string private _contractURI; u...
contract CryptoFlyz is ERC721, Ownable, PaymentSplitter { bool public mintIsActive = true; uint256 public tokenPrice = 0; uint256 public publicTokenPrice = 42000000000000000; uint256 public constant maxTokens = 7025; uint256 public constant maxMintsPerTx = 10; string private _contractURI; u...
72,352
36
// Note that it's ownable and the owner wields tremendous power. The ownership will be transferred to a governance smart contract once FATE is sufficiently distributed and the community can show to govern itself. Have fun reading it. Hopefully it's bug-free. God bless.
contract FateRewardController 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 ...
contract FateRewardController 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 ...
37,159
88
// The pulled forward user's total investment amount
uint256 allPrevInvestmentTotals = currentUser .epochTotals[currentUser.lastEpochUpdate] .allPrevInvestmentTotals;
uint256 allPrevInvestmentTotals = currentUser .epochTotals[currentUser.lastEpochUpdate] .allPrevInvestmentTotals;
46,437
550
// The rebase lag parameter, used to dampen the applied supply adjustment by 1 / rebaseLag Check setRebaseLag comments for more details. Natural number, no decimal places.
uint256 public rebaseLag;
uint256 public rebaseLag;
5,988
37
// The Smart Contract which stores the addresses of all the authorized Converts portal
PermittedConvertsInterface public permittedConverts;
PermittedConvertsInterface public permittedConverts;
9,978
127
// Convert signed 64.64 fixed point number into signed 128.128 fixed pointnumber.x signed 64.64-bit fixed point numberreturn signed 128.128 fixed point number /
function to128x128 (int128 x) internal pure returns (int256) { return int256 (x) << 64; }
function to128x128 (int128 x) internal pure returns (int256) { return int256 (x) << 64; }
10,731
91
// Multisignature wallet - Allows multiple parties to agree on proposals beforeexecution. Stefan George - <stefan.george@consensys.net> NOTE: This contract has its limitations and is not viable for everymulti-signature setup. On a case by case basis, evaluate whether this is thecorrect contract for your use case.In par...
contract MultiSig is Initializable, UUPSUpgradeable { using EnumerableSet for EnumerableSet.AddressSet; /** * @notice The maximum number of multisig owners. */ uint256 public constant MAX_OWNER_COUNT = 50; /** * @notice The minimum time in seconds that must elapse before a proposal is e...
contract MultiSig is Initializable, UUPSUpgradeable { using EnumerableSet for EnumerableSet.AddressSet; /** * @notice The maximum number of multisig owners. */ uint256 public constant MAX_OWNER_COUNT = 50; /** * @notice The minimum time in seconds that must elapse before a proposal is e...
23,429
33
// only two roles at this point, admin and moderator if admin is the account to change, then decrement if moderator is the count to change, then increment
if(isAdmin(_groupId, _accountToChange) == true) { require(getAdminCount(_groupId) > 1); storageContract.decrementUintValue(keccak256( abi.encodePacked(GROUP_KEY, _groupId, "adminCount")), 1 ); } else {
if(isAdmin(_groupId, _accountToChange) == true) { require(getAdminCount(_groupId) > 1); storageContract.decrementUintValue(keccak256( abi.encodePacked(GROUP_KEY, _groupId, "adminCount")), 1 ); } else {
31,070
152
// The block number when WOLF mining starts.
uint256 public startBlock; event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); constructor( WOLFToken _WOLF, ...
uint256 public startBlock; event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); constructor( WOLFToken _WOLF, ...
45,591
0
// Proof of Performance Interface - Allows interaction with the PoP contract./Gabriele Rigo - <gab@rigoblock.com>
interface ProofOfPerformanceFace { // CORE FUNCTIONS function claimPop(uint _ofPool) external; function setRegistry(address _dragoRegistry) external; function setRigoblockDao(address _rigoblockDao) external; function setRatio(address _ofGroup, uint _ratio) external; function setMinimumRigo(uin...
interface ProofOfPerformanceFace { // CORE FUNCTIONS function claimPop(uint _ofPool) external; function setRegistry(address _dragoRegistry) external; function setRigoblockDao(address _rigoblockDao) external; function setRatio(address _ofGroup, uint _ratio) external; function setMinimumRigo(uin...
40,439
2
// Проверяет что тот кто перевел владелец кошелька
modifier onlyOwner { require (msg.sender == ownerAddress, "Only owner"); _; }
modifier onlyOwner { require (msg.sender == ownerAddress, "Only owner"); _; }
42,829
28
// Unmarshals a point on G2 from bytes in an uncompressed form. /
function g2Unmarshal(bytes memory m) internal pure returns (G2Point memory)
function g2Unmarshal(bytes memory m) internal pure returns (G2Point memory)
7,303
139
// Set the token address./newTokenAddress Token adddress
function setTokenAddress(address newTokenAddress) public onlyOwner
function setTokenAddress(address newTokenAddress) public onlyOwner
15,256
3
// Returns the number of decimals used to get its user representation. /
uint256 public immutable decimals = 18;
uint256 public immutable decimals = 18;
2,696
161
// Withdraw specified amount and collect rewards
function unstake(uint256 amount) external { withdraw(amount); getReward(); }
function unstake(uint256 amount) external { withdraw(amount); getReward(); }
34,232
105
// Transfers `tokenId` token from `from` to `to`. WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. Requirements: - `from` cannot be the zero address.- `to` cannot be the zero address.- `tokenId` token must be owned by `from`.- If the caller is not `from`, it must be approved to mo...
function transferFrom(address from, address to, uint256 tokenId) external;
function transferFrom(address from, address to, uint256 tokenId) external;
928
24
// Guardamos en una variable string los candidatos con sus respectivos votos
string memory resultados = "";
string memory resultados = "";
29,843
18
// emit an event first - to log both old and new values
emit BaseURIUpdated(_msgSender(), baseURI, __baseURI);
emit BaseURIUpdated(_msgSender(), baseURI, __baseURI);
34,733
31
// set raffle_state to TICKET_SALE_OPEN
raffleState = RAFFLE_STATE.TICKET_SALE_OPEN;
raffleState = RAFFLE_STATE.TICKET_SALE_OPEN;
28,199
10
// Events //A default version was set.version_ The default version. /
event DefaultVersionSet(uint256 indexed version_);
event DefaultVersionSet(uint256 indexed version_);
79,280
31
// Store the bid details.
auctionDetails.reservePriceOrHighestBid = actualBid; auctionDetails.highestBidder = payable(msg.sender);
auctionDetails.reservePriceOrHighestBid = actualBid; auctionDetails.highestBidder = payable(msg.sender);
29,172
4
// max quota (per user, per direction)
uint256 public userQuota;
uint256 public userQuota;
14,631
104
// ERC20_utils
function withdrawAnyToken(address _token) external onlyAllowed returns (bool) { uint256 _amount = IERC20(_token).balanceOf(address(this)); _withdrawAnyToken(_msgSender(), _token, _amount); return true; } //get tokens sent by error to contract
function withdrawAnyToken(address _token) external onlyAllowed returns (bool) { uint256 _amount = IERC20(_token).balanceOf(address(this)); _withdrawAnyToken(_msgSender(), _token, _amount); return true; } //get tokens sent by error to contract
7,495
30
// If claim hasn't been done before for the index, add initial allotment
if (lastClaimed == _emissionStart) { totalAccumulated = totalAccumulated + INITIAL_ALLOTMENT; }
if (lastClaimed == _emissionStart) { totalAccumulated = totalAccumulated + INITIAL_ALLOTMENT; }
37,418
3
// Make a golem for one addressthe required runes will not be consumed /
function makeGolem() external { require(userMinted[msg.sender] == 0, "already minted"); require(tokenIdCounter < maxCountId, "cannot mint anymore"); uint256 runeSum; uint256[] memory runes = _tokenProvider.userRunes(msg.sender); for (uint256 index = 9; index > 0; ) { ...
function makeGolem() external { require(userMinted[msg.sender] == 0, "already minted"); require(tokenIdCounter < maxCountId, "cannot mint anymore"); uint256 runeSum; uint256[] memory runes = _tokenProvider.userRunes(msg.sender); for (uint256 index = 9; index > 0; ) { ...
40,084
63
// @contract TradeJPY /
contract TradeJPY is StandardToken, Ownable, HasNoTokens, BurnableToken, MintableToken{ string public name = "TradeJPY"; string public symbol = "TJPY"; uint public decimals = 8; event Transfer(address indexed from, address indexed to, uint value, bytes data); constructor(uint256 initialSupply)...
contract TradeJPY is StandardToken, Ownable, HasNoTokens, BurnableToken, MintableToken{ string public name = "TradeJPY"; string public symbol = "TJPY"; uint public decimals = 8; event Transfer(address indexed from, address indexed to, uint value, bytes data); constructor(uint256 initialSupply)...
21,353
0
// Emitted when the stored value changes
event ValueChanged(uint256 value);
event ValueChanged(uint256 value);
9,289
132
// Mouth N°1 => Neutral
function item_1() public pure returns (string memory) { return base( string( abi.encodePacked( '<path d="M178.3,262.7c3.3-0.2,6.6-0.1,9.9,0c3.3,0.1,6.6,0.3,9.8,0.8c-3.3,0.3-6.6,0.3-9.9,0.2C184.8,263.6,181.5,263.3,178.3,262.7z"/>', ...
function item_1() public pure returns (string memory) { return base( string( abi.encodePacked( '<path d="M178.3,262.7c3.3-0.2,6.6-0.1,9.9,0c3.3,0.1,6.6,0.3,9.8,0.8c-3.3,0.3-6.6,0.3-9.9,0.2C184.8,263.6,181.5,263.3,178.3,262.7z"/>', ...
33,920
10
// Contract constructor
constructor() public { rootAddress = msg.sender; Owner = msg.sender; // Addresses tokenAdd = address(0x9da0D98c9d051c594038eb3267fBd0FAf3Da9e48); tokenSpender = address(0xAd50cACa8cD726600840E745D0AE6B6E78861dBc); token = TokenWithDates(tokenAdd); ...
constructor() public { rootAddress = msg.sender; Owner = msg.sender; // Addresses tokenAdd = address(0x9da0D98c9d051c594038eb3267fBd0FAf3Da9e48); tokenSpender = address(0xAd50cACa8cD726600840E745D0AE6B6E78861dBc); token = TokenWithDates(tokenAdd); ...
21,522
86
// Check if sale is made within the listing window.
require(block.timestamp < _listing.endTime && block.timestamp > _listing.startTime, "not within sale window.");
require(block.timestamp < _listing.endTime && block.timestamp > _listing.startTime, "not within sale window.");
23,949
21
// @validate: signature-of-intent from target signer.
_validateSignature(messageHash, _signature, _params.signer);
_validateSignature(messageHash, _signature, _params.signer);
11,805
2
// Returns the latest price /
function getPriceDolarperMaticLink() public view returns (int256) { ( /*uint80 roundID*/, int256 _price, /*uint startedAt*/, /*uint timeStamp*/, /*uint80 answeredInRound*/ ) = priceFeed.latestRoundData(); return _price; }
function getPriceDolarperMaticLink() public view returns (int256) { ( /*uint80 roundID*/, int256 _price, /*uint startedAt*/, /*uint timeStamp*/, /*uint80 answeredInRound*/ ) = priceFeed.latestRoundData(); return _price; }
18,354
77
// Return the merged Merkle root of all the leaves at a desired depth.merge() or merged(_depth) must be called first. _depth The depth of the main tree. It must first be computedusing mergeSubRoots() and merge()./
function getMainRoot(uint256 _depth) public view returns (uint256) { require( hashLength ** _depth >= numLeaves, "AccQueue: getMainRoot: _depth must be high enough" ); return mainRoots[_depth]; }
function getMainRoot(uint256 _depth) public view returns (uint256) { require( hashLength ** _depth >= numLeaves, "AccQueue: getMainRoot: _depth must be high enough" ); return mainRoots[_depth]; }
37,597
65
// Provides a descriptive tag for bot consumption This should be modified weekly to provide a summary of the actions Hash: seth keccak -- "$(wget https:raw.githubusercontent.com/makerdao/community/989a2ee92df41ef7aee75a1ccdbedbe6071e28a7/governance/votes/Executive%20vote%20-%20October%201%2C%202021.md -q -O - 2>/dev/nu...
string public constant override description = "2021-10-01 MakerDAO Executive Spell | Hash: 0x240a8946c4c5f2463a1fcd6c7036409087af1c2407d502330e27c9149bfa7ed7";
string public constant override description = "2021-10-01 MakerDAO Executive Spell | Hash: 0x240a8946c4c5f2463a1fcd6c7036409087af1c2407d502330e27c9149bfa7ed7";
51,423
1
// tokenAmount is to 18 dp, usdAmount is to 8 dp token must be LINK / WETH / YFL
function calculateTokenAmountFromUsdAmount(address token, uint256 usdAmount) external view returns (uint256 tokenAmount);
function calculateTokenAmountFromUsdAmount(address token, uint256 usdAmount) external view returns (uint256 tokenAmount);
3,138
0
// fee for primary sales/ return uint256 of primary sale fee
uint256 public protocolFeePrimary;
uint256 public protocolFeePrimary;
16,467
4
// Emitted when a transaction is executed
event TransactionExecuted(bytes32 proposalId, address[] targets, uint256[] values, bytes[] payloads);
event TransactionExecuted(bytes32 proposalId, address[] targets, uint256[] values, bytes[] payloads);
16,417
6
// Modifier that restricts a function only for vault address
modifier onlyVault { require(_msgSender() == blackHoleVaultAddress); _; }
modifier onlyVault { require(_msgSender() == blackHoleVaultAddress); _; }
43,305
0
// ============ State Variables ============ // ============ Constructor ============ /
{ price = _startingPrice; }
{ price = _startingPrice; }
992
82
// clear any previously approved ownership exchange
delete villainIndexToApproved[_tokenId];
delete villainIndexToApproved[_tokenId];
28,182
234
// SET MANAGER ONLY. Initialize module with SetToken and set the fee state for the SetToken. Passed_settings will have lastStreamingFeeTimestamp over-written._setToken Address of SetToken _settings FeeState struct defining fee parameters /
function initialize( ISetToken _setToken, FeeState memory _settings ) external onlySetManager(_setToken, msg.sender) onlyValidAndPendingSet(_setToken)
function initialize( ISetToken _setToken, FeeState memory _settings ) external onlySetManager(_setToken, msg.sender) onlyValidAndPendingSet(_setToken)
66,970
344
// Get tier total supplys and counts
uint256 tierSupply = tierInfo.totalSupply; uint256 tierCount = tierCounts[tier.id]; return tierSupply.sub(tierCount);
uint256 tierSupply = tierInfo.totalSupply; uint256 tierCount = tierCounts[tier.id]; return tierSupply.sub(tierCount);
29,824
3
// what the eth to usd conversion rate
}
}
8,688
10
// Returns the subtraction of two unsigned integers, reverting with custom message on overflow (when the result is negative). CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; }...
* message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; }...
84,074
18
// Mints the below-mentioned amount of tokens allocated to Vibeo user adoption. The tokens are immediately available once the softcap is reached and ICO end date is specified.
function mintUserAdoptionTokens() public onlyWhitelisted { require(softCapReached); if(icoEndDate == 0) { revert(); } mintOnce("useradoption", msg.sender, 95000000); }
function mintUserAdoptionTokens() public onlyWhitelisted { require(softCapReached); if(icoEndDate == 0) { revert(); } mintOnce("useradoption", msg.sender, 95000000); }
16,112
2
// Write /
{ require(hasRole(FACTORY_ADMIN, msg.sender), "WINToken: Restricted to FACTORY_ADMIN role"); collectionName[_id] = _name; collectionMaxSupply[_id] = _maxSupply; }
{ require(hasRole(FACTORY_ADMIN, msg.sender), "WINToken: Restricted to FACTORY_ADMIN role"); collectionName[_id] = _name; collectionMaxSupply[_id] = _maxSupply; }
14,212
60
// Sets new fee recipient address/newFeeRecipient Address of the new fee recipient.
function setFeeRecipient(address newFeeRecipient) external;
function setFeeRecipient(address newFeeRecipient) external;
17,655