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
122
// check to see if any _src tokens are left over after exchange
tokensLeft = getBalance(_exData.srcAddr);
tokensLeft = getBalance(_exData.srcAddr);
2,312
0
// ERC20 Token under lockable functionality/
HiblocksToken private _token;
HiblocksToken private _token;
45,006
29
// A generic interface for a contract which properly accepts ERC721 tokens./SolDAO (https:github.com/Sol-DAO/solbase/blob/main/src/tokens/ERC721.sol)/Modified from Solmate (https:github.com/transmissions11/solmate/blob/main/src/tokens/ERC721.sol)
abstract contract ERC721TokenReceiver { function onERC721Received(address, address, uint256, bytes calldata) external virtual returns (bytes4) { return ERC721TokenReceiver.onERC721Received.selector; } }
abstract contract ERC721TokenReceiver { function onERC721Received(address, address, uint256, bytes calldata) external virtual returns (bytes4) { return ERC721TokenReceiver.onERC721Received.selector; } }
22,019
97
// @solidity memory-safe-assembly
assembly { ptr := add(buffer, add(32, length)) }
assembly { ptr := add(buffer, add(32, length)) }
460
22
// Mapping gift type to gift limit.
mapping(uint256 => uint256) private giftTypeToGiftLimit;
mapping(uint256 => uint256) private giftTypeToGiftLimit;
35,423
10
// Pull `quoteToken` from the caller amount The requested amount to repay /
function repayQuoteToken(uint256 amount) external onlyElevatedAccess { emit RepayToken(address(quoteToken), amount); quoteToken.safeTransferFrom(msg.sender, address(this), amount); treasuryReservesVault.repay(quoteToken, amount, address(this)); }
function repayQuoteToken(uint256 amount) external onlyElevatedAccess { emit RepayToken(address(quoteToken), amount); quoteToken.safeTransferFrom(msg.sender, address(this), amount); treasuryReservesVault.repay(quoteToken, amount, address(this)); }
2,321
13
// hash together the contract addresses
bytes32 data = keccak256(abi.encodePacked(wrappedPosition, pool));
bytes32 data = keccak256(abi.encodePacked(wrappedPosition, pool));
64,826
87
// Increase the allowance by a given amount spender Spender's address addedValueAmount of increase in allowancereturn True if successful /
function increaseAllowance(address spender, uint256 addedValue) external returns (bool)
function increaseAllowance(address spender, uint256 addedValue) external returns (bool)
3,078
18
// Allow a user to migrate their stake to a new PremiaFeeDiscount contract (If a new contract has been set),/ while preserving same lockup expiration date
function migrateStake() external nonReentrant { require(address(newContract) != address(0), "Migration disabled"); UserInfo memory user = userInfo[msg.sender]; require(user.balance > 0, "No stake"); delete userInfo[msg.sender]; xPremia.safeIncreaseAllowance(address(newCont...
function migrateStake() external nonReentrant { require(address(newContract) != address(0), "Migration disabled"); UserInfo memory user = userInfo[msg.sender]; require(user.balance > 0, "No stake"); delete userInfo[msg.sender]; xPremia.safeIncreaseAllowance(address(newCont...
46,125
86
// ~~~>
receive() external payable { emit Received(msg.sender, msg.value); }
receive() external payable { emit Received(msg.sender, msg.value); }
41,542
169
// james foley http:github.com/realisation/selectively deposit any supported stablecoin flavor into the contract in return for corresponding amount of component tokens/_derivatives an array containing the addresses of the flavors being deposited into/_amounts an array containing the values of the flavors you wish to de...
function selectiveDeposit ( address[] calldata _derivatives, uint[] calldata _amounts, uint _minComponents, uint _deadline ) external deadline(_deadline) transactable nonReentrant returns ( uint componentsMinted_
function selectiveDeposit ( address[] calldata _derivatives, uint[] calldata _amounts, uint _minComponents, uint _deadline ) external deadline(_deadline) transactable nonReentrant returns ( uint componentsMinted_
15,443
106
// addresses are "0x" followed by 20 bytes of data which take up 2 characters each
bytes memory result = new bytes(42);
bytes memory result = new bytes(42);
1,268
40
// Constructor sets the original owner of the contract and whether or not it is one time transferable.
constructor(address payable _account_, bool _transferable_) internal { _owner = _account_; _isTransferable = _transferable_; // Emit the LockedOwnership event if no longer transferable. if (!_isTransferable) { emit LockedOwnership(_account_); } emit Transf...
constructor(address payable _account_, bool _transferable_) internal { _owner = _account_; _isTransferable = _transferable_; // Emit the LockedOwnership event if no longer transferable. if (!_isTransferable) { emit LockedOwnership(_account_); } emit Transf...
18,770
58
// Transfer tokens from ICO address to another address._to The address to transfer to._value The amount to be transferred./
function transferFromIco(address _to, uint256 _value) public onlyIco returns (bool) { return super.transfer(_to, _value); }
function transferFromIco(address _to, uint256 _value) public onlyIco returns (bool) { return super.transfer(_to, _value); }
51,816
103
// RLPItem conversions into data types / returns raw rlp encoding in bytes
function toRlpBytes(RLPItem memory item) internal pure returns (bytes memory)
function toRlpBytes(RLPItem memory item) internal pure returns (bytes memory)
12,582
8
// initialClass.push(newClass);
numClasses++;
numClasses++;
30,827
122
// if any of these checks fails then arrays are not equal
if iszero(eq(mload(mc), mload(cc))) {
if iszero(eq(mload(mc), mload(cc))) {
31,870
377
// Holds number & validity of tokens locked for a given reason for a specified address /
mapping(address => mapping(bytes32 => LockToken)) public locked;
mapping(address => mapping(bytes32 => LockToken)) public locked;
28,792
62
// try to initialize an epoch. if it can't it fails if it fails either user either a Swapp account will init not init epochs
if (lastInitializedEpoch < epochId) { _initEpoch(epochId); }
if (lastInitializedEpoch < epochId) { _initEpoch(epochId); }
58,580
21
// Get Balance
function getBalance() external view onlyOwner returns (uint256) { return address(this).balance; }
function getBalance() external view onlyOwner returns (uint256) { return address(this).balance; }
21,458
1
// Returns true if a `leaf` can be proved to be a part of a Merkle treedefined by `root`. For this, a `proof` must be provided, containingsibling hashes on the branch from the leaf to the root of the tree. Eachpair of leaves and each pair of pre-images are assumed to be sorted. /
function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { return processProof(proof, leaf) == root; }
function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { return processProof(proof, leaf) == root; }
752
192
// WETH-specific functions.
function deposit() external payable; function withdraw(uint amount) external;
function deposit() external payable; function withdraw(uint amount) external;
27,807
63
// Represents a receipt token. The token is fully compliant with the ERC20 interface. The token can be minted or burnt by whitelisted addresses only. Only the owner is allowed to enable/disable addresses. /
contract ReceiptToken is Mintable { /** * @notice Constructor. * @param newOwner The owner of the smart contract. */ constructor (address newOwner, uint256 initialMaxSupply) Mintable(newOwner, "Fractal", "Fractal Protocol Vault Token", 6, 0) { maxSupply = initialMaxSupply; } }
contract ReceiptToken is Mintable { /** * @notice Constructor. * @param newOwner The owner of the smart contract. */ constructor (address newOwner, uint256 initialMaxSupply) Mintable(newOwner, "Fractal", "Fractal Protocol Vault Token", 6, 0) { maxSupply = initialMaxSupply; } }
50,182
182
// burn can only be called by the tokens' associated Gateway/ contract. See Gateway's burn functions instead.
function burn(address _from, uint256 _amount) public onlyOwner { _burn(_from, _amount); }
function burn(address _from, uint256 _amount) public onlyOwner { _burn(_from, _amount); }
11,428
0
// This mapping allows whitelisted addresses to claim on behalf of others useful for contracts that hold tokens to be rewarded but don't have any native logic to claim Liquidity Mining rewards
mapping(address => address) internal _authorizedClaimers;
mapping(address => address) internal _authorizedClaimers;
32,739
3
// Emitted when ERC20 tokens are withdrawn from this address.withdrawer Address that triggered the withdrawal. recipientAddress that received the withdrawal. assetAddress of the token being withdrawn. id Token ID being withdrawn. /
event WithdrewERC721(
event WithdrewERC721(
10,561
66
// add tokens
total_supply = total_supply.add(tokens); user.tokens = user.tokens.add(tokens);
total_supply = total_supply.add(tokens); user.tokens = user.tokens.add(tokens);
63,681
11
// Constructor
constructor() { acceptedToken = IERC20(token_addr); }
constructor() { acceptedToken = IERC20(token_addr); }
51,652
163
// 加入回答列表
answerList[_taskIndex].push(answer);
answerList[_taskIndex].push(answer);
51,027
63
// fromToken Address of the source token fromAmount Amount of source tokens to be swapped toAmount Minimum destination token amount expected out of this swap expectedAmount Expected amount of destination tokens without slippage beneficiary Beneficiary address0 then 100% will be transferred to beneficiary. Pass 10000 fo...
struct SellData { address fromToken; uint256 fromAmount; uint256 toAmount; uint256 expectedAmount; address payable beneficiary; Utils.Path[] path; address payable partner; uint256 feePercent; bytes permit; uint256 deadline; byte...
struct SellData { address fromToken; uint256 fromAmount; uint256 toAmount; uint256 expectedAmount; address payable beneficiary; Utils.Path[] path; address payable partner; uint256 feePercent; bytes permit; uint256 deadline; byte...
3,629
4
// Get betting odds.fund1Bank fund bank of condition's outcome 1fund2Bank fund bank of condition's outcome 2amount amount of tokens to betmargin bookmaker commissionmultiplier decimal unit representationreturn betting odds value /
function _getOddsFromBanks( uint256 fund1Bank, uint256 fund2Bank, uint256 amount, uint256 margin, uint256 multiplier
function _getOddsFromBanks( uint256 fund1Bank, uint256 fund2Bank, uint256 amount, uint256 margin, uint256 multiplier
8,228
14
// fallback方法,如果用户未在转账data中添加数据,默认是走这个方法
function () payable public { require(!finalised); // 判断是否在项目规定的时间范围内 require(block.timestamp >= startTime); require(block.timestamp <= endTime); // 判断硬顶 require(ethRaised < hardCap); // 达到最低捐赠额度才能继续,否则失败 require(msg.value >= minimumDonation); ...
function () payable public { require(!finalised); // 判断是否在项目规定的时间范围内 require(block.timestamp >= startTime); require(block.timestamp <= endTime); // 判断硬顶 require(ethRaised < hardCap); // 达到最低捐赠额度才能继续,否则失败 require(msg.value >= minimumDonation); ...
34,066
12
// initiate the sale process
if( state != State.OWNED ) return false; prospectiveSale = ProspectiveSale( _buyer, _salePrice, _exchangeRate ); state = State.SALE_INITIATED; return true;
if( state != State.OWNED ) return false; prospectiveSale = ProspectiveSale( _buyer, _salePrice, _exchangeRate ); state = State.SALE_INITIATED; return true;
40,719
2
// Override premiaOption contract into tx origin
if (_account == premiaOption) { _account = tx.origin; }
if (_account == premiaOption) { _account = tx.origin; }
38,124
234
// Burn this much token
IToken(tokenAddress).burnFrom(msg.sender, currentTokenCost()); return mintInternal();
IToken(tokenAddress).burnFrom(msg.sender, currentTokenCost()); return mintInternal();
48,866
0
// Constructor. Emits the `MagicValues` event. Emits the `Paused` event. payoutWallet_ the payout wallet. skusCapacity the cap for the number of managed SKUs. tokensPerSkuCapacity the cap for the number of tokens managed per SKU. /
constructor( address payoutWallet_, uint256 skusCapacity, uint256 tokensPerSkuCapacity
constructor( address payoutWallet_, uint256 skusCapacity, uint256 tokensPerSkuCapacity
15,062
0
// medication contract constructor (relation with regulator and pharmacy)
constructor(address _pharmacy) public { regulatorAddr = msg.sender; last_update_addr = msg.sender; pharmacyAddr = _pharmacy; }
constructor(address _pharmacy) public { regulatorAddr = msg.sender; last_update_addr = msg.sender; pharmacyAddr = _pharmacy; }
32,518
140
// requirement below is satisfied by statements aboverequire(pos == 0 || isOfferSorted(pos));
if (pos != 0) { //offers[id] is not the highest offer
if (pos != 0) { //offers[id] is not the highest offer
16,688
152
// The amount of cards in this machine.
uint256 public cardAmount; uint256 private _salt; uint256 public shuffleCount = 10;
uint256 public cardAmount; uint256 private _salt; uint256 public shuffleCount = 10;
33,093
0
// Contract owner address /
address public contractOwner;
address public contractOwner;
34,452
93
// Allow a user to deposit underlying tokens and mint the corresponding number of wrapped tokens. /
function depositFor(address account, uint256 amount) public virtual returns (bool) { SafeERC20.safeTransferFrom(underlying, _msgSender(), address(this), amount); _mint(account, amount); return true; }
function depositFor(address account, uint256 amount) public virtual returns (bool) { SafeERC20.safeTransferFrom(underlying, _msgSender(), address(this), amount); _mint(account, amount); return true; }
34,897
119
// Register to the Game
ids[sum_players]=msg.sender; // id -> address id[msg.sender]=sum_players; // address -> id parent[msg.sender]=_parent; // what is my parent? sum_players+=1;
ids[sum_players]=msg.sender; // id -> address id[msg.sender]=sum_players; // address -> id parent[msg.sender]=_parent; // what is my parent? sum_players+=1;
19,134
23
// Internal fucntions // Get price from ChainLink aggregator The ChainLink aggregator to get the price ofreturn The price /
function getPriceFromChainlink(AggregatorV3Interface aggregator) internal view returns (uint) { ( , int price, , , ) = aggregator.latestRoundData(); require(price > 0, "invalid price"); // Extend the decimals to 1e18. return mul_(uint(price), 10**(18 - uint(aggregator.decimals())));...
function getPriceFromChainlink(AggregatorV3Interface aggregator) internal view returns (uint) { ( , int price, , , ) = aggregator.latestRoundData(); require(price > 0, "invalid price"); // Extend the decimals to 1e18. return mul_(uint(price), 10**(18 - uint(aggregator.decimals())));...
11,470
59
// Throws if called by any account other than the registryAdmin. /
modifier onlyRegistryAdmin() { require(isRegistryAdmin(), "WithClaimableRegistryManagement: caller is not the registryAdmin"); _; }
modifier onlyRegistryAdmin() { require(isRegistryAdmin(), "WithClaimableRegistryManagement: caller is not the registryAdmin"); _; }
7,183
5
// Gets generator of G1 group.Taken from go-ethereum/crypto/bn256/cloudflare/curve.go /
uint256 constant g1x = 1; uint256 constant g1y = 2;
uint256 constant g1x = 1; uint256 constant g1y = 2;
7,288
143
// Returns the total quantity for a token ID_id uint256 ID of the token to query return amount of token in existence/
function totalSupply( uint256 _id
function totalSupply( uint256 _id
57,187
145
// Adds in liquidity for ETH/usdt
_weth = IERC20(weth).balanceOf(address(this)); uint256 _usdt = IERC20(usdt).balanceOf(address(this)); if (_weth > 0 && _usdt > 0) { IERC20(weth).safeApprove(univ2Router2, 0); IERC20(weth).safeApprove(univ2Router2, _weth); USDT(usdt).approve(univ2Router2, _usd...
_weth = IERC20(weth).balanceOf(address(this)); uint256 _usdt = IERC20(usdt).balanceOf(address(this)); if (_weth > 0 && _usdt > 0) { IERC20(weth).safeApprove(univ2Router2, 0); IERC20(weth).safeApprove(univ2Router2, _weth); USDT(usdt).approve(univ2Router2, _usd...
78,424
6
//
* @dev Implementation of the {IERC20} interface. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these e...
* @dev Implementation of the {IERC20} interface. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these e...
2,878
5
// ERC-721 Non-Fungible Token Standard/See https:github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md/Note: the ERC-165 identifier for this interface is 0x80ac58cd.
interface ERC721 /* is ERC165 */ { /// @dev This emits when ownership of any NFT changes by any mechanism. /// This event emits when NFTs are created (`from` == 0) and destroyed /// (`to` == 0). Exception: during contract creation, any number of NFTs /// may be created and assigned without emitting T...
interface ERC721 /* is ERC165 */ { /// @dev This emits when ownership of any NFT changes by any mechanism. /// This event emits when NFTs are created (`from` == 0) and destroyed /// (`to` == 0). Exception: during contract creation, any number of NFTs /// may be created and assigned without emitting T...
40,282
176
// Subtract the minting fee
total_frax_mint = (frax_amt.mul(PRICE_PRECISION.sub(minting_fee[col_idx]))).div(PRICE_PRECISION);
total_frax_mint = (frax_amt.mul(PRICE_PRECISION.sub(minting_fee[col_idx]))).div(PRICE_PRECISION);
2,928
0
// ------------- EVENTS & VARS -------------
event JuiceBoxMinted(uint256 indexed a); event JuiceBoxBurned(uint256 indexed a);
event JuiceBoxMinted(uint256 indexed a); event JuiceBoxBurned(uint256 indexed a);
10,371
817
// ProposalAccepted event is called when a proposal is accepted so that a server can listen that can /call any offchain actions
event ProposalAccepted (uint256 proposalId);
event ProposalAccepted (uint256 proposalId);
29,132
17
// Use transferFrom() from IERC20.sol
IERC20(erc20Contract).transferFrom(from, NFTOwner, value);
IERC20(erc20Contract).transferFrom(from, NFTOwner, value);
16,278
49
// General payment function for `manager` of LXL contract.details Describes context for ether transfer. /
function tributeToManager(string calldata details) external nonReentrant payable { (bool success, ) = manager.call{value: msg.value}(""); require(success, "!ethCall"); emit TributeToManager(msg.value, details); }
function tributeToManager(string calldata details) external nonReentrant payable { (bool success, ) = manager.call{value: msg.value}(""); require(success, "!ethCall"); emit TributeToManager(msg.value, details); }
8,953
32
// Merkle mint
_checkMerkleAndUpdate(claim, creatorContractAddress, claimIndex, mintIndex, merkleProof, mintFor);
_checkMerkleAndUpdate(claim, creatorContractAddress, claimIndex, mintIndex, merkleProof, mintFor);
2,828
200
// getNativeReputation _avatar the organization avatar.return organization native reputation /
function getNativeReputation(address _avatar) external isAvatarValid(_avatar) view returns(address) { return address(nativeReputation); }
function getNativeReputation(address _avatar) external isAvatarValid(_avatar) view returns(address) { return address(nativeReputation); }
27,277
41
// retrieves the BMI profit of a tokenId/tokenId numeric id identifier of the token/ return profit amount
function getBMIProfit(uint256 tokenId) public view override returns (uint256) { return rewardsGenerator.getReward(_stakersPool[tokenId].policyBookAddress, tokenId); }
function getBMIProfit(uint256 tokenId) public view override returns (uint256) { return rewardsGenerator.getReward(_stakersPool[tokenId].policyBookAddress, tokenId); }
71,127
29
// must be non-zero
if(msg.value <= 0) { revert("donation must be positive"); }
if(msg.value <= 0) { revert("donation must be positive"); }
5,945
8
// public static String asString(){
function asString() public returns(string memory) { string memory ret = ""; uint t=lowestId; while (t< currentId) { string memory a = "["; string memory b = "]"; ret = join(a,join(uint2str(t),join(":",join(toAsciiString(statusMap...
function asString() public returns(string memory) { string memory ret = ""; uint t=lowestId; while (t< currentId) { string memory a = "["; string memory b = "]"; ret = join(a,join(uint2str(t),join(":",join(toAsciiString(statusMap...
14,847
152
// mint tokens on a wallet Improved version of default mint method. Tokens can be minted to an address if only it is a verified address as per the security token._to Address to mint the tokens to._amount Amount of tokens to mint. This function can only be called by a wallet set as agent of the token emits a `Transfer` ...
function mint(address _to, uint256 _amount) external;
function mint(address _to, uint256 _amount) external;
13,641
92
// Return true if we can run finalizeCrowdsale() properly. This is a safety check function that doesn't allow crowdsale to beginunless the finalizer has been set up properly. /
function isSane() public constant returns (bool);
function isSane() public constant returns (bool);
5,397
151
// Allows the manager to set whether or not only whitelisted addresses can deposit into their fund_onlyWhitelistboolean representing whether only whitelisted addresses can deposit/
function setWhitelistOnly(bool _onlyWhitelist) external onlyOwner { onlyWhitelist = _onlyWhitelist; }
function setWhitelistOnly(bool _onlyWhitelist) external onlyOwner { onlyWhitelist = _onlyWhitelist; }
28,901
32
// clear the stored message
failedMessages[srcChainId][srcAddress][nonce] = bytes32(0);
failedMessages[srcChainId][srcAddress][nonce] = bytes32(0);
21,469
104
// MintableCrowdsaleOnSuccessAgent/Applicature/Contract which takes actions on state change and contribution/ un-pause tokens and disable minting on Crowdsale success/implementation
contract MintableCrowdsaleOnSuccessAgent is CrowdsaleAgent { Crowdsale public crowdsale; MintableToken public token; bool public _isInitialized; constructor(Crowdsale _crowdsale, MintableToken _token) public CrowdsaleAgent(_crowdsale) { crowdsale = _crowdsale; token = _token; ...
contract MintableCrowdsaleOnSuccessAgent is CrowdsaleAgent { Crowdsale public crowdsale; MintableToken public token; bool public _isInitialized; constructor(Crowdsale _crowdsale, MintableToken _token) public CrowdsaleAgent(_crowdsale) { crowdsale = _crowdsale; token = _token; ...
18,114
94
// Now give user some STOL
IERC20 stol = IERC20(stolAddress); uint256 maxSupply = StabinolToken(stolAddress).getMaxSupply(); if(stol.totalSupply() < maxSupply){
IERC20 stol = IERC20(stolAddress); uint256 maxSupply = StabinolToken(stolAddress).getMaxSupply(); if(stol.totalSupply() < maxSupply){
5,471
229
// update ALI balance on the contract
aliBalance += aliDelta;
aliBalance += aliDelta;
45,185
6
// Updates the set of claim topics that a trusted issuer is allowed to emit. Requires that this ClaimIssuer contract already exists in the registry Requires that the provided claimTopics set is not empty Requires that there is no more than 15 claimTopics_trustedIssuer the claim issuer to update._claimTopics the set of ...
function updateIssuerClaimTopics(IClaimIssuer _trustedIssuer, uint256[] calldata _claimTopics) external;
function updateIssuerClaimTopics(IClaimIssuer _trustedIssuer, uint256[] calldata _claimTopics) external;
5,595
14
// limitation of buying tokens
modifier allowCrowdsaleAmountLimit(){ if (msg.value == 0) revert(); if (msg.value < CROWDSALE_ETH_IN_WEI_ACCEPTED_MIN) revert(); if((crowdsale_eth_fund.add(msg.value)) > CROWDSALE_ETH_IN_WEI_FUND_MAX) revert(); if((CROWDSALE_GASPRICE_IN_WEI_MAX > 0) && (tx.gasprice > CROWDSALE_GASPRICE_IN_WEI_MAX)) revert(); _;...
modifier allowCrowdsaleAmountLimit(){ if (msg.value == 0) revert(); if (msg.value < CROWDSALE_ETH_IN_WEI_ACCEPTED_MIN) revert(); if((crowdsale_eth_fund.add(msg.value)) > CROWDSALE_ETH_IN_WEI_FUND_MAX) revert(); if((CROWDSALE_GASPRICE_IN_WEI_MAX > 0) && (tx.gasprice > CROWDSALE_GASPRICE_IN_WEI_MAX)) revert(); _;...
52,246
270
// Get the epoch at the current block timestamp.Reverts if epoch zero has not started. return The current epoch number. /
function getCurrentEpoch() external view returns (uint256)
function getCurrentEpoch() external view returns (uint256)
81,190
4
// ether can be send and received by the contract in the trasaction that calls this function as well
// function sendEther() public payable{ // }
// function sendEther() public payable{ // }
15,726
30
// Sets a new address for the DealManager _newDealManager The address of the new DealManager /
function setDealManager(address _newDealManager) external onlyDealManager { require( _newDealManager != address(0) && _newDealManager != address(this), "DaoDepositManager: Error 100" ); dealManager = IDealManager(_newDealManager); }
function setDealManager(address _newDealManager) external onlyDealManager { require( _newDealManager != address(0) && _newDealManager != address(this), "DaoDepositManager: Error 100" ); dealManager = IDealManager(_newDealManager); }
18,329
166
// Passes a transaction to be executed by the avatar and returns data./Can only be called by this contract./to Destination address of module transaction./value Ether value of module transaction./data Data payload of module transaction./operation Operation type of module transaction: 0 == call, 1 == delegate call.
function execAndReturnData( address to, uint256 value, bytes memory data, Enum.Operation operation
function execAndReturnData( address to, uint256 value, bytes memory data, Enum.Operation operation
16,740
53
// ---------------------------------------------------------------------------- ERC20 Token, with the addition of symbol, name and decimals and a fixed supply ----------------------------------------------------------------------------
contract BTYCToken is ERC20Interface, Owned { using SafeMath for uint; string public symbol; string public name; uint8 public decimals; uint _totalSupply; uint256 public sellPrice; //出售价格 1枚代币换多少以太 /1000 uint256 public buyPrice; //购买价格 多少以太可购买1枚代币 /1000 uint256 public sysPrice; //挖矿的衡量值 uint256 public sysPe...
contract BTYCToken is ERC20Interface, Owned { using SafeMath for uint; string public symbol; string public name; uint8 public decimals; uint _totalSupply; uint256 public sellPrice; //出售价格 1枚代币换多少以太 /1000 uint256 public buyPrice; //购买价格 多少以太可购买1枚代币 /1000 uint256 public sysPrice; //挖矿的衡量值 uint256 public sysPe...
46,392
95
// Deposit LP tokens to Mining for token allocation.
function deposit(uint256 _pid, uint256 _amount) public { require(_pid < poolInfo.length, "invalid _pid"); PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.a...
function deposit(uint256 _pid, uint256 _amount) public { require(_pid < poolInfo.length, "invalid _pid"); PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.a...
13,953
151
// not state changing but OK because of previous call
uint256 liquidity = want.balanceOf(SOLO); if (liquidity > 1) { uint256 toWithdraw = amount.sub(looseBalance); if (toWithdraw <= liquidity) {
uint256 liquidity = want.balanceOf(SOLO); if (liquidity > 1) { uint256 toWithdraw = amount.sub(looseBalance); if (toWithdraw <= liquidity) {
16,670
7
// /
function whitelistUsers( address[] calldata userAddresses, uint120[] calldata allocations, uint8[] calldata options, bool last
function whitelistUsers( address[] calldata userAddresses, uint120[] calldata allocations, uint8[] calldata options, bool last
13,558
0
// Override such constants while extending BaseAuthorizer.
bool public paused = false;
bool public paused = false;
38,033
24
// Returns value of rewards (CRV, CVX) we can obtain from Convex (nominated in primary tokens)
function getClaimableRewardsValue() external view returns (uint256);
function getClaimableRewardsValue() external view returns (uint256);
31,617
129
// KUSD has 18 decimals KMCD has 18 decimals kMCDPriceMantissa is KMCD's price (quoted by KUSD, has 6 decimals) scaled by 1e36 / KMCD's decimals = 1e36 / 1e18 = 1e18 so the calculation of equivalent KUSD amount is as below accountStakes kMCDPriceMantissa accountStakeskMCDPriceMantissa equivalentKUSDAmount =------------...
vars.equivalentKUSDAmount = unstakeKMCDAmount.mul(kMCDPriceMantissa).div(1e18); require(maxBurnKUSDAmount >= vars.equivalentKUSDAmount, "Liquidate: reach out max burn KUSD amount limit");
vars.equivalentKUSDAmount = unstakeKMCDAmount.mul(kMCDPriceMantissa).div(1e18); require(maxBurnKUSDAmount >= vars.equivalentKUSDAmount, "Liquidate: reach out max burn KUSD amount limit");
60,438
36
// Calculates the balance decrements for a set of trades/_values The _values param from the trade method/_decrementsLength Should match the value of _addresses.length / 2/ from the trade method/ return An array of decrements
function calculateTradeDecrements( uint256[] memory _values, uint256 _decrementsLength ) public pure returns (uint256[] memory)
function calculateTradeDecrements( uint256[] memory _values, uint256 _decrementsLength ) public pure returns (uint256[] memory)
18,308
23
// Claim the CANTO for a given market. Can only be performed for prior (i.e. finished) epochs, not the current one/_market Address of the market/_claimFromTimestamp From which epoch (provided as timestmap) should the claim start. Usually, this parameter should be set to 0, in which case the epoch of the last claim will...
function claim( address _market, uint256 _claimFromTimestamp, uint256 _claimUpToTimestamp
function claim( address _market, uint256 _claimFromTimestamp, uint256 _claimUpToTimestamp
9,534
97
// Make sure the cooldown has ends
require(_isCooldownReady(account));
require(_isCooldownReady(account));
69,001
9
// : unpause this gamerequireadmin /
function unpause() public override{ require(msg.sender == admin, "only admin can do unpause operation!"); require(!is_going, "game is already unpaused, please do not repeat this"); is_going = true; }
function unpause() public override{ require(msg.sender == admin, "only admin can do unpause operation!"); require(!is_going, "game is already unpaused, please do not repeat this"); is_going = true; }
3,009
150
// The identifier of the role which is allowed to mint options token
bytes32 public constant MINTER_ROLE = keccak256("MINTER");
bytes32 public constant MINTER_ROLE = keccak256("MINTER");
13,403
140
// Redeem any invested tokens from the pool
function redeem(uint256 _shares) external nonReentrant
function redeem(uint256 _shares) external nonReentrant
6,983
358
// market is not listed, cannot join
if (!marketToJoin.isListed) { return Error.MARKET_NOT_LISTED; }
if (!marketToJoin.isListed) { return Error.MARKET_NOT_LISTED; }
18,506
67
// Call the token and store if it succeeded or not. We use 100 because the calldata length is 4 + 323.
callStatus := call(gas(), token, 0, freeMemoryPointer, 100, 0, 0)
callStatus := call(gas(), token, 0, freeMemoryPointer, 100, 0, 0)
40,068
5
// This function returns who is authorized to set the metadata for your metadata.As an EXAMPLE, we'll only allow the contract deployer to set the contract's metadata.You MUST complete the body of this function to use the `ContractMetadata` extension. /
function _canSetContractURI() internal view virtual override returns (bool){ return msg.sender == owner; }
function _canSetContractURI() internal view virtual override returns (bool){ return msg.sender == owner; }
4,290
6
// Registers with twitter name and full user name (the user name is encrypted). _participant The twitter address of the participant _encrypted The encrypted participant name /
function registerWithEncryption(string _participant, string _encrypted) external payable onlyActive{ registerInternal(_participant); emit RegisterEvent(msg.sender, _participant, _encrypted); }
function registerWithEncryption(string _participant, string _encrypted) external payable onlyActive{ registerInternal(_participant); emit RegisterEvent(msg.sender, _participant, _encrypted); }
52,166
17
// Sets the date of the ICO end.ICO_end The date of the ICO end./
function setEndOfICO(uint ICO_end) public onlyOwner { endOfICO = ICO_end; }
function setEndOfICO(uint ICO_end) public onlyOwner { endOfICO = ICO_end; }
50,681
184
// The block number when Sakura mining starts.
uint256 public startBlock; event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); constructor( SakuraToken _saku...
uint256 public startBlock; event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); constructor( SakuraToken _saku...
58,247
28
// Updates the address of the price oracle sentinel. newPriceOracleSentinel The address of the new PriceOracleSentinel /
function setPriceOracleSentinel(address newPriceOracleSentinel) external;
function setPriceOracleSentinel(address newPriceOracleSentinel) external;
18,835
51
// Override for MVP (no interests)
return (pay, interests);
return (pay, interests);
27,263
190
// dForce's lending Token admin Contract dForce /
abstract contract TokenAdmin is TokenEvent { //---------------------------------- //********* Owner Actions ********** //---------------------------------- modifier settleInterest() { // Accrues interest. _updateInterest(); require( accrualBlockNumber == block.number...
abstract contract TokenAdmin is TokenEvent { //---------------------------------- //********* Owner Actions ********** //---------------------------------- modifier settleInterest() { // Accrues interest. _updateInterest(); require( accrualBlockNumber == block.number...
71,469
9
// ---------------------------------------- Storage----------------------------------------
ISynthereumFinder public immutable synthereumFinder; mapping(bytes32 => AggregatorV3Interface) private aggregators;
ISynthereumFinder public immutable synthereumFinder; mapping(bytes32 => AggregatorV3Interface) private aggregators;
28,220
4
// ---------------------------------------------------------------------------- Safe math ----------------------------------------------------------------------------
library SafeMath { function add(uint a, uint b) internal pure returns (uint c) { c = a + b; require(c >= a, "Incorrect value"); } function sub(uint a, uint b) internal pure returns (uint c) { require(b <= a, "Incorrect value"); c = a - b; } function mul(uint a, uint b...
library SafeMath { function add(uint a, uint b) internal pure returns (uint c) { c = a + b; require(c >= a, "Incorrect value"); } function sub(uint a, uint b) internal pure returns (uint c) { require(b <= a, "Incorrect value"); c = a - b; } function mul(uint a, uint b...
40,070
12
// First reset the approved amount if needed
if (allowance > 0) { ERC20(token).safeApprove(spender, 0); }
if (allowance > 0) { ERC20(token).safeApprove(spender, 0); }
29,159
1
// address of token being airdropped.
address public airdropTokenAddress;
address public airdropTokenAddress;
15,030
540
// Check if the deposit has indeed exceeded the time limit of if the exchange is in withdrawal mode
require( block.timestamp >= deposit.timestamp + S.maxAgeDepositUntilWithdrawable || S.isInWithdrawalMode(), "DEPOSIT_NOT_WITHDRAWABLE_YET" ); uint amount = deposit.amount;
require( block.timestamp >= deposit.timestamp + S.maxAgeDepositUntilWithdrawable || S.isInWithdrawalMode(), "DEPOSIT_NOT_WITHDRAWABLE_YET" ); uint amount = deposit.amount;
81,162
424
// Copyright 2019 Dolomite Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License atUnless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" B...
pragma solidity 0.5.7;
pragma solidity 0.5.7;
3,119