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
18
// Results of calling updateWithPositionHint.
uint constant public UPDATE_ONLY_AMOUNTS = 0; uint constant public UPDATE_MOVE_ORDER = 1; uint constant public UPDATE_FAILED = 2; uint32 constant public TAIL_ID = 1; uint32 constant public HEAD_ID = 2; uint32 public nextFreeId = 3;
uint constant public UPDATE_ONLY_AMOUNTS = 0; uint constant public UPDATE_MOVE_ORDER = 1; uint constant public UPDATE_FAILED = 2; uint32 constant public TAIL_ID = 1; uint32 constant public HEAD_ID = 2; uint32 public nextFreeId = 3;
57,258
42
// Allows _spender to withdraw from your account multiple times, up to the _value amount. Ifthis function is called again it overwrites the current allowance with _value. _spender The address of the account able to transfer the tokens. _value The amount of tokens to be approved for transfer. /
function approve( address _spender, uint256 _value ) public override returns (bool _success)
function approve( address _spender, uint256 _value ) public override returns (bool _success)
15,030
52
// Get the price per share in the vault/ return The price per share in units of underlying;
function _pricePerShare() internal view returns (uint256) { return vault.pricePerShare(); }
function _pricePerShare() internal view returns (uint256) { return vault.pricePerShare(); }
27,674
22
// In case the ownership needs to be transferred
function transferOwnership(address newOwner) external onlyOwner
function transferOwnership(address newOwner) external onlyOwner
15,894
22
// Get collector wallet addressreturn collector wallet address /
function getCollector() external view returns (address) { return _collector; }
function getCollector() external view returns (address) { return _collector; }
5,701
417
// update cached total vault and geyser amounts
vaultData.totalStake = vaultData.totalStake.add(amount); _geyser.totalStake = _geyser.totalStake.add(amount);
vaultData.totalStake = vaultData.totalStake.add(amount); _geyser.totalStake = _geyser.totalStake.add(amount);
46,096
23
// Extend the decimals to 1e18.
uint price = mul_(uint(answer), 10**(18 - uint(aggregator.decimals()))); return getNormalizedPrice(price, cTokenAddress);
uint price = mul_(uint(answer), 10**(18 - uint(aggregator.decimals()))); return getNormalizedPrice(price, cTokenAddress);
37,958
55
// Setup Carbon metrics
address private DEVFEEWALLET = 0x939531828119947978b5cDC00D2C0852F29b9cBb; address private PANCAKEROUTER = 0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F; //Needs to be updated to exchange router based on network mapping (address => bool) public liquidityPools; mapping (address => uint256) public farmingL...
address private DEVFEEWALLET = 0x939531828119947978b5cDC00D2C0852F29b9cBb; address private PANCAKEROUTER = 0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F; //Needs to be updated to exchange router based on network mapping (address => bool) public liquidityPools; mapping (address => uint256) public farmingL...
6,968
62
// Checks if the account should be allowed to repay a borrow in the given market bToken The market to verify the repay against payer The account which would repay the asset borrower The account which would borrowed the asset repayAmount The amount of the underlying asset the account would repayreturn 0 if the repay is ...
function repayBorrowAllowed( address bToken, address payer, address borrower,
function repayBorrowAllowed( address bToken, address payer, address borrower,
36,097
179
// Getter for number of future factories registeredreturn the number of future factory registered /
function futureFactoryCount() external view returns (uint256);
function futureFactoryCount() external view returns (uint256);
49,004
8
// usamos o operador modulo (%) para sortear um indice
jogadores[indice].transfer(address(this).balance); jogadores = new address payable[](0);
jogadores[indice].transfer(address(this).balance); jogadores = new address payable[](0);
23,503
211
// if player is new to this version of fomo3d
if (_pID == 0) {
if (_pID == 0) {
33,375
52
// See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance ...
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; }
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; }
32,320
158
// --- swap eth to platform token here! ----
uint oldPlatformTokenBalance = IERC20(TRUSTED_PLATFORM_TOKEN_ADDRESS).balanceOf(address(this)); address[] memory path = new address[](2); path[0] = uniswapRouterV2.WETH(); path[1] = TRUSTED_PLATFORM_TOKEN_ADDRESS;
uint oldPlatformTokenBalance = IERC20(TRUSTED_PLATFORM_TOKEN_ADDRESS).balanceOf(address(this)); address[] memory path = new address[](2); path[0] = uniswapRouterV2.WETH(); path[1] = TRUSTED_PLATFORM_TOKEN_ADDRESS;
5,922
42
// staker must approve the stake amount to be controlled by the genesis contract
require(!locked, "Genesis contract is locked"); require(rio.balanceOf(_msgSender()) >= amount, "Sender does not have enough RIO");
require(!locked, "Genesis contract is locked"); require(rio.balanceOf(_msgSender()) >= amount, "Sender does not have enough RIO");
14,558
8
// the id of the reserve. Represents the position in the list of the active reserves
uint8 id;
uint8 id;
4,262
60
// Return Kp/
function sg() external isReader view returns (int256) { return Kp; }
function sg() external isReader view returns (int256) { return Kp; }
48,873
7
// Require that they haven't voted before
require(!voters[msg.sender]);
require(!voters[msg.sender]);
34,713
104
// beneficiary account
address private beneficiary;
address private beneficiary;
22,222
96
// Virtual method to override if needed (eg. pool address is equal to lp token address)/ return address of pool from LP token
function _curvePool(address _curveLpToken) internal view virtual returns (address) { return IMainRegistry(MAIN_REGISTRY).get_pool_from_lp_token(_curveLpToken); }
function _curvePool(address _curveLpToken) internal view virtual returns (address) { return IMainRegistry(MAIN_REGISTRY).get_pool_from_lp_token(_curveLpToken); }
45,629
71
// InitializableAdminUpgradeabilityProxy Extends from BaseAdminUpgradeabilityProxy with an initializer forinitializing the implementation, admin, and init data. /
contract InitializableAdminUpgradeabilityProxy is BaseAdminUpgradeabilityProxy, InitializableUpgradeabilityProxy { /** * Contract initializer. * @param _logic address of the initial implementation. * @param _admin Address of the proxy administrator. * @param _data Data to send as msg.data to the...
contract InitializableAdminUpgradeabilityProxy is BaseAdminUpgradeabilityProxy, InitializableUpgradeabilityProxy { /** * Contract initializer. * @param _logic address of the initial implementation. * @param _admin Address of the proxy administrator. * @param _data Data to send as msg.data to the...
50,978
14
// Adds an address that can be allowed by a token lock to pull funds _dst Destination address /
function addTokenDestination(address _dst) external override onlyOwner { require(_dst != address(0), "Destination cannot be zero"); require(_tokenDestinations.add(_dst), "Destination already added"); emit TokenDestinationAllowed(_dst, true); }
function addTokenDestination(address _dst) external override onlyOwner { require(_dst != address(0), "Destination cannot be zero"); require(_tokenDestinations.add(_dst), "Destination already added"); emit TokenDestinationAllowed(_dst, true); }
15,949
111
// Transfers vested tokens to beneficiary. /
function release() public { uint256 unreleased = _releasableAmount(); require(unreleased > 0, "no tokens are due"); require(block.timestamp > _lastReleaseTime + RELEASE_INTERVAL, "release interval is not passed"); _released = _released.add(unreleased); _token.safeTransfer(...
function release() public { uint256 unreleased = _releasableAmount(); require(unreleased > 0, "no tokens are due"); require(block.timestamp > _lastReleaseTime + RELEASE_INTERVAL, "release interval is not passed"); _released = _released.add(unreleased); _token.safeTransfer(...
11,409
1
// NFTContractAddress
);
);
42,968
137
// Contract implementation
contract EthereumElon is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool...
contract EthereumElon is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool...
11,226
38
// Logg Allocation
emit LogOwnerAllocation(_recipient, _tokenAmount);
emit LogOwnerAllocation(_recipient, _tokenAmount);
26,321
87
// Range Pool is a RangeSwap ERC20 token that facilitates trades between stablecoins. We execute "optimistic swaps" --essentially, the pool assumes all tokens to be worth the same amount at all times, and executes as such.The caveat is that tokens must remain within a range, determined by Allocation Points (AP). For ex...
contract RangePool is ERC20, Ownable { using SafeMath for uint; using SafeERC20 for IERC20; using SafeERC20 for ERC20; using Address for address; /* ========== EVENTS ========== */ event Swap( address, uint, address ); event Add( address, uint ); event Remove( address, uint ); e...
contract RangePool is ERC20, Ownable { using SafeMath for uint; using SafeERC20 for IERC20; using SafeERC20 for ERC20; using Address for address; /* ========== EVENTS ========== */ event Swap( address, uint, address ); event Add( address, uint ); event Remove( address, uint ); e...
19,430
186
// Withdraws funds from the Aave pool. amount The amount of tokens to be withdrawn. /
function withdraw(uint256 amount) external { require(amount > 0, "Amount must be greater than 0."); aETH.redeem(amount); }
function withdraw(uint256 amount) external { require(amount > 0, "Amount must be greater than 0."); aETH.redeem(amount); }
64,797
60
// Transfer in Dai to supply.
require( _DAI.transferFrom(msg.sender, address(this), daiToSupply), "DharmaDaiExchanger: Dai transfer in failed 1 ensure allowance is correctly set." );
require( _DAI.transferFrom(msg.sender, address(this), daiToSupply), "DharmaDaiExchanger: Dai transfer in failed 1 ensure allowance is correctly set." );
56,119
26
// bool private _cooldownEnabled = true;
bool private _communityMode = false; bool private inSwap = false; uint256 private _launchBlock = 0;
bool private _communityMode = false; bool private inSwap = false; uint256 private _launchBlock = 0;
15,230
75
// 设置发行参数
// @param {address[]nt} founders_ 创始人列表 // @param {uint[]} percents_ 创始人分配比例,总和必须小于100 function setDistConfig(address[] founders_, uint[] percents_) public auth { // 判断是否配置过 assert(isDistConfig == false); // 输入参数测试 assert(founders_.length > 0); assert(founders_.leng...
// @param {address[]nt} founders_ 创始人列表 // @param {uint[]} percents_ 创始人分配比例,总和必须小于100 function setDistConfig(address[] founders_, uint[] percents_) public auth { // 判断是否配置过 assert(isDistConfig == false); // 输入参数测试 assert(founders_.length > 0); assert(founders_.leng...
37,758
28
// Burnable Token Token that can be irreversibly burned (destroyed). /
contract BurnableToken is StandardToken { event Burn(address indexed burner, uint256 value); /** * @dev Burns a specific amount of tokens. * @param _value The amount of token to be burned. */ function burn(uint256 _value) public { require(_value > 0); require(_value <= balan...
contract BurnableToken is StandardToken { event Burn(address indexed burner, uint256 value); /** * @dev Burns a specific amount of tokens. * @param _value The amount of token to be burned. */ function burn(uint256 _value) public { require(_value > 0); require(_value <= balan...
4,360
482
// Retrieves rewards owed for a set of resolved price requests. Can only retrieve rewards if calling for a valid round and if the call is done within the timeout threshold(not expired). Note that a named return value is used here to avoid a stack to deep error. voterAddress voter for which rewards will be retrieved. Do...
function retrieveRewards( address voterAddress, uint256 roundId, PendingRequestAncillary[] memory toRetrieve
function retrieveRewards( address voterAddress, uint256 roundId, PendingRequestAncillary[] memory toRetrieve
9,994
25
// Public Variables
address public exchangeTemplate; uint256 public tokenCount;
address public exchangeTemplate; uint256 public tokenCount;
11,980
23
// An event emitted when the ratio is updated
event NewRatio(address indexed _owner, uint256 _ratio);
event NewRatio(address indexed _owner, uint256 _ratio);
17,897
39
// Remove the withdrawn disbursement
delete beneficiaryDisbursements[_index]; token.safeTransfer(_beneficiary, disbursement.value); emit TokensWithdrawn(_beneficiary, disbursement.value);
delete beneficiaryDisbursements[_index]; token.safeTransfer(_beneficiary, disbursement.value); emit TokensWithdrawn(_beneficiary, disbursement.value);
79,040
19
// event LogUserAdded(address user);
event LogUserRemoved(address user); constructor( address _receiver ) public Owned()
event LogUserRemoved(address user); constructor( address _receiver ) public Owned()
19,362
136
// Ownership check above ensures no underflow.
unchecked { _balanceOf[owner]--; }
unchecked { _balanceOf[owner]--; }
23,420
121
// CrowdfundEditions MirrorXYZ /
contract CrowdfundEditions is ERC721, ICrowdfundEditions { // ============ Constants ============ string public constant name = "Crowdfunded Mirror Editions"; string public constant symbol = "CROWDFUND_EDITIONS"; uint256 internal constant REENTRANCY_NOT_ENTERED = 1; uint256 internal constant REENT...
contract CrowdfundEditions is ERC721, ICrowdfundEditions { // ============ Constants ============ string public constant name = "Crowdfunded Mirror Editions"; string public constant symbol = "CROWDFUND_EDITIONS"; uint256 internal constant REENTRANCY_NOT_ENTERED = 1; uint256 internal constant REENT...
27,369
3
// Call protocol 1
uint256 amountReceivedSwapToken = _protocolCall( router1, borrowedToken, decodedData.swapToken, amount, decodedData.deadline );
uint256 amountReceivedSwapToken = _protocolCall( router1, borrowedToken, decodedData.swapToken, amount, decodedData.deadline );
31,482
7
// Allow transfer of accidentally sent ERC20 tokens
function refundTokens(address _recipient, address _token) public onlyOwner { require(_token != address(this)); IERC20 token = IERC20(_token); uint256 balance = token.balanceOf(this); token.transfer(_recipient, balance); }
function refundTokens(address _recipient, address _token) public onlyOwner { require(_token != address(this)); IERC20 token = IERC20(_token); uint256 balance = token.balanceOf(this); token.transfer(_recipient, balance); }
26,497
3
// TRANSFER_TOKEN
if (actionType == 1) { address token; address receiver; uint256 value; assembly { token := shr(96, calldataload(ptr)) ptr := add(ptr, 20) receiver := shr(96, calldataload(ptr)) ptr := add(ptr, 20) value := calldataload(ptr)
if (actionType == 1) { address token; address receiver; uint256 value; assembly { token := shr(96, calldataload(ptr)) ptr := add(ptr, 20) receiver := shr(96, calldataload(ptr)) ptr := add(ptr, 20) value := calldataload(ptr)
23,254
25
// 更新上一级的邀请数量
_addReferrerInvites(tempReferrer, i, value);
_addReferrerInvites(tempReferrer, i, value);
5,781
198
// The funding cycle number for each project. Each funding cycle has a number that is an increment of the cycle that directly preceded it. Each project's first funding cycle has a number of 1.
uint256 number;
uint256 number;
15,495
455
// Pay SPONSOR: remaining collateral (collateral - TRV) + sponsor reward
FixedPoint.Unsigned memory remainingCollateral = collateral.sub(tokenRedemptionValue); FixedPoint.Unsigned memory payToSponsor = sponsorDisputeReward.add(remainingCollateral); withdrawalAmount = withdrawalAmount.add(payToSponsor); delete liquidation.sponso...
FixedPoint.Unsigned memory remainingCollateral = collateral.sub(tokenRedemptionValue); FixedPoint.Unsigned memory payToSponsor = sponsorDisputeReward.add(remainingCollateral); withdrawalAmount = withdrawalAmount.add(payToSponsor); delete liquidation.sponso...
12,063
1
// == Interaction ==
erc20.approve(address(main.rToken()), type(uint256).max);
erc20.approve(address(main.rToken()), type(uint256).max);
39,349
50
// requireIsCallerAuthorized
{ //Fail fast if contract has no funds require(address(this).balance >= insureeBalances[sender], "Error: Not enought funds in contract"); //Continue with withdrawl uint256 tmp = insureeBalances[sender]; insureeBalances[sender] = 0; sender.transfer(tmp); }
{ //Fail fast if contract has no funds require(address(this).balance >= insureeBalances[sender], "Error: Not enought funds in contract"); //Continue with withdrawl uint256 tmp = insureeBalances[sender]; insureeBalances[sender] = 0; sender.transfer(tmp); }
42,656
53
// If the active player of the previous round didn't claim their refund then they lose the ability to claim it. Their refund is also rolled into the bonuses for the next round.
uint remainingBonus = previousRound.totalBonus.add(INITIAL_PRICE).sub(previousRound.claimedBonus); Rounds[RoundId].totalBonus = Rounds[RoundId].totalBonus.add(remainingBonus);
uint remainingBonus = previousRound.totalBonus.add(INITIAL_PRICE).sub(previousRound.claimedBonus); Rounds[RoundId].totalBonus = Rounds[RoundId].totalBonus.add(remainingBonus);
38,652
12
// Update a person's avatar/avatar the person's avatar
function setPersonAvatar(string memory avatar) public { require(bytes(avatar).length > 0, "name cannot be the empty string"); uint256 personID = getPersonIDByAccount(msg.sender); people[personID].avatar = avatar; emit PersonAvatarSet(msg.sender, avatar); }
function setPersonAvatar(string memory avatar) public { require(bytes(avatar).length > 0, "name cannot be the empty string"); uint256 personID = getPersonIDByAccount(msg.sender); people[personID].avatar = avatar; emit PersonAvatarSet(msg.sender, avatar); }
24,771
207
// overrides
function _burn(address account, uint256 value) internal override(ERC20, ERC20Snapshot) { super._burn(account, value); }
function _burn(address account, uint256 value) internal override(ERC20, ERC20Snapshot) { super._burn(account, value); }
25,007
171
// Existing validator
else { validator.vesting = request.newVesting; validator.lastVestingIncreaseTime = now; if (activeValidatorExist(chain, acc) == true) { chain.totalVesting = chain.totalVesting.add(request.newVesting - origVesting); ...
else { validator.vesting = request.newVesting; validator.lastVestingIncreaseTime = now; if (activeValidatorExist(chain, acc) == true) { chain.totalVesting = chain.totalVesting.add(request.newVesting - origVesting); ...
28,739
397
// gets the reserve liquidity cumulative index_reserve the reserve address return the reserve liquidity cumulative index/
function getReserveLiquidityCumulativeIndex(address _reserve) external view returns (uint256) { CoreLibrary.ReserveData storage reserve = reserves[_reserve]; return reserve.lastLiquidityCumulativeIndex; }
function getReserveLiquidityCumulativeIndex(address _reserve) external view returns (uint256) { CoreLibrary.ReserveData storage reserve = reserves[_reserve]; return reserve.lastLiquidityCumulativeIndex; }
24,416
5
// administrative to upload the names and images associated with each trait traitType the trait type to upload the traits for (see traitTypes for a mapping) traits the names and base64 encoded PNGs for each trait /
function uploadTraits(uint8 traitType, uint8[] calldata traitIds, Trait[] calldata traits) external onlyOwner { require(traitIds.length == traits.length, "Mismatched inputs"); for (uint i = 0; i < traits.length; i++) { traitData[traitType][traitIds[i]] = Trait( traits[i].name, traits[i]....
function uploadTraits(uint8 traitType, uint8[] calldata traitIds, Trait[] calldata traits) external onlyOwner { require(traitIds.length == traits.length, "Mismatched inputs"); for (uint i = 0; i < traits.length; i++) { traitData[traitType][traitIds[i]] = Trait( traits[i].name, traits[i]....
31,289
219
// Pre-pool start time = 5% tax
if (block.timestamp < startTime) { return 5;
if (block.timestamp < startTime) { return 5;
59,769
164
// reset Stake Data For sender
45,524
204
// 15% will got to the community wallet to support community (and neighboring community) projects
require(payable(a4).send(percent * 15));
require(payable(a4).send(percent * 15));
60,102
10
// receivers
mapping(address => bool) public receivers;
mapping(address => bool) public receivers;
24,971
31
// Item Mappings
creators[_id] = msg.sender; tokenMaxSupply[_id] = _maxSupply; tokenSupply[_id] = _initialSupply;
creators[_id] = msg.sender; tokenMaxSupply[_id] = _maxSupply; tokenSupply[_id] = _initialSupply;
55,725
52
// Init function that gets called from `BoringFactory.deploy`./ Also kown as the constructor for cloned contracts./ Any ETH send to `BoringFactory.deploy` ends up here./data Can be abi encoded arguments or anything else.
function init(bytes calldata data) external payable;
function init(bytes calldata data) external payable;
29,984
33
// Caps per token supply to 10 editions
require((_globalEditions[id] + amount) <= _editionLimit, "ERC1155: exceeded token maximum editions"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), to, _asSingletonArray(id), _asSingletonArray(amount), data); _balances[id][to] += amount;
require((_globalEditions[id] + amount) <= _editionLimit, "ERC1155: exceeded token maximum editions"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), to, _asSingletonArray(id), _asSingletonArray(amount), data); _balances[id][to] += amount;
10,668
216
// Redeem Aave Tokens
safe.execute( address(stakedAave), abi.encodeWithSelector( stakedAave.redeem.selector, address(safe), stakeBalance ) ); uint256 balance = aave.balanceOf(address(safe));
safe.execute( address(stakedAave), abi.encodeWithSelector( stakedAave.redeem.selector, address(safe), stakeBalance ) ); uint256 balance = aave.balanceOf(address(safe));
78,480
27
// The service fee percentage (can be changed by the contract's owner)
uint256 public feePercent = 0;
uint256 public feePercent = 0;
5,794
16
// getProxyAdmin gets the current address who controls the underlying implementation/ of a Vault. For most all pools either this contract address or the zero address will/ be the proxyAdmin. If the admin is the zero address the pool's implementation is naturally/ no longer upgradable (no one owns the zero address)./poo...
function getProxyAdmin(address pool) public view returns (address) { return IEIP173Proxy(pool).proxyAdmin(); }
function getProxyAdmin(address pool) public view returns (address) { return IEIP173Proxy(pool).proxyAdmin(); }
11,849
32
// Approve to TradingProxy
src.approve(tradingProxy, amount);
src.approve(tradingProxy, amount);
43,205
154
// Emits a {Staked} event. /
function stake(address relayaddr, uint256 unstakeDelay) external payable;
function stake(address relayaddr, uint256 unstakeDelay) external payable;
3,436
17
// get ETH deposit/_addr address get deposit/ return amount deposit of an buyer
function getDeposit(address _addr) public constant
function getDeposit(address _addr) public constant
575
78
// `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary contract-specific code that enables us to report opaque error codes from upgradeable contracts.//use this when reporting a known error from the money market or a non-upgradeable collaborator/
function fail(Error err, FailureInfo info) internal returns (uint) { emit Failure(uint(err), uint(info), 0); return uint(err); }
function fail(Error err, FailureInfo info) internal returns (uint) { emit Failure(uint(err), uint(info), 0); return uint(err); }
41,714
62
// Called if contract ever adds fees
event Params(uint feeBasisPoints, uint maxFee);
event Params(uint feeBasisPoints, uint maxFee);
19,961
154
// Exchange sUSD for PNX while insisting on a particular rate. This allows a user toexchange while protecting against frontrunning by the contract owner on the exchange rate. pynthAmount The amount of pynths the user wishes to exchange. guaranteedRate A rate (pynthetix price) the caller wishes to insist upon. /
function exchangePynthsForPNXAtRate(uint pynthAmount, uint guaranteedRate) external rateNotInvalid(PNX) notPaused returns ( uint // Returns the number of PNX received )
function exchangePynthsForPNXAtRate(uint pynthAmount, uint guaranteedRate) external rateNotInvalid(PNX) notPaused returns ( uint // Returns the number of PNX received )
14,244
38
// Asserts
require(isStart(), "Sale is not started yet"); require(!isClosed, "Sale is closed"); require(!isFinished, "Sale is finished");
require(isStart(), "Sale is not started yet"); require(!isClosed, "Sale is closed"); require(!isFinished, "Sale is finished");
18,339
53
// Only when sufficient allocations remain for making this liquid allocation (2).
modifier when_allocatable_liquid(uint amount) { require (liquidAllocatable >= amount); _; }
modifier when_allocatable_liquid(uint amount) { require (liquidAllocatable >= amount); _; }
11,671
10
// adds a new model (can only be called by the owner) /
{ // check if more models can be added require(modelCount < maxModels, "Cannot add more models."); // add new model to dictionary models[modelCount] = Model(modelCount, dataset, learner, outcomes, now); // add model weights to dictionary modelWeights[mode...
{ // check if more models can be added require(modelCount < maxModels, "Cannot add more models."); // add new model to dictionary models[modelCount] = Model(modelCount, dataset, learner, outcomes, now); // add model weights to dictionary modelWeights[mode...
25,335
9
// if there is a borrow, there can't be 0 collateral
if (vars.collateralBalancefterDecrease == 0) { return false; }
if (vars.collateralBalancefterDecrease == 0) { return false; }
1,127
97
// Project Contraints
uint256 public maxTokens = 5555; uint256 public mintPrice = 0.07 ether; uint256 public maxMintsPerTx = 10; uint256 public maxMintsPerWl = 2; mapping(address => uint256) public addressToWlMints;
uint256 public maxTokens = 5555; uint256 public mintPrice = 0.07 ether; uint256 public maxMintsPerTx = 10; uint256 public maxMintsPerWl = 2; mapping(address => uint256) public addressToWlMints;
16,485
259
// Update the timestamp
lastUpdateTime = block.timestamp;
lastUpdateTime = block.timestamp;
35,277
17
// Verifies that a mint request is signed by an account holding MINTER_ROLE (at the time of the function call).
function verify(MintRequest calldata _req, bytes calldata _signature) public view returns (bool, address) { address signer = recoverAddress(_req, _signature); return (!minted[_req.uid] && hasRole(MINTER_ROLE, signer), signer); }
function verify(MintRequest calldata _req, bytes calldata _signature) public view returns (bool, address) { address signer = recoverAddress(_req, _signature); return (!minted[_req.uid] && hasRole(MINTER_ROLE, signer), signer); }
25,374
106
// Possible options when claiming
enum Option { Claim, ClaimAsETH, ClaimAsCRV, ClaimAsCVX, ClaimAndStake }
enum Option { Claim, ClaimAsETH, ClaimAsCRV, ClaimAsCVX, ClaimAndStake }
79,227
57
// Data Structure
enum Status {IDLE, RUNNING, STOPPED}
enum Status {IDLE, RUNNING, STOPPED}
78,298
41
// Check the offer /
function checkOffer(Offer calldata offer, bytes calldata signature) external view checkOfferSignature(offer, signature) returns (Offer calldata)
function checkOffer(Offer calldata offer, bytes calldata signature) external view checkOfferSignature(offer, signature) returns (Offer calldata)
20,909
30
// NB - we duplicate _startTimes below to allow function reuse
_checkLengthOfArray(_holders, _allowedTokens, _startTimes, _startTimes, _endTimes, _restrictionTypes); for (uint256 i = 0; i < _holders.length; i++) { addIndividualDailyRestriction( _holders[i], _allowedTokens[i], _startTimes[i], ...
_checkLengthOfArray(_holders, _allowedTokens, _startTimes, _startTimes, _endTimes, _restrictionTypes); for (uint256 i = 0; i < _holders.length; i++) { addIndividualDailyRestriction( _holders[i], _allowedTokens[i], _startTimes[i], ...
51,749
153
// ASet the default 11 authorized contracts /
function enableDefaultContractsForAC(uint32 _assetClass) external;
function enableDefaultContractsForAC(uint32 _assetClass) external;
34,219
265
// ex: avVader
string(abi.encodePacked("av", _UNDERLYING.symbol())),
string(abi.encodePacked("av", _UNDERLYING.symbol())),
30,390
1
// Emitted when the allowance of a spender for an owner is set by a call to approve. Value is the new allowance
event Approval(address indexed owner, address indexed spender, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
3,785
183
// Transforms a previous observation into a new observation, given the passage of time and the current tick and liquidity values/blockTimestamp _must_ be chronologically equal to or greater than last.blockTimestamp, safe for 0 or 1 overflows/last The specified observation to be transformed/blockTimestamp The timestamp ...
function transform( Observation memory last, uint32 blockTimestamp, int24 tick, uint128 liquidity
function transform( Observation memory last, uint32 blockTimestamp, int24 tick, uint128 liquidity
29,083
19
// Constructor _conflictResAddress conflict resolution contract address. /
function ConflictResolutionManager(address _conflictResAddress) public { conflictRes = ConflictResolutionInterface(_conflictResAddress); }
function ConflictResolutionManager(address _conflictResAddress) public { conflictRes = ConflictResolutionInterface(_conflictResAddress); }
28,411
39
// return The amount of link to pay for a VRF call /
function chainlinkFee() external view override returns (uint256) { return _chainlinkFee; }
function chainlinkFee() external view override returns (uint256) { return _chainlinkFee; }
80,965
100
// List of Buyers
address[] public buyers; bool public isUnlockingStarted; bool public isPresaleStarted; uint public presalePhase;
address[] public buyers; bool public isUnlockingStarted; bool public isPresaleStarted; uint public presalePhase;
25,038
101
// Manual burning function Force to burn it in some situation Amount is including decimal points
function hardBurnSMS(address _from, uint _amount) external onlyOwner { // Burning from source address if (balances[_from] &gt; 0) { balances[_from] -= _amount; totalSupply -= _amount; Transfer(_from, genesis, _amount); } }
function hardBurnSMS(address _from, uint _amount) external onlyOwner { // Burning from source address if (balances[_from] &gt; 0) { balances[_from] -= _amount; totalSupply -= _amount; Transfer(_from, genesis, _amount); } }
24,585
95
// Getter function to see pending Corlibri rewards per user.
function pendingCorlibri(uint256 _pid, address _user) public view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accCorlibriPerShare = pool.accCorlibriPerShare; return user.amount.mul(accCorlibriPerShare).div(1e18)....
function pendingCorlibri(uint256 _pid, address _user) public view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accCorlibriPerShare = pool.accCorlibriPerShare; return user.amount.mul(accCorlibriPerShare).div(1e18)....
42,160
80
// modifyLGEWhitelistAddresses - Define what addresses are included/excluded from a whitelist round index - 0-based index of round to modify whitelistduration - period in seconds from LGE event or previous whitelist roundamountMax - max amount (TOKEN decimals) for each whitelist round/
function modifyLGEWhitelist( uint256 index, uint256 duration, uint256 amountMax, address[] calldata addresses, bool enabled
function modifyLGEWhitelist( uint256 index, uint256 duration, uint256 amountMax, address[] calldata addresses, bool enabled
27,563
131
// Create founders vault contract
foundersVault = new TokenVesting(foundersWallet, END_TIME, FOUNDERS_VESTING_CLIFF, FOUNDERS_VESTING_DURATION, false);
foundersVault = new TokenVesting(foundersWallet, END_TIME, FOUNDERS_VESTING_CLIFF, FOUNDERS_VESTING_DURATION, false);
35,435
29
// auto reverts when day < 1st fortnight
return ((getDay().sub(30)).div(fortnight));
return ((getDay().sub(30)).div(fortnight));
22,866
16
// This is the memory location where the "data block" starts for the precompile.
uint state_ptr; assembly {
uint state_ptr; assembly {
47,779
26
// See {IERC20Metadata-decimals}.
function decimals() public view override(ERC20Upgradeable, IERC20MetadataUpgradeable) returns (uint8) { return _decimals; }
function decimals() public view override(ERC20Upgradeable, IERC20MetadataUpgradeable) returns (uint8) { return _decimals; }
24,452
63
// AddressSet
struct AddressSet { Set _inner; }
struct AddressSet { Set _inner; }
48,472
30
// 检查帐户余额
require(_balances[msg.sender] >= wad); _balances[msg.sender] = sub(_balances[msg.sender],wad); _balances[dst] = add(_balances[dst], wad); Transfer(msg.sender, dst, wad); return true;
require(_balances[msg.sender] >= wad); _balances[msg.sender] = sub(_balances[msg.sender],wad); _balances[dst] = add(_balances[dst], wad); Transfer(msg.sender, dst, wad); return true;
39,748
24
// - `index` must be strictly less than {length}. /
function at(Bytes4Set storage set, uint256 index) internal view returns ( bytes4 ) { return bytes4( _at( set._inner, index ) ); }
function at(Bytes4Set storage set, uint256 index) internal view returns ( bytes4 ) { return bytes4( _at( set._inner, index ) ); }
4,609
59
// Manually back GamePlayerCoins owner address. /
function backGamePlayerCoinOwner() onlyOwner public { coin.transferOwnership(owner); }
function backGamePlayerCoinOwner() onlyOwner public { coin.transferOwnership(owner); }
42,933
138
// Minimal amount of governance token to allow proposal creation
uint256 public minimum = 1e18;
uint256 public minimum = 1e18;
54,203
62
// Emit events before deleting listing to check whether is whitelisted
if (listing.whitelisted) { emit _ListingRemoved(_listingHash); } else {
if (listing.whitelisted) { emit _ListingRemoved(_listingHash); } else {
7,185