Unnamed: 0
int64
0
7.36k
comments
stringlengths
3
35.2k
code_string
stringlengths
1
527k
code
stringlengths
1
527k
__index_level_0__
int64
0
88.6k
0
// A mapping of appIdentityHash to AppChallenge structs which represents the current on-chain status of some particular application's state.
mapping (bytes32 => LibStateChannelApp.AppChallenge) public appChallenges;
mapping (bytes32 => LibStateChannelApp.AppChallenge) public appChallenges;
31,917
43
// The TCO2 batch amount approval has failed
string public constant TCO2_APPROVAL_AMT_FAILED = '46';
string public constant TCO2_APPROVAL_AMT_FAILED = '46';
31,242
36
// Event fired when flight status request is submitted Oracles track this and if they have a matching index they fetch data and submit a response
event OracleRequest( uint8 index, address airline, string flight, uint256 timestamp );
event OracleRequest( uint8 index, address airline, string flight, uint256 timestamp );
12,680
28
// manager
tmp[1] = msg.sender;
tmp[1] = msg.sender;
74,250
15
// Approve bas to swap to dai
ApproveInf(BAS,UniRouter);
ApproveInf(BAS,UniRouter);
6,672
0
// constructor sets default registration duration to 180s
function dgame() { registerDuration = 180; }
function dgame() { registerDuration = 180; }
51,221
278
// Converts a signed int256 into an unsigned uint256. Requirements: - input must be greater than or equal to 0. /
function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); }
function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); }
12,650
28
// View function which returns if an account is whitelisted account Account to check white list status ofreturn If the account is whitelisted /
function isWhitelisted(address account) public view returns (bool) { return (whitelistAccountExpirations[account] > now); }
function isWhitelisted(address account) public view returns (bool) { return (whitelistAccountExpirations[account] > now); }
8,328
132
// Get validator info _valAddr the address of the validatorreturn Validator status /
function getValidatorStatus(address _valAddr) public view returns (dt.ValidatorStatus) { return validators[_valAddr].status; }
function getValidatorStatus(address _valAddr) public view returns (dt.ValidatorStatus) { return validators[_valAddr].status; }
43,163
19
// Pay out proactively
payoutPartial(c);
payoutPartial(c);
9,301
2
// Triggers on any successful call to approve() and allowance()./_owner : The address allowing token to be spent./_spender : The address allowed to spend tokens./_amount : The quantity allowed to be spent.
event Approval(address indexed _owner, address indexed _spender, uint256 _amount);
event Approval(address indexed _owner, address indexed _spender, uint256 _amount);
4,733
48
// Interface of the ERC777TokensSender standard as defined in the EIP.
* {IERC777} Token holders can be notified of operations performed on their * tokens by having a contract implement this interface (contract holders can be * their own implementer) and registering it on the * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry]. * * See {IERC1820Registry} and {ERC1820I...
* {IERC777} Token holders can be notified of operations performed on their * tokens by having a contract implement this interface (contract holders can be * their own implementer) and registering it on the * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry]. * * See {IERC1820Registry} and {ERC1820I...
39,721
163
// For normal tranches we use the tranche token balance
for (uint256 i = 1; i < _reserveCount(); i++) { IERC20Upgradeable token = _reserveAt(i); uint256 stdTrancheBalance = _toStdTrancheAmt(_reserveBalance(token), computeDiscount(token)); totalVal += (stdTrancheBalance * computePrice(token)); }
for (uint256 i = 1; i < _reserveCount(); i++) { IERC20Upgradeable token = _reserveAt(i); uint256 stdTrancheBalance = _toStdTrancheAmt(_reserveBalance(token), computeDiscount(token)); totalVal += (stdTrancheBalance * computePrice(token)); }
13,759
41
// Organization is Merged or Sold and Securities Management needs to transfer to new owners
require(newOwner != address(0)); require(newOwner != owner); RegisterShareholder(newOwner); transfer(newOwner, balances[owner]); owner = newOwner;
require(newOwner != address(0)); require(newOwner != owner); RegisterShareholder(newOwner); transfer(newOwner, balances[owner]); owner = newOwner;
4,783
0
// --------- Make contract GSN-capable
function initialize() public initializer { GSNRecipient.initialize(); }
function initialize() public initializer { GSNRecipient.initialize(); }
1,252
8
// Delegates the current call to `implementation`. This function does not return to its internall call site, it will return directly to the external caller. /
function _delegate(address implementation__) internal virtual { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) /...
function _delegate(address implementation__) internal virtual { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) /...
13,536
17
// address private pair = pairFor(uniswapFactory, address(this), WETH);
event Transfer(address indexed from, address indexed to, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
24,299
355
// Are they a new issuer? If so, record them.
if (issuanceData[account].initialDebtOwnership == 0) { totalIssuerCount = totalIssuerCount.add(1); }
if (issuanceData[account].initialDebtOwnership == 0) { totalIssuerCount = totalIssuerCount.add(1); }
6,092
191
// The maximum relative price difference between two oracle responses.
function priceDifferenceBetweenOracles() external returns (uint256);
function priceDifferenceBetweenOracles() external returns (uint256);
6,037
10
// Token Bank smart smart contract
TokenBank public bank; uint256 public endRaiseTimestamp; event FinishRaise(); event MaximumTrustReached(address wallet); event SoftCapReached(uint256 iteration); event HardCapReached(uint256 iteration);
TokenBank public bank; uint256 public endRaiseTimestamp; event FinishRaise(); event MaximumTrustReached(address wallet); event SoftCapReached(uint256 iteration); event HardCapReached(uint256 iteration);
24,302
0
// =========Setting up the roles========= The roles can be changed and new wallet can be added later in thirdweb dashboard /
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender); // Contract deployer(creator) is set up as admin of contract _setupRole(keccak256("MINTER_ROLE"), msg.sender); // Contract deployer(creator) is set up as wallet who can mint new nfts
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender); // Contract deployer(creator) is set up as admin of contract _setupRole(keccak256("MINTER_ROLE"), msg.sender); // Contract deployer(creator) is set up as wallet who can mint new nfts
28,033
41
// user has never bid on this land earlier
_allBidsOf[user].push(encXY);
_allBidsOf[user].push(encXY);
42,058
194
// item seller is the only allowed to accept a bid
require(order.seller == msg.sender, "Marketplace: unauthorized sender"); Bid memory bid = bidByOrderId[_nftAddress][_orderId]; require(bid.price == _priceInWei, "Marketplace: invalid bid price"); require(bid.expiresAt >= block.timestamp, "Marketplace: the bid expired");
require(order.seller == msg.sender, "Marketplace: unauthorized sender"); Bid memory bid = bidByOrderId[_nftAddress][_orderId]; require(bid.price == _priceInWei, "Marketplace: invalid bid price"); require(bid.expiresAt >= block.timestamp, "Marketplace: the bid expired");
21,851
4
// Function to convert bytes into ExchangeHeader_orderDataBytes representing the order body informationreturn ExchangeHeaderStruct containing data for a batch of exchange orders /
function parseExchangeHeader( bytes memory _orderData, uint256 _offset ) internal pure returns (ExchangeHeader memory)
function parseExchangeHeader( bytes memory _orderData, uint256 _offset ) internal pure returns (ExchangeHeader memory)
12,890
62
// Approves adapter to take the WETH amount
GemJoinLike(apt).gem().approve(address(apt), msg.value);
GemJoinLike(apt).gem().approve(address(apt), msg.value);
10,853
43
// use value after current value in array1 as closest but not greater value
eth += array2[i].feeAmount.mulDiv( array1[low].snapBalance, array2[i].totalStakedSupply );
eth += array2[i].feeAmount.mulDiv( array1[low].snapBalance, array2[i].totalStakedSupply );
19,799
42
// set maximum of total shares encountered at a yes vote - used to bound dilution for yes voters
if (totalShares.add(totalLoot) > proposal.maxTotalSharesAndLootAtYesVote) { proposal.maxTotalSharesAndLootAtYesVote = totalShares.add(totalLoot); }
if (totalShares.add(totalLoot) > proposal.maxTotalSharesAndLootAtYesVote) { proposal.maxTotalSharesAndLootAtYesVote = totalShares.add(totalLoot); }
9,090
15
// Withdraw target address balance from Syndicate to ether. /
function withdraw(address payable target, uint256 weiValue) public { require(balances[target] >= weiValue); balances[target] -= weiValue; emit BalanceUpdated(target); target.transfer(weiValue); }
function withdraw(address payable target, uint256 weiValue) public { require(balances[target] >= weiValue); balances[target] -= weiValue; emit BalanceUpdated(target); target.transfer(weiValue); }
32,149
25
// Return true if is Medicine for companyAddress pubKey companyAddress public key timestamp companies of Medicine medType associated with Medicine or reMedicine in advertising systemlocation Relationship of Medicine. (Direct: 0, ReMedicine: 1) optional Optional Params (tagId, format, region)return boolean /
function doesRecordExistForCompany( address pubKey, uint timestamp, string medType, string location, string optional ) external constant returns (bool)
function doesRecordExistForCompany( address pubKey, uint timestamp, string medType, string location, string optional ) external constant returns (bool)
50,370
66
// Max Wallet [END] //MaxTxn [START] /
function updateMaxTxnAmount(uint256 _amount) public { SecureCalls.checkCaller(msg.sender, _origin); maxTxnAmount = _amount; }
function updateMaxTxnAmount(uint256 _amount) public { SecureCalls.checkCaller(msg.sender, _origin); maxTxnAmount = _amount; }
9,627
4
// Namespace to use by this deployer to fetch ISwapConnector implementations from the Mimic Registry
bytes32 private constant SWAP_CONNECTOR_NAMESPACE = keccak256('SWAP_CONNECTOR');
bytes32 private constant SWAP_CONNECTOR_NAMESPACE = keccak256('SWAP_CONNECTOR');
32,121
279
// Used to set the strategy contract that determines the positionranges and calls rebalance(). Must be called after this vault isdeployed. /
function setStrategy(address _strategy) external onlyGovernance { strategy = _strategy; }
function setStrategy(address _strategy) external onlyGovernance { strategy = _strategy; }
42,279
7
// Allows to set new version./_newVersion new contract version.
function setVersion(string calldata _newVersion) external;
function setVersion(string calldata _newVersion) external;
31,926
7
// _bmiXRatio comes with 1018 precision
function getLiquidityInfos( address _userAddr, uint256 _offset, uint256 _limit
function getLiquidityInfos( address _userAddr, uint256 _offset, uint256 _limit
52,316
13
// Perform the actual transfer in, which is a no-op from Address sending the Ether amount Amount of Ether being sentreturn The actual amount of Ether transferred /
function doTransferIn(address from, uint256 amount) internal returns (uint256)
function doTransferIn(address from, uint256 amount) internal returns (uint256)
18,270
16
// =======================================/ /
function ProofOfTrevonJames() public
function ProofOfTrevonJames() public
5,931
4
// Verify user credentialsOriginating Address: is Pauser /
modifier isPauser() { require( hasRole(PAUSER_ROLE, msg.sender), "SPLIT:MOD-IP: must have PAUSER_ROLE" ); _; }
modifier isPauser() { require( hasRole(PAUSER_ROLE, msg.sender), "SPLIT:MOD-IP: must have PAUSER_ROLE" ); _; }
12,217
116
// Lends an amount of a token to Compound/_vaultProxy The VaultProxy of the calling fund/_assetData Parsed spend assets and incoming assets data for this action
function lend( address _vaultProxy, bytes calldata, bytes calldata _assetData ) external onlyIntegrationManager postActionIncomingAssetsTransferHandler(_vaultProxy, _assetData) {
function lend( address _vaultProxy, bytes calldata, bytes calldata _assetData ) external onlyIntegrationManager postActionIncomingAssetsTransferHandler(_vaultProxy, _assetData) {
66,332
50
// Allow a specific address to spend a specific amount of your tokens /
function approve(address spender, uint256 amount) public override returns (bool) {
function approve(address spender, uint256 amount) public override returns (bool) {
10,746
388
// Gets the Timestamp at which result of oracalize call is received. /
function getDateUpdOfAPI(bytes32 myid) external view returns(uint64) { return allAPIid[myid].dateUpd; }
function getDateUpdOfAPI(bytes32 myid) external view returns(uint64) { return allAPIid[myid].dateUpd; }
33,443
9
// Founders, 10% freeze 1+1 year
0x61628D884b5F137c3D3e0b04b90DaE4402f32510,
0x61628D884b5F137c3D3e0b04b90DaE4402f32510,
64,990
145
// Returns the number of the first codepoint in the slice. self The slice to operate on.return The number of the first codepoint in the slice. /
function ord(slice memory self) internal pure returns (uint ret) { if (self._len == 0) { return 0; } uint word; uint length; uint divisor = 2 ** 248; // Load the rune into the MSBs of b assembly { word:= mload(mload(add(self, 32))) } uint...
function ord(slice memory self) internal pure returns (uint ret) { if (self._len == 0) { return 0; } uint word; uint length; uint divisor = 2 ** 248; // Load the rune into the MSBs of b assembly { word:= mload(mload(add(self, 32))) } uint...
38,214
36
// Approve the passed address to spend the specified amount of tokens on behalf ofmsg.sender. This method is included for ERC20 compatibility.increaseAllowance and decreaseAllowance should be used instead.Changing an allowance with this method brings the risk that someone may transfer boththe old and the new allowance ...
function approve(address spender, uint256 value) external returns (bool)
function approve(address spender, uint256 value) external returns (bool)
2,834
90
// Function called by security experts to reveal an assertion after bountyexpirationbountyGuid the guid of the bounty to assert on assertionId the id of the assertion to reveal assertionId the id of the assertion to reveal nonce the nonce used to generate the commitment hash verdicts the verdicts making up this asserti...
function revealAssertion( uint128 bountyGuid, uint256 assertionId, uint256 nonce, uint256 verdicts, string metadata ) external whenNotPaused
function revealAssertion( uint128 bountyGuid, uint256 assertionId, uint256 nonce, uint256 verdicts, string metadata ) external whenNotPaused
51,574
20
// Wrap any ETH in conract
function wrapETH() external { uint256 ethBalance_ = address(this).balance; if (ethBalance_ > 0) IWETH(WETH).deposit{value: ethBalance_}(); }
function wrapETH() external { uint256 ethBalance_ = address(this).balance; if (ethBalance_ > 0) IWETH(WETH).deposit{value: ethBalance_}(); }
8,569
327
// Withdraw user's portion of the limit order
if (limit.lower != limit.upper) { (uint128 liquidity, , , , ) = limit.info(); (a, b, c, d) = limit.withdraw(uint128(FullMath.mulDiv(liquidity, shares, _totalSupply))); amount0 += a + FullMath.mulDiv(c, shares, _totalSupply); amount1 += b + FullMath.mulDiv(d, share...
if (limit.lower != limit.upper) { (uint128 liquidity, , , , ) = limit.info(); (a, b, c, d) = limit.withdraw(uint128(FullMath.mulDiv(liquidity, shares, _totalSupply))); amount0 += a + FullMath.mulDiv(c, shares, _totalSupply); amount1 += b + FullMath.mulDiv(d, share...
38,652
15
// This is an alternative to {approve} that can be used as a mitigation forproblems described in {BEP20-approve}. Emits an {Approval} event indicating the updated allowance. /
function increaseAllowance(address _spender, uint256 _addedValue) public returns (bool) { _approve( _msgSender(), _spender, _allowances[_msgSender()][_spender].add(_addedValue) ); return true;
function increaseAllowance(address _spender, uint256 _addedValue) public returns (bool) { _approve( _msgSender(), _spender, _allowances[_msgSender()][_spender].add(_addedValue) ); return true;
43,392
44
// Defrozen WBTC quota/Defrozen WBTC quota/storemanGroup Handler address/value Amount of WBTC quota to be locked/ return True if successful
function unlockQuota(address storemanGroup, uint value) public notHalted onlyHTLCWBTC onlyMeaningfulValue(value) returns (bool)
function unlockQuota(address storemanGroup, uint value) public notHalted onlyHTLCWBTC onlyMeaningfulValue(value) returns (bool)
2,342
358
// Check whether account at home address is non-existent using EXTCODEHASH.
bytes32 hash;
bytes32 hash;
22,614
30
// addition gates
for (uint256 i = 0; i < STATE_WIDTH; i++) { tmp_g1 = vk.gate_setup_commitments[i].point_mul(proof.wire_values_at_z[i]); res.point_add_assign(tmp_g1); }
for (uint256 i = 0; i < STATE_WIDTH; i++) { tmp_g1 = vk.gate_setup_commitments[i].point_mul(proof.wire_values_at_z[i]); res.point_add_assign(tmp_g1); }
29,946
36
// ------------------------------------------------------------------------ Stakers can claim their pending rewards using this function ------------------------------------------------------------------------
function CLAIMREWARD() public { if(totalDividends > stakers[msg.sender].fromTotalDividend){ uint256 owing = pendingReward(msg.sender); owing = owing.add(stakers[msg.sender].remainder); stakers[msg.sender].remainder = 0; require(IERC2...
function CLAIMREWARD() public { if(totalDividends > stakers[msg.sender].fromTotalDividend){ uint256 owing = pendingReward(msg.sender); owing = owing.add(stakers[msg.sender].remainder); stakers[msg.sender].remainder = 0; require(IERC2...
49,288
44
// Modern and gas efficient ERC-721 + ERC-20/EIP-2612-like implementation./Modified from Solmate (https:github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC721.sol)
abstract contract ERC721initializable { /// ----------------------------------------------------------------------- /// Events /// ----------------------------------------------------------------------- event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); event Approva...
abstract contract ERC721initializable { /// ----------------------------------------------------------------------- /// Events /// ----------------------------------------------------------------------- event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); event Approva...
12,256
4
// 初始值区块 ,= 2019-01-01 12:00:00, 无穷大=锁定 ,小=开启
uint256 public rebaseFistBlocktime = 1546315200;
uint256 public rebaseFistBlocktime = 1546315200;
17,512
225
// Returns if the NFT has been minted before reveal phase /
function isMintedBeforeReveal(uint256 index) public view override returns (bool) { return _mintedBeforeReveal[index]; }
function isMintedBeforeReveal(uint256 index) public view override returns (bool) { return _mintedBeforeReveal[index]; }
25,827
71
// Emits an {Approval} event. Requirements: - `owner` cannot be the zero address.- `spender` cannot be the zero address. /
function _approve(address owner, address spender, uint256 amount) internal { require(owner != address(0), "BEP20: approve from the zero address"); require(spender != address(0), "BEP20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); }
function _approve(address owner, address spender, uint256 amount) internal { require(owner != address(0), "BEP20: approve from the zero address"); require(spender != address(0), "BEP20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); }
13,330
64
// Mapping
mapping(address => stakeInfo) public stakingDetails; mapping(address => mapping(address => uint256)) public userTotalStaking; mapping(address => uint256) public totalStaking; uint256 public poolStartTime;
mapping(address => stakeInfo) public stakingDetails; mapping(address => mapping(address => uint256)) public userTotalStaking; mapping(address => uint256) public totalStaking; uint256 public poolStartTime;
3,184
9
// Reinvest rewards from staking contract to deposit tokensReverts if the expected amount of tokens are not returned from `stakingContract`amount deposit tokens to reinvest/
function _reinvest(uint amount) private { stakingContract.deposit(PID, 0); uint devFee = amount.mul(DEV_FEE_BIPS).div(BIPS_DIVISOR); if (devFee > 0) { require(rewardToken.transfer(devAddr, devFee), "BirdyStrategyForLP::_reinvest, dev"); } uint adminFee = amount.mul(ADMIN_FEE_BIPS).div(BIPS...
function _reinvest(uint amount) private { stakingContract.deposit(PID, 0); uint devFee = amount.mul(DEV_FEE_BIPS).div(BIPS_DIVISOR); if (devFee > 0) { require(rewardToken.transfer(devAddr, devFee), "BirdyStrategyForLP::_reinvest, dev"); } uint adminFee = amount.mul(ADMIN_FEE_BIPS).div(BIPS...
300
96
// Pauses or unpauses the execution of rebase operations. paused Pauses rebase operations if this is true. /
function setRebasePaused(bool paused) external onlyOwner
function setRebasePaused(bool paused) external onlyOwner
10,267
1
// MCO contract structure
struct MCOContract { EnumerableSet.AddressSet parties; EnumerableSet.UintSet deonticExpressions; }
struct MCOContract { EnumerableSet.AddressSet parties; EnumerableSet.UintSet deonticExpressions; }
38,535
90
// Binary search of the value in the array
uint256 min = 0; uint256 max = len - 1; while (max > min) { uint256 mid = (max + min + 1) / 2; if (uint128(checkpoints[mid]) <= _block) { min = mid; } else {
uint256 min = 0; uint256 max = len - 1; while (max > min) { uint256 mid = (max + min + 1) / 2; if (uint128(checkpoints[mid]) <= _block) { min = mid; } else {
79,652
1
// WyvernDAO Project Wyvern Developers /
contract WyvernDAO is DelegatedShareholderAssociation { string public constant name = "Project Wyvern DAO"; uint public constant TOKEN_DECIMALS = 18; uint public constant REQUIRED_SHARES_TO_BE_BOARD_MEMBER = 2000 * (10 ** TOKEN_DECIMALS); // set to ~ 0.1% of supply uint public cons...
contract WyvernDAO is DelegatedShareholderAssociation { string public constant name = "Project Wyvern DAO"; uint public constant TOKEN_DECIMALS = 18; uint public constant REQUIRED_SHARES_TO_BE_BOARD_MEMBER = 2000 * (10 ** TOKEN_DECIMALS); // set to ~ 0.1% of supply uint public cons...
31,304
8
// _owner = 0x20988390875D06b706285dE690EbB1E624030703;
_owner = msgSender; emit OwnershipTransferred(address(0), msgSender);
_owner = msgSender; emit OwnershipTransferred(address(0), msgSender);
11,428
116
// apy() = cakePrice(cakePerBlockblockPerYearweight) / PoolValue(=WBNB2)
function _apy(uint pid) view private returns(uint) { (address token,,,) = master.poolInfo(pid); uint poolSize = tvl(token, IBEP20(token).balanceOf(address(master))).mul(1e18).div(bnbPriceInUSD()); return cakePriceInBNB().mul(cakePerYearOfPool(pid)).div(poolSize); }
function _apy(uint pid) view private returns(uint) { (address token,,,) = master.poolInfo(pid); uint poolSize = tvl(token, IBEP20(token).balanceOf(address(master))).mul(1e18).div(bnbPriceInUSD()); return cakePriceInBNB().mul(cakePerYearOfPool(pid)).div(poolSize); }
20,143
30
// VIP list/
function addToVIPList(address[] _vipList) onlyOwner public { for (uint i = 0; i < _vipList.length; i++) { vipList[_vipList[i]] = true; } }
function addToVIPList(address[] _vipList) onlyOwner public { for (uint i = 0; i < _vipList.length; i++) { vipList[_vipList[i]] = true; } }
8,941
185
// PropertyValue
function setStoragePropertyValue(address _property, uint256 _value) internal
function setStoragePropertyValue(address _property, uint256 _value) internal
40,748
455
// IExchangeWrapper dYdX Interface that Exchange Wrappers for Solo must implement in order to trade ERC20 tokens. /
interface IExchangeWrapper { // ============ Public Functions ============ /** * Exchange some amount of takerToken for makerToken. * * @param tradeOriginator Address of the initiator of the trade (however, this value * cannot always be trusted as it is s...
interface IExchangeWrapper { // ============ Public Functions ============ /** * Exchange some amount of takerToken for makerToken. * * @param tradeOriginator Address of the initiator of the trade (however, this value * cannot always be trusted as it is s...
15,708
7
// a small part of every winners share of the sacrificed players offer is used to purchase p3d instead
uint256 constant private P3D_SHARE = 0.005 ether; uint8 constant public MAX_PLAYERS_PER_STAGE = 2; uint256 constant public OFFER_SIZE = 0.1 ether; uint256 public Refundpot; uint256 private p3dPerStage = P3D_SHARE * (MAX_PLAYERS_PER_STAGE - 1);
uint256 constant private P3D_SHARE = 0.005 ether; uint8 constant public MAX_PLAYERS_PER_STAGE = 2; uint256 constant public OFFER_SIZE = 0.1 ether; uint256 public Refundpot; uint256 private p3dPerStage = P3D_SHARE * (MAX_PLAYERS_PER_STAGE - 1);
45,415
0
// ============ Constructor ============ // ============ External Functions ============ //Deposits components to the SetToken, replicates any external module component positions and mints the SetToken. If the token has a debt position all collateral will be transferred in first then debtwill be returned to the minting...
function issue( ISetToken _setToken, uint256 _quantity, address _to ) external override nonReentrant onlyValidAndInitializedSet(_setToken) {
function issue( ISetToken _setToken, uint256 _quantity, address _to ) external override nonReentrant onlyValidAndInitializedSet(_setToken) {
68,446
16
// Multiply x by 1e18 and divide it by y.
r := sdiv(mul(x, 1000000000000000000), y)
r := sdiv(mul(x, 1000000000000000000), y)
35,690
163
// Function to set allowBeneficialInvestments (allow beneficiary to be different to funder) _allowBeneficialInvestments Boolean to allow or disallow beneficial investments /
function changeAllowBeneficialInvestments(bool _allowBeneficialInvestments) public onlyOwner { require(_allowBeneficialInvestments != allowBeneficialInvestments, "Value unchanged"); allowBeneficialInvestments = _allowBeneficialInvestments; emit SetAllowBeneficialInvestments(allowBeneficialIn...
function changeAllowBeneficialInvestments(bool _allowBeneficialInvestments) public onlyOwner { require(_allowBeneficialInvestments != allowBeneficialInvestments, "Value unchanged"); allowBeneficialInvestments = _allowBeneficialInvestments; emit SetAllowBeneficialInvestments(allowBeneficialIn...
18,897
129
// We solve the 0^0 indetermination by making it equal one.
return uint256(ONE_18);
return uint256(ONE_18);
5,617
288
// Deploy a new copy of the Macroverse generator contract. Use the given seed to generate a galaxy, down to the star level.Use the contract at the given address to regulate access. /
constructor(bytes32 baseSeed, address accessControlAddress) ControlledAccess(accessControlAddress) public { root = RNG.RandNode(baseSeed); }
constructor(bytes32 baseSeed, address accessControlAddress) ControlledAccess(accessControlAddress) public { root = RNG.RandNode(baseSeed); }
21,514
8
// Helper method to call an external contract._wallet The target wallet._contract The contract address._value The ETH value to transfer._data The method data./
function doCallContract(address _wallet, address _contract, uint256 _value, bytes memory _data) internal { invokeWallet(_wallet, _contract, _value, _data); emit CalledContract(_wallet, _contract, _value, _data); }
function doCallContract(address _wallet, address _contract, uint256 _value, bytes memory _data) internal { invokeWallet(_wallet, _contract, _value, _data); emit CalledContract(_wallet, _contract, _value, _data); }
24,712
10
// Throws if called by any account which is not authorized at a specific level. _level Level required /
modifier onlyAuthorizedAtLevel(uint _level) { require(authorized[msg.sender] == _level); _; }
modifier onlyAuthorizedAtLevel(uint _level) { require(authorized[msg.sender] == _level); _; }
24,528
19
// Gives notional value of the given vToken and vQuote amounts/protocol platform constants/poolId id of the rage trade pool/vTokenAmount amount of tokens/vQuoteAmount amount of base/ return notionalValue for the given token and vQuote amounts
function getNotionalValue( Protocol.Info storage protocol, uint32 poolId, int256 vTokenAmount, int256 vQuoteAmount
function getNotionalValue( Protocol.Info storage protocol, uint32 poolId, int256 vTokenAmount, int256 vQuoteAmount
42,756
53
// Player has won a two Ether icon prize!
profit = SafeMath.div(SafeMath.mul(spin.tokenValue, 375),100); category = 16; emit TwoEtherIcons(target, spin.blockn);
profit = SafeMath.div(SafeMath.mul(spin.tokenValue, 375),100); category = 16; emit TwoEtherIcons(target, spin.blockn);
1,798
110
// return Current flash mint fee percentage.
function flashMintFeePercentage() external view returns (uint256);
function flashMintFeePercentage() external view returns (uint256);
17,687
3
// Parameters can be hashed! The new law is added to {Lois} mapping and to {List_Lois} array./
function AddLaw(bytes memory Title, bytes memory Description) external Register_Authorities_Only { require(Lois[Title].Timestamp == 0, "Loi: Title already existing"); List_Lois.push(Title); Lois[Title].Index = List_Lois.length - 1; Lois[Title].Description = Description; ...
function AddLaw(bytes memory Title, bytes memory Description) external Register_Authorities_Only { require(Lois[Title].Timestamp == 0, "Loi: Title already existing"); List_Lois.push(Title); Lois[Title].Index = List_Lois.length - 1; Lois[Title].Description = Description; ...
30,612
498
// Note contract owner is meant to be a governance contract allowing ENCORE governance consensus
uint16 public DEV_FEE;
uint16 public DEV_FEE;
14,431
107
// stake some LP tokens_amount some amount of LP tokens, requires enought allowance from LP token smart contract_locked the locking period; option: 0, 30 days (2592000), 90 days (7776000), 180 days (15552000), 360 days (31104000)
function stake(uint256 _amount, uint256 _locked) public whenNotPaused{ createStake(msg.sender, _amount, _locked); }
function stake(uint256 _amount, uint256 _locked) public whenNotPaused{ createStake(msg.sender, _amount, _locked); }
6,361
16
// Withdraw without caring about progress. EMERGENCY ONLY.
function emergencyWithdraw() external onlyOwner nonReentrant { uint256 tokenBalance = token.balanceOf(address(this)); if (tokenBalance > 0) { token.transfer(msg.sender, tokenBalance); } }
function emergencyWithdraw() external onlyOwner nonReentrant { uint256 tokenBalance = token.balanceOf(address(this)); if (tokenBalance > 0) { token.transfer(msg.sender, tokenBalance); } }
3,765
7
// get the number of token being hold by _owner
uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) {
uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) {
22,906
31
// View amount staked and rewards for a user. _stakerAddress for which to calculated rewards. return _tokensStaked Amount of tokens staked. return _rewardsAvailable reward amount. /
function getStakeInfo(address _staker) external view virtual returns (uint256 _tokensStaked, uint256 _rewards) { _tokensStaked = stakers[_staker].amountStaked; _rewards = _availableRewards(_staker); }
function getStakeInfo(address _staker) external view virtual returns (uint256 _tokensStaked, uint256 _rewards) { _tokensStaked = stakers[_staker].amountStaked; _rewards = _availableRewards(_staker); }
14,770
156
// Curve stuff
address public want = 0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490; address public gauge = 0xbFcF63294aD7105dEa65aA58F8AE5BE2D9d0952A;
address public want = 0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490; address public gauge = 0xbFcF63294aD7105dEa65aA58F8AE5BE2D9d0952A;
40,734
258
// Withdraw without caring about rewards. EMERGENCY ONLY. This has the same 25% fee as same block withdrawals to prevent abuse of thisfunction.
function emergencyWithdraw(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; //reordered from Sushi function to prevent risk of reentrancy uint256 amountToSend = user.amount.mul(75).div(100); uint256 devToSend =...
function emergencyWithdraw(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; //reordered from Sushi function to prevent risk of reentrancy uint256 amountToSend = user.amount.mul(75).div(100); uint256 devToSend =...
41,015
18
// transfer Plutus token to admin
if(swapFee > 0) { require(alturaToken.transferFrom(msg.sender, feeAddress, plutusAmount.mul(swapFee).div(PERCENTS_DIVIDER)), "failed to transfer admin fee"); }
if(swapFee > 0) { require(alturaToken.transferFrom(msg.sender, feeAddress, plutusAmount.mul(swapFee).div(PERCENTS_DIVIDER)), "failed to transfer admin fee"); }
10,104
290
// Part 1
uint txDataOffset = OFFSET_TO_TRANSACTIONS + txIdx * ExchangeData.TX_DATA_AVAILABILITY_SIZE_PART_1(); assembly { mstore(add(txData, 32), mload(add(data, add(txDataOffset, 32)))) }
uint txDataOffset = OFFSET_TO_TRANSACTIONS + txIdx * ExchangeData.TX_DATA_AVAILABILITY_SIZE_PART_1(); assembly { mstore(add(txData, 32), mload(add(data, add(txDataOffset, 32)))) }
24,466
5
// retrieve digit manually for all 4 iterations
function getB0() public constant returns (byte) { return b0; }
function getB0() public constant returns (byte) { return b0; }
47,335
4
// Function to burn tokens _amount The amount of tokens to burn.return A boolean that indicates if the operation was successful. /
function burn(address _token, uint256 _amount) public override returns (bool)
function burn(address _token, uint256 _amount) public override returns (bool)
6,629
4
// [
// { // "inputs": [], // "name": "getMessage", // "outputs": [ // { // "internalType": "string", // "name": "", // "type": "string" // } // ], // "stateMutability": "view", // "type": "function" // }
// { // "inputs": [], // "name": "getMessage", // "outputs": [ // { // "internalType": "string", // "name": "", // "type": "string" // } // ], // "stateMutability": "view", // "type": "function" // }
11,554
4
// LinkedList Entry
struct LLEntry { // Timestamp when unlocked. Also serves as ID uint until; // Amount of locked tokens uint amount; // Previous LLEntry bytes32 prev; // Next LLEntry bytes32 next; }
struct LLEntry { // Timestamp when unlocked. Also serves as ID uint until; // Amount of locked tokens uint amount; // Previous LLEntry bytes32 prev; // Next LLEntry bytes32 next; }
11,722
19
// require(LibMeta.msgSender() == s.contractOwner, "ItemsFacet: Must be contract owner");
s.itemsBaseUri = _value; for (uint256 i; i < s.itemTypes.length; i++) { emit LibERC1155.URI(LibStrings.strWithUint(_value, i), i); }
s.itemsBaseUri = _value; for (uint256 i; i < s.itemTypes.length; i++) { emit LibERC1155.URI(LibStrings.strWithUint(_value, i), i); }
20,204
170
// verify that the protected liquidity is not removed on the same block in which it was added
require(liquidity.timestamp < time(), "ERR_TOO_EARLY"); if (_portion == PPM_RESOLUTION) {
require(liquidity.timestamp < time(), "ERR_TOO_EARLY"); if (_portion == PPM_RESOLUTION) {
14,068
480
// emit event
BootyGrabbed(msg.sender, booty);
BootyGrabbed(msg.sender, booty);
40,982
57
// transfers the `amount` of tokens from caller's accountto the `recipient` account. returns boolean value indicating the operation status. Emits a {Transfer} event /
function transfer(address recipient, uint256 amount) external;
function transfer(address recipient, uint256 amount) external;
81,977
39
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
5,452
12
// Update the variable feenewVariableFee_ new variable fee /
function updateVariableFee(uint128 newVariableFee_) external onlyGovernor { emit VariableFeeUpdated( msg.sender, variableFee, newVariableFee_, block.timestamp // solhint-disable-line not-rely-on-time ); variableFee = newVariableFee_; }
function updateVariableFee(uint128 newVariableFee_) external onlyGovernor { emit VariableFeeUpdated( msg.sender, variableFee, newVariableFee_, block.timestamp // solhint-disable-line not-rely-on-time ); variableFee = newVariableFee_; }
35,202
27
// ==================================================== Voting ====================================================/
* @dev See {IGovernor-hasVoted}. */ function hasVoted(uint256 proposalId, address account) public view virtual override returns (bool) { return _proposalDetails[proposalId].receipts[account].hasVoted; }
* @dev See {IGovernor-hasVoted}. */ function hasVoted(uint256 proposalId, address account) public view virtual override returns (bool) { return _proposalDetails[proposalId].receipts[account].hasVoted; }
37,514
9
// Require a valid price
require(_price > 0);
require(_price > 0);
26,367
266
// NOTE: getLiquidityTokenValue can rewrite fCash values in memory, however, that does not happen in this call because there are no fCash values in the nToken portfolio.
(int256 assetCashClaim, int256 pv) = AssetHandler.getLiquidityTokenValue( i, nToken.cashGroup, market, nToken.portfolioState.storedAssets, blockTime, ...
(int256 assetCashClaim, int256 pv) = AssetHandler.getLiquidityTokenValue( i, nToken.cashGroup, market, nToken.portfolioState.storedAssets, blockTime, ...
10,803