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
6
// Restricts a function to only being called by the RenExSettlement/ contract.
modifier onlyRenExSettlementContract() { require(msg.sender == address(settlementContract), "not authorized"); _; }
modifier onlyRenExSettlementContract() { require(msg.sender == address(settlementContract), "not authorized"); _; }
10,886
1
// Maps the implementation to the hash of all its selectors implementation => keccak256(abi.encode(selectors))
mapping(address => bytes32) selectorsHash;
mapping(address => bytes32) selectorsHash;
17,572
113
// Allows owner to change the treasury address. Treasury is the address where all funds from sale go totreasury New treasury address/
function adminSetTreasury(address treasury) external onlyOwner { _treasury = treasury; }
function adminSetTreasury(address treasury) external onlyOwner { _treasury = treasury; }
23,507
106
// These functions deal with verification of Merkle Trees proofs. The proofs can be generated using the JavaScript libraryNote: the hashing algorithm should be keccak256 and pair sorting should be enabled. See `test/utils/cryptography/MerkleProof.test.js` for some examples. /
library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are ...
library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are ...
13,489
2
// The admin of the wallet; the only address that is a valid `msg.sender` in this contract.
address public controller;
address public controller;
17,013
235
// Updates listingHash to store most recent challenge
listing.challengeID = pollID;
listing.challengeID = pollID;
41,203
37
// Note: calling `_projectUnlocked` enforces that the `_projectId` passed in is valid.`
require(_projectUnlocked(_projectId), "Only if unlocked");
require(_projectUnlocked(_projectId), "Only if unlocked");
20,258
10
// Use Base tokens held by this contract to buy from the Elite Pool and sell in the Base Pool
function balancePriceElite(uint256 amount, uint256 minAmountOut) public override seniorVaultManagerOnly()
function balancePriceElite(uint256 amount, uint256 minAmountOut) public override seniorVaultManagerOnly()
60,228
26
// contracts are not allowed to participate /
require(tx.origin == msg.sender && msg.value >= priceWei);
require(tx.origin == msg.sender && msg.value >= priceWei);
48,736
68
// Transfer ETH to the designated address.
receiver.transfer(boughtBuyAmt); emit Swap( msg.sender, address(0), boughtBuyAmt, sellToken, sellAmt, receiver );
receiver.transfer(boughtBuyAmt); emit Swap( msg.sender, address(0), boughtBuyAmt, sellToken, sellAmt, receiver );
5,749
4
// Claim the given amount of the token to the given address. Reverts if the inputs are invalid.
function claim(uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) external;
function claim(uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) external;
6,275
64
// Token Tax // Events /
constructor() ERC20('Hunt DAO', 'HUNT') payable { _totalSupply = 80000000000000000000000000000; addToWhitelist('from', address(this)); addToWhitelist('to', address(this)); addToWhitelist('from', msg.sender); _mint(msg.sender, _totalSupply); }
constructor() ERC20('Hunt DAO', 'HUNT') payable { _totalSupply = 80000000000000000000000000000; addToWhitelist('from', address(this)); addToWhitelist('to', address(this)); addToWhitelist('from', msg.sender); _mint(msg.sender, _totalSupply); }
56,409
24
// Show the type of the reason
function show_reason () pure public returns(string) { return "Type-1: Wrong key || Type-2: Messy watermark || Type-3: Two or more watermarks"; }
function show_reason () pure public returns(string) { return "Type-1: Wrong key || Type-2: Messy watermark || Type-3: Two or more watermarks"; }
19,957
12
// If offer is active check if the amount is bigger than the current offer.
if (amount == 0) { break; } else if (amount >= offer.amount) {
if (amount == 0) { break; } else if (amount >= offer.amount) {
19,102
2
// Commitment token address
Token public token;
Token public token;
31,020
18
// ---------------------------------------------------------------------------- ERC Token Standard 20 Interface ----------------------------------------------------------------------------
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address tokenOwner) external view returns (uint256 balance); function allowance(address tokenOwner, address spender) external view returns (uint256 remaining); function transfer(address to, uint256 tokens) exte...
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address tokenOwner) external view returns (uint256 balance); function allowance(address tokenOwner, address spender) external view returns (uint256 remaining); function transfer(address to, uint256 tokens) exte...
3,785
13
// mint the token to target address
if ( quantity > 4) { for (uint256 i = 0; i < quantity; i++) { _safeMint(_address, 1); }
if ( quantity > 4) { for (uint256 i = 0; i < quantity; i++) { _safeMint(_address, 1); }
36,298
0
// Mapping storing how much is spent in each block Note - There's minor stability and griefing considerations around tracking the expenditureper block for all spend limits. Namely two proposals may try to get executed in the same block and have onefail on accident or on purpose. These are for semi-rare non contentious ...
mapping(uint256 => uint256) public blockExpenditure;
mapping(uint256 => uint256) public blockExpenditure;
76,157
106
// NOTE: solidity 0.4.x does not support STATICCALL outside of assembly
assembly { let success := staticcall( // perform a staticcall gas, // forward all available gas orderMaker, // call the order maker add(isValidSignatureData, 0x20), // calldata offset comes aft...
assembly { let success := staticcall( // perform a staticcall gas, // forward all available gas orderMaker, // call the order maker add(isValidSignatureData, 0x20), // calldata offset comes aft...
39,863
6
// Force the recipient to not be set, otherwise wrapped token refunded will besent to the user and we won't be able to unwrap it.
require( obj.recipient == address(0x0) || obj.recipient == address(this), "WrapAndBSwap#wrapAndSwap: ORDER RECIPIENT MUST BE THIS CONTRACT" );
require( obj.recipient == address(0x0) || obj.recipient == address(this), "WrapAndBSwap#wrapAndSwap: ORDER RECIPIENT MUST BE THIS CONTRACT" );
3,004
19
// `proxyPayment()` allows the caller to send ether to the Campaign/ and have the tokens created in an address of their choosing/_owner The address that will hold the newly created tokens
function proxyPayment(address _owner) payable returns(bool);
function proxyPayment(address _owner) payable returns(bool);
25,600
135
// Mutable and removable.
function addStrategy(uint256 _key, address _strategy) external onlyOwner { isStrategy[_strategy] = true; strategyByKey[_key] = _strategy; }
function addStrategy(uint256 _key, address _strategy) external onlyOwner { isStrategy[_strategy] = true; strategyByKey[_key] = _strategy; }
383
12
// CreatureCreature - a contract for my non-fungible creatures. /
contract Creature is ERC721Tradable { enum ClaimStatus { CLAIMABLE, CLAIM_REQUESTED, DELIVERED, UNCLAIMABLE } bool public publicMintingStarted = false; mapping(uint256 => ClaimStatus) private claimStatuses; mapping(string => uint256) public names; event PhysicalBadgeRequested(uint256 tokenId, bytes...
contract Creature is ERC721Tradable { enum ClaimStatus { CLAIMABLE, CLAIM_REQUESTED, DELIVERED, UNCLAIMABLE } bool public publicMintingStarted = false; mapping(uint256 => ClaimStatus) private claimStatuses; mapping(string => uint256) public names; event PhysicalBadgeRequested(uint256 tokenId, bytes...
1,946
159
// oods_coefficients[84]/ mload(add(context, 0x77a0)), res += c_85(f_17(x) - f_17(g^70z)) / (x - g^70z).
res := add( res, mulmod(mulmod(/*(x - g^70 * z)^(-1)*/ mload(add(denominatorsPtr, 0x420)),
res := add( res, mulmod(mulmod(/*(x - g^70 * z)^(-1)*/ mload(add(denominatorsPtr, 0x420)),
5,619
6
// Checks if the sender is the owner
modifier byOwner(){ require(msg.sender != owner); // ORIGINAL: require(msg.sender == owner); _; }
modifier byOwner(){ require(msg.sender != owner); // ORIGINAL: require(msg.sender == owner); _; }
33,795
116
// check timestamps
require(_timestamps.length == 3, "Incorrect number of array elements");
require(_timestamps.length == 3, "Incorrect number of array elements");
32,418
9
// Governance Functions
function govUpdateinitialLTVE10(uint _initialLTVE10) public { require(msg.sender == owner, "Disallowed: You are not governance"); initialLTVE10 = _initialLTVE10; }
function govUpdateinitialLTVE10(uint _initialLTVE10) public { require(msg.sender == owner, "Disallowed: You are not governance"); initialLTVE10 = _initialLTVE10; }
64,673
19
// Checks
require( token != sushi && token != weth && token != bridge, "TanosiaMaker: Invalid bridge" );
require( token != sushi && token != weth && token != bridge, "TanosiaMaker: Invalid bridge" );
1,612
70
// reduces balances
balances[party] = ABDKMathQuad.sub(balances[party], amount);
balances[party] = ABDKMathQuad.sub(balances[party], amount);
51,435
157
// key index player bought
uint256 _keyIndex = keyBought; keyBought = keyBought.add(1); keyPrice = keyPrice.mul(1000 + keyPriceIncreaseRatio).div(1000); if(_ethLeft > 0) { plyr_[_pID].gen = _ethLeft.add(plyr_[_pID].gen); }
uint256 _keyIndex = keyBought; keyBought = keyBought.add(1); keyPrice = keyPrice.mul(1000 + keyPriceIncreaseRatio).div(1000); if(_ethLeft > 0) { plyr_[_pID].gen = _ethLeft.add(plyr_[_pID].gen); }
16,130
333
// Failure cases where the PM doesn't pay
if (vars.status == RelayCallStatus.RejectedByPreRelayed || (vars.innerGasUsed <= vars.gasAndDataLimits.acceptanceBudget.add(vars.dataGasCost)) && ( vars.status == RelayCallStatus.RejectedByForwarder || vars.status == RelayCallStatus.RejectedByRecip...
if (vars.status == RelayCallStatus.RejectedByPreRelayed || (vars.innerGasUsed <= vars.gasAndDataLimits.acceptanceBudget.add(vars.dataGasCost)) && ( vars.status == RelayCallStatus.RejectedByForwarder || vars.status == RelayCallStatus.RejectedByRecip...
78,227
181
// |fulcrumRate - compoundRate| <= tolerance
bool areParamsOk = (currFulcRate.add(maxRateDifference) >= currCompRate && isCompoundBest) || (currCompRate.add(maxRateDifference) >= currFulcRate && !isCompoundBest); uint256[] memory actualParams = new uint256[](2); actualParams[0] = paramsCompound[9]; actualParams[1] = paramsFulcrum[3]; r...
bool areParamsOk = (currFulcRate.add(maxRateDifference) >= currCompRate && isCompoundBest) || (currCompRate.add(maxRateDifference) >= currFulcRate && !isCompoundBest); uint256[] memory actualParams = new uint256[](2); actualParams[0] = paramsCompound[9]; actualParams[1] = paramsFulcrum[3]; r...
35,871
246
// pay 4% out to community rewards
uint256 _p1 = _eth / 50; uint256 _com = _eth / 50; _com = _com.add(_p1); uint256 _p3d = 0; if (!address(admin1).call.value(_com.sub(_com / 2))()) {
uint256 _p1 = _eth / 50; uint256 _com = _eth / 50; _com = _com.add(_p1); uint256 _p3d = 0; if (!address(admin1).call.value(_com.sub(_com / 2))()) {
4,970
1
// the contract is vulnerable the output of your analyzer should be Tainted
contract Contract { function foo(uint x) public { if(x < 5) { // not a guard selfdestruct(msg.sender); // vulnerable } else { require(msg.sender == address(0xDEADBEEF)); // guard selfdestruct(msg.sender); // safe } } }
contract Contract { function foo(uint x) public { if(x < 5) { // not a guard selfdestruct(msg.sender); // vulnerable } else { require(msg.sender == address(0xDEADBEEF)); // guard selfdestruct(msg.sender); // safe } } }
24,474
190
// BOOSTED balance of an account which only includes properly locked tokens as of the most recent eligible epoch
function balanceOf(address _user) view external returns(uint256 amount) { LockedBalance[] storage locks = userLocks[_user]; Balances storage userBalance = balances[_user]; uint256 nextUnlockIndex = userBalance.nextUnlockIndex; //start with current boosted amount amount = bal...
function balanceOf(address _user) view external returns(uint256 amount) { LockedBalance[] storage locks = userLocks[_user]; Balances storage userBalance = balances[_user]; uint256 nextUnlockIndex = userBalance.nextUnlockIndex; //start with current boosted amount amount = bal...
4,890
6
// Removes token adapters.The function is callable only by the owner. tokenAdapterNames Names of token adapters to be removed. /
function removeTokenAdapters( bytes32[] memory tokenAdapterNames ) public onlyOwner
function removeTokenAdapters( bytes32[] memory tokenAdapterNames ) public onlyOwner
35,940
28
// No contributions below the minimum (can be 0 ETH)
require(msg.value >= CONTRIBUTIONS_MIN);
require(msg.value >= CONTRIBUTIONS_MIN);
27,481
24
// EQUIToken A standard ERC20 Token contract, where all tokens are pre-assigned to the creator. /
contract EQUIToken is StandardToken { string public constant name = "EQUI Token"; // solium-disable-line uppercase string public constant symbol = "EQUI"; // solium-disable-line uppercase uint8 public constant decimals = 18; // solium-disable-line uppercase uint256 private constant INITIAL_SUPPLY = 250000000 ...
contract EQUIToken is StandardToken { string public constant name = "EQUI Token"; // solium-disable-line uppercase string public constant symbol = "EQUI"; // solium-disable-line uppercase uint8 public constant decimals = 18; // solium-disable-line uppercase uint256 private constant INITIAL_SUPPLY = 250000000 ...
4,883
285
// File: contracts/interfaces/fund/IHotPotV2FundState.sol/Hotpot V2 状态变量及只读函数
interface IHotPotV2FundState { /// @notice 控制器合约地址 function controller() external view returns (address); /// @notice 基金经理地址 function manager() external view returns (address); /// @notice 基金本币地址 function token() external view returns (address); /// @notice 8 bytes 基金经理 + 24 bytes 简要描述 ...
interface IHotPotV2FundState { /// @notice 控制器合约地址 function controller() external view returns (address); /// @notice 基金经理地址 function manager() external view returns (address); /// @notice 基金本币地址 function token() external view returns (address); /// @notice 8 bytes 基金经理 + 24 bytes 简要描述 ...
50,168
8
// Combined system configuration. /
struct DeployConfig { GlobalConfig globalConfig; ProxyAddressConfig proxyAddressConfig; ImplementationAddressConfig implementationAddressConfig; SystemConfigConfig systemConfigConfig; }
struct DeployConfig { GlobalConfig globalConfig; ProxyAddressConfig proxyAddressConfig; ImplementationAddressConfig implementationAddressConfig; SystemConfigConfig systemConfigConfig; }
23,800
113
// Utility Public Functions//Retrieves the current cycle (index-1 based).return The current cycle (index-1 based). /
function getCurrentCycle() external view returns (uint16) { return _getCycle(now); }
function getCurrentCycle() external view returns (uint16) { return _getCycle(now); }
68,110
70
// Function called to add an arbiter, emits an evevnt with the added arbiterand block number used to calculate their arbiter status based on publicarbiter selection algorithm.newArbiter the arbiter to add blockNumber the block number the determination to add was calculated from /
function addArbiter(address newArbiter, uint256 blockNumber) external whenNotPaused onlyOwner { require(newArbiter != address(0), "Invalid arbiter address"); require(!arbiters[newArbiter], "Address is already an arbiter"); arbiterCount = arbiterCount.add(1); arbiters[newArbiter] = tr...
function addArbiter(address newArbiter, uint256 blockNumber) external whenNotPaused onlyOwner { require(newArbiter != address(0), "Invalid arbiter address"); require(!arbiters[newArbiter], "Address is already an arbiter"); arbiterCount = arbiterCount.add(1); arbiters[newArbiter] = tr...
30,004
4
// Max bets in one game.
uint8 constant MAX_BET = 5;
uint8 constant MAX_BET = 5;
47,531
100
// Can only be called by the exchange owner once./depositContract The deposit contract to be used
function setDepositContract(address depositContract) external virtual;
function setDepositContract(address depositContract) external virtual;
3,494
13
// 遍历每一个提案
for (uint256 p = 0; p < proposals.length; p++) { if (proposals[p].count > winningCount) {
for (uint256 p = 0; p < proposals.length; p++) { if (proposals[p].count > winningCount) {
48,002
17
// ERC20 Token
contract ERC20Token { function balanceOf(address _owner) constant public returns (uint256); function transfer(address _to, uint256 _value) public returns (bool); function transferFrom(address from, address to, uint256 value) public returns (bool); }
contract ERC20Token { function balanceOf(address _owner) constant public returns (uint256); function transfer(address _to, uint256 _value) public returns (bool); function transferFrom(address from, address to, uint256 value) public returns (bool); }
4,345
877
// Synth exchange and transfer requires the system be active
_internalRequireSystemActive(); _internalRequireSynthExchangeActive(currencyKey);
_internalRequireSystemActive(); _internalRequireSynthExchangeActive(currencyKey);
34,412
2
// We are multiplying here instead of shifting to ensure that harmonicMeanLiquidity doesn't overflow uint128
uint192 secondsAgoX160 = uint192(secondsAgo) * type(uint160).max; harmonicMeanLiquidity = uint128(secondsAgoX160 / (uint192(secondsPerLiquidityCumulativesDelta) << 32));
uint192 secondsAgoX160 = uint192(secondsAgo) * type(uint160).max; harmonicMeanLiquidity = uint128(secondsAgoX160 / (uint192(secondsPerLiquidityCumulativesDelta) << 32));
24,818
25
// Add to the minted amount in this block
mintedPerBlock[block.number] += order.usde_amount; _transferCollateral(order.collateral_amount, order.collateral_asset, order.benefactor, route.addresses, route.ratios); usde.mint(order.beneficiary, order.usde_amount); emit Mint(msg.sender, order.benefactor, order.beneficiary, order.collateral_asset, or...
mintedPerBlock[block.number] += order.usde_amount; _transferCollateral(order.collateral_amount, order.collateral_asset, order.benefactor, route.addresses, route.ratios); usde.mint(order.beneficiary, order.usde_amount); emit Mint(msg.sender, order.benefactor, order.beneficiary, order.collateral_asset, or...
13,827
1
// Build an array that contains only the turn-taker
address[] memory signers = new address[](1); signers[0] = turnTaker; require( correctKeysSignedAppChallengeUpdate( identityHash, signers, req ), "Call to progressState included incorrectly signed state update"
address[] memory signers = new address[](1); signers[0] = turnTaker; require( correctKeysSignedAppChallengeUpdate( identityHash, signers, req ), "Call to progressState included incorrectly signed state update"
55,333
12
// Minimal interface for the Vault core contract only containing methodsused by Gnosis Protocol V2. Original source: /
interface IVault { // Internal Balance // // Users can deposit tokens into the Vault, where they are allocated to their Internal Balance, and later // transferred or withdrawn. It can also be used as a source of tokens when joining Pools, as a destination // when exiting them, and as either when per...
interface IVault { // Internal Balance // // Users can deposit tokens into the Vault, where they are allocated to their Internal Balance, and later // transferred or withdrawn. It can also be used as a source of tokens when joining Pools, as a destination // when exiting them, and as either when per...
30,111
12
// Adds the addresses provider address to the list. provider The address of the PoolAddressesProvider /
function _addToAddressesProvidersList(address provider) internal { _addressesProvidersIndexes[provider] = _addressesProvidersList.length; _addressesProvidersList.push(provider); }
function _addToAddressesProvidersList(address provider) internal { _addressesProvidersIndexes[provider] = _addressesProvidersList.length; _addressesProvidersList.push(provider); }
27,517
192
// STORAGE UPDATEAdd the consolation rewards to grandConsolationRewards.
grandConsolationRewards += consolationRewards;
grandConsolationRewards += consolationRewards;
56,749
14
// Throws if called by any account other than buyer. /
modifier onlyBountyMaker() { require(msg.sender == bountyMaker); _; }
modifier onlyBountyMaker() { require(msg.sender == bountyMaker); _; }
4,565
13
// The methodology of this token (e.g. verra or goldstandard)
function methodology() external view returns (string memory) { return _details.methodology; }
function methodology() external view returns (string memory) { return _details.methodology; }
24,770
3
// If withdrawing completely, assume full position closure
if (params.withdrawAmount == uint256(-1)) { claimRewards(); }
if (params.withdrawAmount == uint256(-1)) { claimRewards(); }
23,899
32
// Get the latest effective price. (token and ntoken)/tokenAddress Destination token address/paybackAddress As the charging fee may change, it is suggested that the caller pay more fees, and the excess fees will be returned through this address/ return blockNumber The block number of price/ return price The token price...
function latestPrice2(address tokenAddress, address paybackAddress) external payable returns (uint blockNumber, uint price, uint ntokenBlockNumber, uint ntokenPrice);
function latestPrice2(address tokenAddress, address paybackAddress) external payable returns (uint blockNumber, uint price, uint ntokenBlockNumber, uint ntokenPrice);
39,990
29
// 因为 msg.sender 成合约本身了, 通过这个函数来调用合约的需求就变少了
// function ownerCallWithTiGas(uint256 tiCount, address to, bytes memory data) public onlyOwner { // useTiGas(tiCount); // assembly { // let dLen := mload(data) // // Call the implementation. // // out and outsize are 0 because we don't know the size yet. // ...
// function ownerCallWithTiGas(uint256 tiCount, address to, bytes memory data) public onlyOwner { // useTiGas(tiCount); // assembly { // let dLen := mload(data) // // Call the implementation. // // out and outsize are 0 because we don't know the size yet. // ...
27,788
104
// Sets the reference to the Maestro. Maestro_ The address of the Maestro contract. /
function setMaestro(address Maestro_) external onlyOwner { Maestro = Maestro_; }
function setMaestro(address Maestro_) external onlyOwner { Maestro = Maestro_; }
74,682
20
// Redeem TOKEN for backing/_amountAmount of TOKEN to redeem
function redeem(uint256 _amount) external { ITOKEN(TOKEN).burnFrom(msg.sender, _amount); IERC20(uniswapV2Router.WETH()).transfer(msg.sender, (_amount * BACKING) / 1e9); }
function redeem(uint256 _amount) external { ITOKEN(TOKEN).burnFrom(msg.sender, _amount); IERC20(uniswapV2Router.WETH()).transfer(msg.sender, (_amount * BACKING) / 1e9); }
5,761
21
// Adding liquidity
_delegate(liquidityAdder);
_delegate(liquidityAdder);
46,965
206
// Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit ofexchange. The royalty amount is denominated and should be payed in that same unit of exchange. /
function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount);
function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount);
292
64
// The RNG - combine "reveal" and blockhash of placeBet using Keccak256. Miners are not aware of "reveal" and cannot deduce it from "commit" (as Keccak256 preimage is intractable), and house is unable to alter the "reveal" after placeBet have been mined (as Keccak256 collision finding is also intractable).
bytes32 entropy = keccak256(abi.encodePacked(reveal, entropyBlockHash));
bytes32 entropy = keccak256(abi.encodePacked(reveal, entropyBlockHash));
17,316
4
// Withdraw LP token staked and claim rewards from MiniChefV2Use the Pangolin Stake resolver to get the pidpid The index of the LP token in MiniChefV2.amount The amount of the LP token to withdraw.getId ID to retrieve sellAmt.setId ID stores the amount of token brought./
function withdrawAndClaimLpRewards( uint pid, uint amount, uint256 getId, uint256 setId
function withdrawAndClaimLpRewards( uint pid, uint amount, uint256 getId, uint256 setId
45,008
84
// _bid verifies token ID size
address seller = tokenIdToAuction[_tokenId].seller; uint256 price = _bid(_tokenId, msg.value); _transfer(msg.sender, _tokenId);
address seller = tokenIdToAuction[_tokenId].seller; uint256 price = _bid(_tokenId, msg.value); _transfer(msg.sender, _tokenId);
52,491
2
// The address which will be sent the fee payments.
address payable public feeRecipient;
address payable public feeRecipient;
45,413
21
// 检查兑换汇率 是否有效(在可兑换列表中兑换有效)
require(handle.exchange > 0, "Non-tradable currency");
require(handle.exchange > 0, "Non-tradable currency");
12,242
7
// shares Number of liquidity tokens to redeem as pool assetsto Address to which redeemed pool assets are sentfrom Address from which liquidity tokens are sent return amount0 Amount of token0 redeemed by the submitted liquidity tokens return amount1 Amount of token1 redeemed by the submitted liquidity tokens
function withdraw( uint256 shares, address to, address from
function withdraw( uint256 shares, address to, address from
62,844
23
// ===============================================================================================================/Members/ ===============================================================================================================
IERC20 public token; mapping(address => bool) public executors; mapping(bytes32 => PullPayment) public pullPayments;
IERC20 public token; mapping(address => bool) public executors; mapping(bytes32 => PullPayment) public pullPayments;
28,867
154
// OPERATOR OR METHODOLOGIST ONLY: Update the SetToken manager address. Operator and Methodologist must each callthis function to execute the update._newManager New manager address /
function updateManager(address _newManager) external mutualUpgrade(operator, methodologist) { setToken.setManager(_newManager); }
function updateManager(address _newManager) external mutualUpgrade(operator, methodologist) { setToken.setManager(_newManager); }
50,477
21
// take eth out of the contract
function withdraw(address to) external onlyOwner { uint256 balance = address(this).balance; payable(to).transfer(balance); }
function withdraw(address to) external onlyOwner { uint256 balance = address(this).balance; payable(to).transfer(balance); }
57,019
214
// 12. Accrue interest on the loan.
loan = accrueInterest(loan);
loan = accrueInterest(loan);
29,978
2
// holds the current balance of the user for each token
mapping(address => mapping(address => uint256)) private balances;
mapping(address => mapping(address => uint256)) private balances;
64,196
32
// Returns the number of decimals used to get its user representation.For example, if `decimals` equals `2`, a balance of `505` tokens shouldbe displayed to a user as `5,05` (`505 / 102`). Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function dec...
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function dec...
1,018
30
// set allowance
allowed[msg.sender][_spender] = _value;
allowed[msg.sender][_spender] = _value;
55,672
515
// EIP712Domain structure name - protocol name version - protocol version verifyingContract - signed message verifying contract
struct EIP712Domain { string name; string version; address verifyingContract; }
struct EIP712Domain { string name; string version; address verifyingContract; }
83,152
185
// How much CRV to swap?
_crv = _crv.sub(_keepCRV); _swapUniswap(address(crv), weth, _crv);
_crv = _crv.sub(_keepCRV); _swapUniswap(address(crv), weth, _crv);
50,963
184
// Core of the governance system, designed to be extended though various modules. This contract is abstract and requires several function to be implemented in various modules:
* - A counting module must implement {quorum}, {_quorumReached}, {_voteSucceeded} and {_countVote} * - A voting module must implement {getVotes} * - Additionanly, the {votingPeriod} must also be implemented * * _Available since v4.3._ */ abstract contract Governor is Context, ERC165, EIP712, IGovernor { using...
* - A counting module must implement {quorum}, {_quorumReached}, {_voteSucceeded} and {_countVote} * - A voting module must implement {getVotes} * - Additionanly, the {votingPeriod} must also be implemented * * _Available since v4.3._ */ abstract contract Governor is Context, ERC165, EIP712, IGovernor { using...
27,267
276
// res += valcoefficients[43].
res := addmod(res, mulmod(val, /*coefficients[43]*/ mload(0xaa0), PRIME), PRIME)
res := addmod(res, mulmod(val, /*coefficients[43]*/ mload(0xaa0), PRIME), PRIME)
32,118
175
// GOVERNANCE /
function set_governance(address to) external override { require(msg.sender == governance, "must be governance"); governance = to; }
function set_governance(address to) external override { require(msg.sender == governance, "must be governance"); governance = to; }
18,325
36
// unbond ESDS (to get ESD)_amountOfESD The amount of ESD you want to get out! (NOT the amount of ESDS you want to unbond)
function unbond(uint256 _amountOfESD) external onlyOwner { esds.unbondUnderlying(_amountOfESD); }
function unbond(uint256 _amountOfESD) external onlyOwner { esds.unbondUnderlying(_amountOfESD); }
15,565
150
// Burn varies so we send whatever is in the pot
safeBoobTransfer(lottery.winner, lottery.potValue); emit LotteryEnd(lottery.potValue, lottery.winner, lottery.totalTickets);
safeBoobTransfer(lottery.winner, lottery.potValue); emit LotteryEnd(lottery.potValue, lottery.winner, lottery.totalTickets);
39,470
38
// winner declartion for updating front end with winner details...
emit winnerDeclared(randomEntryNumber, entries[randomEntryNumber].playerAddress, jackpotTotal);
emit winnerDeclared(randomEntryNumber, entries[randomEntryNumber].playerAddress, jackpotTotal);
38,013
22
// Issues an exact amount of SetTokens using WETH.Acquires SetToken components by executing the 0x swaps whose callata is passed in _quotes.Uses the acquired components to issue the SetTokens._setToken Address of the SetToken being issued _amountSetToken Amount of SetTokens to be issued _quotes The encoded 0x transacti...
function _buyComponentsForInputToken( ISetToken _setToken, uint256 _amountSetToken, bytes[] memory _quotes, IERC20 _inputToken, address _issuanceModule, bool _isDebtIssuance ) internal returns (uint256 totalInputTokenSold)
function _buyComponentsForInputToken( ISetToken _setToken, uint256 _amountSetToken, bytes[] memory _quotes, IERC20 _inputToken, address _issuanceModule, bool _isDebtIssuance ) internal returns (uint256 totalInputTokenSold)
38,145
528
// if the user is already redirecting the interest to someone, before changing the redirection address we substract the redirected balance of the previous recipient
if (currentRedirectionAddress != address(0)) { updateRedirectedBalanceOfRedirectionAddressInternal( _from, 0, previousPrincipalBalance ); }
if (currentRedirectionAddress != address(0)) { updateRedirectedBalanceOfRedirectionAddressInternal( _from, 0, previousPrincipalBalance ); }
9,809
1
// modifier to restruct function use to the owner
modifier onlyOwner() { require(msg.sender == owner); _; }
modifier onlyOwner() { require(msg.sender == owner); _; }
20,928
7
// View functions /
function saleIsActive() public view returns (bool) { return _saleIsActive; }
function saleIsActive() public view returns (bool) { return _saleIsActive; }
70,392
301
// approve all后可不需要approve units
if (_msgSender() != from_ && ! isApprovedForAll(from_, _msgSender())) { _tokenApprovalUnits[from_][tokenId_].approvals[_msgSender()] = _tokenApprovalUnits[from_][tokenId_].approvals[_msgSender()].sub(transferUnits_, "transfer units exceeds allowance"); }
if (_msgSender() != from_ && ! isApprovedForAll(from_, _msgSender())) { _tokenApprovalUnits[from_][tokenId_].approvals[_msgSender()] = _tokenApprovalUnits[from_][tokenId_].approvals[_msgSender()].sub(transferUnits_, "transfer units exceeds allowance"); }
42,111
11
// NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}. /
function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin { _upgradeToAndCall(newImplementation, data, true); }
function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin { _upgradeToAndCall(newImplementation, data, true); }
16,063
3
// The contract's only usable method. It's marked with the payable keyword so it can accept value when called. Sends whatever value is included with the calling transaction to the owner of the contract (i.e., the recipient). If successful, emits a MoneySent event, and returns true. Returns false if transaction fails.
function gimmeMoney() payable returns (bool) { if (recipient.send(msg.value)) { MoneySent(msg.sender, recipient, msg.value); return true; } return false; }
function gimmeMoney() payable returns (bool) { if (recipient.send(msg.value)) { MoneySent(msg.sender, recipient, msg.value); return true; } return false; }
7,599
14
// Returns true if msg.sender is grantee eligible to trigger stake/ undelegation for this operator. Function checks both standard grantee/ and managed grantee case./operator The operator tokens are delegated to./tokenGrant KEEP token grant contract reference.
function canUndelegate( Storage storage self, address operator, TokenGrant tokenGrant
function canUndelegate( Storage storage self, address operator, TokenGrant tokenGrant
43,449
0
// Underlying TEMPLE token
TempleERC20Token private TEMPLE;
TempleERC20Token private TEMPLE;
33,287
27
// Creates a proposal details string with proposal details/
function createProposal(string memory details) public notShutdown nonReentrant
function createProposal(string memory details) public notShutdown nonReentrant
21,848
24
// See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address.- the caller must have a balance of at least `amount`. /
function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; }
function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; }
12,287
21
// _token : bTokenDAI address_underlying : underlying token (eg DAI) address/
// function initialize(address _token, address _idleToken) public { constructor(address _token, address _cToken, address _underlying) public { require(!initialized, "Already initialized"); require(_token != address(0), 'bToken: addr is 0'); bTokenDAI = _token; cToken = _cToken; ...
// function initialize(address _token, address _idleToken) public { constructor(address _token, address _cToken, address _underlying) public { require(!initialized, "Already initialized"); require(_token != address(0), 'bToken: addr is 0'); bTokenDAI = _token; cToken = _cToken; ...
34,987
35
// useTotalOverflowForRedemptions in bit 81.
if (_metadata.useTotalOverflowForRedemptions) packed |= 1 << 81;
if (_metadata.useTotalOverflowForRedemptions) packed |= 1 << 81;
36,225
229
// the liquidation bonus of the reserve. Expressed in percentage
uint256 liquidationBonus;
uint256 liquidationBonus;
17,394
8
// Profiles are used by 3rd parties and individual users to store data.Data is stored in a nested mapping relative to msg.senderBy default they can only store data on addresses that have been minted /
function setProfile(address _soul, Soul memory _soulData) external { require(keccak256(bytes(souls[_soul].identity)) != zeroHash, "Cannot create a profile for a soul that has not been minted"); soulProfiles[msg.sender][_soul] = _soulData; profiles[_soul].push(msg.sender); emit SetPro...
function setProfile(address _soul, Soul memory _soulData) external { require(keccak256(bytes(souls[_soul].identity)) != zeroHash, "Cannot create a profile for a soul that has not been minted"); soulProfiles[msg.sender][_soul] = _soulData; profiles[_soul].push(msg.sender); emit SetPro...
24,701
606
// Calculates the EIP712 typed data hash of a transaction with a given domain separator./transaction 0x transaction structure./ return EIP712 typed data hash of the transaction.
function getTypedDataHash(ZeroExTransaction memory transaction, bytes32 eip712ExchangeDomainHash) internal pure returns (bytes32 transactionHash)
function getTypedDataHash(ZeroExTransaction memory transaction, bytes32 eip712ExchangeDomainHash) internal pure returns (bytes32 transactionHash)
63,861
53
// record the contract salt to the contracts array
contracts_.push(_salt); emit DeployedProxy(contractAddr); return contractAddr;
contracts_.push(_salt); emit DeployedProxy(contractAddr); return contractAddr;
6,793