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 |
|---|---|---|---|---|
17 | // The EIP-712 typehash for the ballot struct used by the contract | bytes32 public constant BALLOT_TYPEHASH =
keccak256("Ballot(uint256 proposalId,bool support)");
| bytes32 public constant BALLOT_TYPEHASH =
keccak256("Ballot(uint256 proposalId,bool support)");
| 33,018 |
62 | // Startable tokenStandardToken modified with startable transfers. / | contract StartToken is Startable, ERC223TokenCompatible, StandardToken {
/** ******************************** */
/** START: ADDED BY HORIZON GLOBEX */
/** ******************************** */
// KYC submission hashes accepted by KYC service provider for AML/KYC review.
bytes32[] public kycHashes;
... | contract StartToken is Startable, ERC223TokenCompatible, StandardToken {
/** ******************************** */
/** START: ADDED BY HORIZON GLOBEX */
/** ******************************** */
// KYC submission hashes accepted by KYC service provider for AML/KYC review.
bytes32[] public kycHashes;
... | 19,562 |
5 | // PAW tokens created per block. | uint256 public pawPerBlock = 8 ether;
uint256 public constant MAX_EMISSION_RATE = 1000 ether; // Safety check
| uint256 public pawPerBlock = 8 ether;
uint256 public constant MAX_EMISSION_RATE = 1000 ether; // Safety check
| 12,968 |
18 | // Liquidate an asset bought via our listing / | ) public payable nonReentrant onlyOwner {
int256 tokenId = IERC721(_nftAddress).tokenId();
address assetManager = idToAssetListing[listingId].assetManager;
Asset storedAsset = IAssetManager(assetManager).getAsset(tokenId);
require(IAssetManager(assetManager).getAsset(tokenId), "Asset not valid");
... | ) public payable nonReentrant onlyOwner {
int256 tokenId = IERC721(_nftAddress).tokenId();
address assetManager = idToAssetListing[listingId].assetManager;
Asset storedAsset = IAssetManager(assetManager).getAsset(tokenId);
require(IAssetManager(assetManager).getAsset(tokenId), "Asset not valid");
... | 43,789 |
11 | // | /// @return {bytes}
///
function addAttributeSet(
bytes32 name,
bytes32[] calldata values
)internal pure returns(
bytes memory
){
return abi.encodeWithSignature(
STUB_ADD_ATTRIBUTE_SET,
name,
values
);
}
| /// @return {bytes}
///
function addAttributeSet(
bytes32 name,
bytes32[] calldata values
)internal pure returns(
bytes memory
){
return abi.encodeWithSignature(
STUB_ADD_ATTRIBUTE_SET,
name,
values
);
}
| 3,558 |
42 | // emitted when a proposal is created. proposalId id of the proposal creator address of the creator of the proposal accessLevel minimum level needed to be able to execute this proposal ipfsHash ipfs has containing the proposal metadata information / | event ProposalCreated(
| event ProposalCreated(
| 15,897 |
9 | // Array for holders | address[] internal holderaddresses; //array to store the holders
| address[] internal holderaddresses; //array to store the holders
| 50,420 |
139 | // We need to unregister tokens first | for (uint256 i=0; i < _registeredTokens.length; i++){
if (_registeredTokens[i] != address(0)) {
_unregisterToken(_registeredTokens[i]);
_registeredTokens[i] = address(0);
}
| for (uint256 i=0; i < _registeredTokens.length; i++){
if (_registeredTokens[i] != address(0)) {
_unregisterToken(_registeredTokens[i]);
_registeredTokens[i] = address(0);
}
| 48,101 |
5 | // could set more init variables too other than just owner useful when there's a more elaborate start state proxy can call it and set its state delegatecall into intialize, to set up the initial state in the proxy scope | function initialize(address _owner) public {
// only run once
require(_initialized == false);
owner = _owner;
_initialized = true;
}
| function initialize(address _owner) public {
// only run once
require(_initialized == false);
owner = _owner;
_initialized = true;
}
| 9,550 |
9 | // See {ERC20Pausable} and {Pausable-_unpause}. Requirements: - the caller must have the `VOLMEX_PROTOCOL_ROLE`. / | function unpause() public virtual {
require(
hasRole(VOLMEX_PROTOCOL_ROLE, msg.sender),
"VolmexPositionToken: must have volmex protocol role to unpause"
);
_unpause();
}
| function unpause() public virtual {
require(
hasRole(VOLMEX_PROTOCOL_ROLE, msg.sender),
"VolmexPositionToken: must have volmex protocol role to unpause"
);
_unpause();
}
| 58,271 |
108 | // Any action before `startStakingBlockIndex` is treated as acted in block `startStakingBlockIndex`. | if (block.number < startStakingBlockIndex) {
_stakingRecords[staker].blockIndex = startStakingBlockIndex;
}
| if (block.number < startStakingBlockIndex) {
_stakingRecords[staker].blockIndex = startStakingBlockIndex;
}
| 41,996 |
6 | // An event emitted when a vault handler is added | event VaultHandlerAdded(
address indexed _owner,
address indexed _tokenHandler
);
| event VaultHandlerAdded(
address indexed _owner,
address indexed _tokenHandler
);
| 17,946 |
38 | // update state | _weiRaised = _weiRaised.add(weiAmount);
_processPurchase(beneficiary, tokens);
emit TokensPurchased(
msg.sender,
beneficiary,
weiAmount,
tokens
);
| _weiRaised = _weiRaised.add(weiAmount);
_processPurchase(beneficiary, tokens);
emit TokensPurchased(
msg.sender,
beneficiary,
weiAmount,
tokens
);
| 786 |
218 | // removes a stream (only default admin role)/streamId stream index/streamFundReceiver receives the rest of the reward tokens in the stream | function removeStream(uint256 streamId, address streamFundReceiver)
external
virtual
onlyRole(STREAM_MANAGER_ROLE)
| function removeStream(uint256 streamId, address streamFundReceiver)
external
virtual
onlyRole(STREAM_MANAGER_ROLE)
| 34,173 |
797 | // Will use the owner address of another parent contract _newParent Address of the new owner / | function changeOwnableParent(address _newParent) public onlyOwner {
| function changeOwnableParent(address _newParent) public onlyOwner {
| 35,253 |
104 | // unsuccessful end of CrowdSale | if (weiRaised.add(preSale.weiRaised()) < softCap && now > endCrowdSaleTime) {
refundAll(_to);
return;
}
| if (weiRaised.add(preSale.weiRaised()) < softCap && now > endCrowdSaleTime) {
refundAll(_to);
return;
}
| 23,253 |
26 | // View function to see pending rewards on frontend. | function pending(uint256 _pid,address _user) public view returns (uint256){
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accRewardPerShare = pool.accRewardPerShare;
// uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | function pending(uint256 _pid,address _user) public view returns (uint256){
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accRewardPerShare = pool.accRewardPerShare;
// uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | 40,979 |
38 | // All data related to this account must be destroyed. Account is asking this voluntary or delete is through governance action. | Destroyed
| Destroyed
| 38,645 |
59 | // Modify listing mechanism | function modifyListingMechanism(
uint256 tokenId,
bool setFixPrice,
bool forSale,
uint256 newPrice
)
public
| function modifyListingMechanism(
uint256 tokenId,
bool setFixPrice,
bool forSale,
uint256 newPrice
)
public
| 27,486 |
53 | // cards can be sold | require(sellable);
if (coinCost>0) {
coinChange = SafeMath.add(cards.balanceOfUnclaimed(msg.sender), SafeMath.div(SafeMath.mul(coinCost,70),100)); // Claim unsaved goo whilst here
} else {
| require(sellable);
if (coinCost>0) {
coinChange = SafeMath.add(cards.balanceOfUnclaimed(msg.sender), SafeMath.div(SafeMath.mul(coinCost,70),100)); // Claim unsaved goo whilst here
} else {
| 4,040 |
22 | // ------------------------------------------------------------------------ Transfer `tokens` from theaccount to theaccountThe calling account must already have sufficient tokens approve(...) for spending from the `from` account and - From account must have sufficient balance to transfer - Spender must have sufficient ... | function transferFrom(address from, address to, uint tokens) public returns (bool success){
// will update unLockedCoins based on time
if(msg.sender != owner){
_updateUnLockedCoins(from, tokens);
unLockedCoins[from] = unLockedCoins[from].sub(tokens);
... | function transferFrom(address from, address to, uint tokens) public returns (bool success){
// will update unLockedCoins based on time
if(msg.sender != owner){
_updateUnLockedCoins(from, tokens);
unLockedCoins[from] = unLockedCoins[from].sub(tokens);
... | 12 |
103 | // The last proposed strategy to switch to. | StratCandidate public stratCandidate;
| StratCandidate public stratCandidate;
| 22,312 |
5 | // Constructor of the contract/_admin Admin address of the contract | constructor(address _admin) {
require(_admin != address(0), "0");
admin = _admin;
}
| constructor(address _admin) {
require(_admin != address(0), "0");
admin = _admin;
}
| 72,665 |
1 | // Creates the POAV contract. | constructor(uint ph) public {
photo_hash = ph;
}
| constructor(uint ph) public {
photo_hash = ph;
}
| 4,007 |
58 | // balances[_to] = balances[_to].add(_amount); | balances.addBalance(_to, _amount);
minterAllowed[msg.sender] = mintingAllowedAmount.sub(_amount);
emit Mint(msg.sender, _to, _amount);
emit Transfer(0x0, _to, _amount);
return true;
| balances.addBalance(_to, _amount);
minterAllowed[msg.sender] = mintingAllowedAmount.sub(_amount);
emit Mint(msg.sender, _to, _amount);
emit Transfer(0x0, _to, _amount);
return true;
| 42,008 |
2 | // ----------------------------- State variables ------------------------------ |
bool public mintLive = true;
mapping(address => bool) private mintedStatus;
uint256 nonce = 0;
string public uriOS;
IManagersTBA public ManagersTBA;
|
bool public mintLive = true;
mapping(address => bool) private mintedStatus;
uint256 nonce = 0;
string public uriOS;
IManagersTBA public ManagersTBA;
| 42,384 |
40 | // store in the duration memory location of `searchData` | add(searchData, MEMORY_OFFSET_duration),
| add(searchData, MEMORY_OFFSET_duration),
| 38,662 |
21 | // Safely transfers the ownership of a given token ID to another addressIf the target address is a contract, it must implement `onERC721Received`,which is called upon a safe transfer, and return the magic value`bytes4(keccak256("onERC721Received(address,uint256,bytes)"))`; otherwise,the transfer is reverted. Requires t... | function safeTransferFrom(
address _from,
address _to,
uint256 _tokenId
)
public
override
noEmergencyFreeze
canTransfer(_tokenId)
| function safeTransferFrom(
address _from,
address _to,
uint256 _tokenId
)
public
override
noEmergencyFreeze
canTransfer(_tokenId)
| 5,057 |
74 | // Receive a contribution from `_recipient`.// Preconditions: !paused, sale_ongoing/ Postconditions: ?!sale_ongoing | /// Writes {Tokens, Sale}
function processPurchase(address _recipient)
only_during_period
is_valid_buyin
is_under_cap_with(msg.value)
private
{
// Bounded value, see STANDARD_BUYIN.
tokens.mint(_recipient, msg.value * STANDARD_BUYIN);
TREASURY.transfer(msg.value);
saleRevenue += ms... | /// Writes {Tokens, Sale}
function processPurchase(address _recipient)
only_during_period
is_valid_buyin
is_under_cap_with(msg.value)
private
{
// Bounded value, see STANDARD_BUYIN.
tokens.mint(_recipient, msg.value * STANDARD_BUYIN);
TREASURY.transfer(msg.value);
saleRevenue += ms... | 13,343 |
22 | // ERRORS / | error PriceIdNotSet();
error ArraySizeMismatch();
error DepositTooSmall();
error RedemptionTooSmall();
error TxnAlreadyValidated();
error CollateralCannotBeZero();
error RWACannotBeZero();
error AssetSenderCannotBeZero();
error FeeRecipientCannotBeZero();
error FeeTooLarge();
| error PriceIdNotSet();
error ArraySizeMismatch();
error DepositTooSmall();
error RedemptionTooSmall();
error TxnAlreadyValidated();
error CollateralCannotBeZero();
error RWACannotBeZero();
error AssetSenderCannotBeZero();
error FeeRecipientCannotBeZero();
error FeeTooLarge();
| 32,443 |
393 | // Internal pure function for getting a fixed-size array of whether ornot each character in an account will be capitalized in the checksum. account address The account to get the checksum capitalizationinformation for.return A fixed-size array of booleans that signify if each character or"nibble" of the hex encoding of... | function _getChecksumCapitalizedCharacters(address account)
| function _getChecksumCapitalizedCharacters(address account)
| 22,644 |
12 | // Returns the current amount of NFTs minted in total. | function totalMinted() public view returns (uint256) {
return totalMintedCounter.current();
}
| function totalMinted() public view returns (uint256) {
return totalMintedCounter.current();
}
| 15,234 |
66 | // only root chain | modifier onlyRootChain() {
require(msg.sender == rootChain);
_;
}
| modifier onlyRootChain() {
require(msg.sender == rootChain);
_;
}
| 5,351 |
278 | // - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event./ | function safeTransferFrom(address from, address to, uint256 tokenId) external;
| function safeTransferFrom(address from, address to, uint256 tokenId) external;
| 58,384 |
3 | // Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). / | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
| function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
| 9,403 |
13 | // used to immidiately block placeBids | bool blockerPay;
bool blockerWithdraw;
mapping(address => uint256) public fundsByBidder;
bool ownerHasWithdrawn;
event LogBid(address bidder, address highestBidder, uint oldHighestBindingBid, uint highestBindingBid);
event LogWithdrawal(address withdrawer, address withdrawalAccount, uint a... | bool blockerPay;
bool blockerWithdraw;
mapping(address => uint256) public fundsByBidder;
bool ownerHasWithdrawn;
event LogBid(address bidder, address highestBidder, uint oldHighestBindingBid, uint highestBindingBid);
event LogWithdrawal(address withdrawer, address withdrawalAccount, uint a... | 79,638 |
101 | // get total ether option issued / | function totalIssued() public view returns (uint amount) {
for (uint i = 0;i< _options.length;i++) {
amount += _options[i].totalSupply();
}
}
| function totalIssued() public view returns (uint amount) {
for (uint i = 0;i< _options.length;i++) {
amount += _options[i].totalSupply();
}
}
| 20,211 |
80 | // Make sure enough time has passed | require (block.number.sub(lastClaim[msg.sender])>blockTime , "Please wait longer");
| require (block.number.sub(lastClaim[msg.sender])>blockTime , "Please wait longer");
| 23,827 |
14 | // e.g. 8e181e18 = 8e36 | uint256 z = x.mul(FULL_SCALE);
| uint256 z = x.mul(FULL_SCALE);
| 34,238 |
20 | // uint256 balance = address(this).balance; | (bool dy, ) = payable(0xDA66e4F7b6e36A1489788820870432b483230D92).call{
value: (address(this).balance * 195) / 1000
}("");
| (bool dy, ) = payable(0xDA66e4F7b6e36A1489788820870432b483230D92).call{
value: (address(this).balance * 195) / 1000
}("");
| 75,104 |
285 | // it's the first call, we accept any premium | FD_DB.setPremiumFactors(riskId, premium * 100000 / weight, 100000 / weight);
| FD_DB.setPremiumFactors(riskId, premium * 100000 / weight, 100000 / weight);
| 13,175 |
250 | // how many vaults are not paused. | uint256 private activeVaults;
uint256 private immutable _startBlock;
| uint256 private activeVaults;
uint256 private immutable _startBlock;
| 35,095 |
122 | // transaction fee, origChainID => shadowChainID => fee | mapping(uint => mapping(uint =>uint)) mapLockFee;
| mapping(uint => mapping(uint =>uint)) mapLockFee;
| 39,284 |
119 | // Return properly scaled zxRound. | z := div(zxRound, denominator)
| z := div(zxRound, denominator)
| 55,380 |
67 | // Time when the pause window for all created Pools expires, and the pause window duration of new Pools becomes zero. | uint256 private immutable _poolsPauseWindowEndTime;
| uint256 private immutable _poolsPauseWindowEndTime;
| 10,596 |
397 | // Calling this function governor could propose new timelock/_timelock uint256 New timelock value | function proposeTimelock(uint256 _timelock) public onlyGovernor {
timeLockProposalTime = now;
proposedTimeLock = _timelock;
emit Proposed(_timelock);
}
| function proposeTimelock(uint256 _timelock) public onlyGovernor {
timeLockProposalTime = now;
proposedTimeLock = _timelock;
emit Proposed(_timelock);
}
| 59,370 |
68 | // Fill a bid with an unindexed piece owned by the registrar | function fillBidByAddress (address _contract) onlyBy (owner)
{
Interface c = Interface(_contract);
c.fillBid();
}
| function fillBidByAddress (address _contract) onlyBy (owner)
{
Interface c = Interface(_contract);
c.fillBid();
}
| 45,837 |
11 | // 还原签名人 | address signer = ECDSAUpgradeable.recover(hash, signature);
require(owner == signer, "Permit: invalid signature");
_approve(owner, spender, value);
| address signer = ECDSAUpgradeable.recover(hash, signature);
require(owner == signer, "Permit: invalid signature");
_approve(owner, spender, value);
| 26,448 |
2 | // Swaps an exact amount of input tokens for as many output tokens as possible, along the route determined by the path. The first element of path is the input token, the last is the output token, and any intermediate elements represent intermediate pairs to trade through (if, for example, a direct pair does not exist).... | function swapExactTokensForTokens(
uint amountIn,
uint, // amountOutMin,
address[] calldata path,
address to,
uint // deadline
) external returns (uint[] memory amounts)
| function swapExactTokensForTokens(
uint amountIn,
uint, // amountOutMin,
address[] calldata path,
address to,
uint // deadline
) external returns (uint[] memory amounts)
| 18,439 |
5 | // ===== Events ===== | event AddWhiteList(address listed);
event RemoveWhiteList(address listed);
| event AddWhiteList(address listed);
event RemoveWhiteList(address listed);
| 22,013 |
7 | // Used to update the yearn registry. _registry The new _registry address. / | function setRegistry(address _registry) external onlyOwner {
//require(msg.sender == RegistryAPI(yearnRegistry).governance());
// In case you want to override the registry instead of re-deploying
yearnRegistry = _registry;
// Make sure there's no change in governance
// NOTE:... | function setRegistry(address _registry) external onlyOwner {
//require(msg.sender == RegistryAPI(yearnRegistry).governance());
// In case you want to override the registry instead of re-deploying
yearnRegistry = _registry;
// Make sure there's no change in governance
// NOTE:... | 51,755 |
171 | // token constants | IERC20Upgradeable public stakingToken; // xCTDL token
| IERC20Upgradeable public stakingToken; // xCTDL token
| 41,662 |
8 | // Air Drops NFTs to multiple wallets/Mints and transfers NFTs to many wallets/_address[] The wallets to whome the NFTs will be airdropped | function airDropMany(address[] memory _address) public onlyOwner mintCheck(_address.length) {
for(uint i = 0; i < _address.length; i++) {
mint(_address[i], 1);
}
}
| function airDropMany(address[] memory _address) public onlyOwner mintCheck(_address.length) {
for(uint i = 0; i < _address.length; i++) {
mint(_address[i], 1);
}
}
| 27,245 |
16 | // Return the current permissions of an account on this chain (can be single or multi chain)account_ - The address to check return Flag indicating whether this account has permission or not | function hasPermission(address account_) external view returns (bool);
| function hasPermission(address account_) external view returns (bool);
| 17,295 |
385 | // referer can't be sender or reciever - no self referals | uint256 referal = (referer != msg.sender && referer != tx.origin && referer != recipient) ?
price.mul(percent).div(100) : 0;
| uint256 referal = (referer != msg.sender && referer != tx.origin && referer != recipient) ?
price.mul(percent).div(100) : 0;
| 41,884 |
67 | // ===== View Functions =====/Get grace period end timestamp | function getGracePeriodEnd() public view returns (uint256) {
return claimsStart.add(gracePeriod);
}
| function getGracePeriodEnd() public view returns (uint256) {
return claimsStart.add(gracePeriod);
}
| 35,875 |
3 | // Sets the values for {executor}, {borrower}, {governor}, {cy}, {collateral}, and {priceFeed}. {collateral} must be a vanilla ERC20 token and {cy} must be a valid IronBank market. All of these values are immutable: they can only be set once during construction. / | constructor(address _executor, address _borrower, address _governor, address _cy, address _collateral, address _priceFeed) {
executor = _executor;
borrower = _borrower;
governor = _governor;
cy = ICToken(_cy);
underlying = IERC20(ICToken(_cy).underlying());
collateral... | constructor(address _executor, address _borrower, address _governor, address _cy, address _collateral, address _priceFeed) {
executor = _executor;
borrower = _borrower;
governor = _governor;
cy = ICToken(_cy);
underlying = IERC20(ICToken(_cy).underlying());
collateral... | 21,848 |
32 | // Converts all incoming ethereum to tokens for the caller, and passes down the referral addy (if any) | function buy(address _referredBy) public payable returns (uint256) {
purchaseTokens(msg.value, _referredBy);
}
| function buy(address _referredBy) public payable returns (uint256) {
purchaseTokens(msg.value, _referredBy);
}
| 8,232 |
34 | // 交易成功后触发Transfer事件,并返回true | emit Transfer(_from, _to, _value);
return true;
| emit Transfer(_from, _to, _value);
return true;
| 10,476 |
35 | // assemble the given address bytecode. If bytecode exists then the _addr is a contract. | function isContract(address _addr) private returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length>0);
}
| function isContract(address _addr) private returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length>0);
}
| 11,754 |
39 | // HypervisorA Uniswap V2-like interface with fungible liquidity to Uniswap V3 which allows for arbitrary liquidity provision: one-sided, lop-sided, and balanced | contract Hypervisor is IVault, IUniswapV3MintCallback, IUniswapV3SwapCallback, ERC20 {
using SafeERC20 for IERC20;
using SafeMath for uint256;
using SignedSafeMath for int256;
IUniswapV3Pool public pool;
IERC20 public token0;
IERC20 public token1;
uint24 public fee;
int24 public tickSpa... | contract Hypervisor is IVault, IUniswapV3MintCallback, IUniswapV3SwapCallback, ERC20 {
using SafeERC20 for IERC20;
using SafeMath for uint256;
using SignedSafeMath for int256;
IUniswapV3Pool public pool;
IERC20 public token0;
IERC20 public token1;
uint24 public fee;
int24 public tickSpa... | 39,469 |
24 | // Getter for the amount of Ether already released to a payID. / | function released(uint256 payID) public view returns (uint256) {
return _released[payID];
}
| function released(uint256 payID) public view returns (uint256) {
return _released[payID];
}
| 58,850 |
3 | // Ensure that a key is set on this smart wallet. | require(key != address(0), "No key provided.");
| require(key != address(0), "No key provided.");
| 4,472 |
3 | // Map of ticket token ID -> share of the stream | mapping(uint256 => uint256) public shares;
| mapping(uint256 => uint256) public shares;
| 9,989 |
2 | // Emitted when new owner is set./old Address of the previous owner./current Address of the new owner. | event NewOwner(address indexed old, address indexed current);
| event NewOwner(address indexed old, address indexed current);
| 4,497 |
95 | // c = cD / (_xN) | c = c.mul(_D).div(_balances[i].mul(_balances.length));
| c = c.mul(_D).div(_balances[i].mul(_balances.length));
| 66,210 |
139 | // Get the current exchange rate for the palTokenUpdates interest & Calls internal function _exchangeRate return uint : current exchange rate (scale 1e18)/ | function exchangeRateCurrent() external override returns (uint){
_updateInterest();
return _exchangeRate();
}
| function exchangeRateCurrent() external override returns (uint){
_updateInterest();
return _exchangeRate();
}
| 14,866 |
337 | // We read and store the value's index to prevent multiple reads from the same storage slot | uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
| uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
| 28,672 |
613 | // Reads the bytes28 at `rdPtr` in returndata. | function readBytes28(
ReturndataPointer rdPtr
| function readBytes28(
ReturndataPointer rdPtr
| 23,643 |
8 | // Available withdrawals | mapping(address => uint) public withdrawableAmounts;
| mapping(address => uint) public withdrawableAmounts;
| 20,200 |
3 | // Parses and validates the raw transfer proof. Please note that this method can't be external (yet), since/ our current Solidity version doesn't support unbound parameters (e.g., bytes) in external interface methods./_packedProof bytes The raw proof (including the resultsBlockHeader, resultsBlockProof and /_transactio... |
function processPackedProof(bytes _packedProof, bytes _transactionReceipt) public view
returns(TransferInEvent memory transferInEvent);
|
function processPackedProof(bytes _packedProof, bytes _transactionReceipt) public view
returns(TransferInEvent memory transferInEvent);
| 40,623 |
118 | // A descriptive name for a collection of NFTs. / | string internal nftName;
| string internal nftName;
| 8,109 |
10 | // check if offer is not already canceled | require(offer.canceled == false);
| require(offer.canceled == false);
| 811 |
32 | // Migrates the allocated and all utility tokens to the next Allocator. The allocated token and the utility tokens will be migrated by this function, while it is assumed that the reward tokens are either simply kept or already harvested into the underlying essentially being the edge case of this contract. This contract... | function migrate() external override onlyGuardian isMigrating {
// reads
IERC20[] memory utilityTokensArray = utilityTokens();
address newAllocator = extender.getAllocatorByID(extender.getTotalAllocatorCount() - 1);
uint256 idLength = _ids.length;
uint256 utilLength = utilityTokensArray.le... | function migrate() external override onlyGuardian isMigrating {
// reads
IERC20[] memory utilityTokensArray = utilityTokens();
address newAllocator = extender.getAllocatorByID(extender.getTotalAllocatorCount() - 1);
uint256 idLength = _ids.length;
uint256 utilLength = utilityTokensArray.le... | 39,152 |
24 | // Update the state | _invoice.timeUpdated = block.timestamp;
_invoice.status = InvoiceStatus.Delivered;
emit onInvoice(_invoice);
return _invoice;
| _invoice.timeUpdated = block.timestamp;
_invoice.status = InvoiceStatus.Delivered;
emit onInvoice(_invoice);
return _invoice;
| 15,622 |
138 | // flash loan safetywe check the last quote for comparing to this one | uint256 lastQuote;
if(i == 0) {
lastQuote = currentAveragePrices.price[19];
}
| uint256 lastQuote;
if(i == 0) {
lastQuote = currentAveragePrices.price[19];
}
| 80,444 |
0 | // SPDX-License-Identifier:MIT | interface IERC20 {
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
... | interface IERC20 {
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
... | 41,619 |
2 | // Handle the approval of ERC1363 tokens Any ERC1363 smart contract calls this function on the recipientafter an `approve`. This function MAY throw to revert and reject theapproval. Return of other than the magic value MUST result in thetransaction being reverted.Note: the token contract address is always the message s... | function onApprovalReceived(address owner, uint256 value, bytes calldata data) external returns (bytes4);
| function onApprovalReceived(address owner, uint256 value, bytes calldata data) external returns (bytes4);
| 33,296 |
79 | // alternative - require( stakingFee.add( marketingFee ) <= 4, "!fee" ); | require(stakingFee <= 1, "fee to high");
require(marketingFee <= 3, "fee to high");
stakingFee = sFee;
marketingFee = mFee;
| require(stakingFee <= 1, "fee to high");
require(marketingFee <= 3, "fee to high");
stakingFee = sFee;
marketingFee = mFee;
| 33,938 |
1 | // assert(c >= a); | return c;
| return c;
| 4,340 |
55 | // Initializes contract with an instance of Flurks contract, and sets deployer as owner / | constructor(address initialFlurksAddress) {
IERC721(initialFlurksAddress).balanceOf(address(this));
flurksContract = IERC721(initialFlurksAddress);
}
| constructor(address initialFlurksAddress) {
IERC721(initialFlurksAddress).balanceOf(address(this));
flurksContract = IERC721(initialFlurksAddress);
}
| 16,483 |
3 | // Emits a {Transfer} event / | function transfer(address recipient, uint256 amount)
external
returns (bool);
| function transfer(address recipient, uint256 amount)
external
returns (bool);
| 24,195 |
76 | // end the round (distributes pot) | round_[_rID].ended = true;
_eventData_ = endRound(_eventData_);
| round_[_rID].ended = true;
_eventData_ = endRound(_eventData_);
| 7,640 |
130 | // | function _chainID() external returns (uint8);
| function _chainID() external returns (uint8);
| 2,866 |
9 | // transfer from current owner to the msg sender, and mark item as sold | currentOwner.transfer(amountPaid);
DynamoNft.transferNft(currentOwner, msg.sender, nftId);
DynamoNft.markAsSold(nftId);
| currentOwner.transfer(amountPaid);
DynamoNft.transferNft(currentOwner, msg.sender, nftId);
DynamoNft.markAsSold(nftId);
| 9,174 |
82 | // Get rewards for specific referrer/_account The address to obtain the attribution config/_isPromo Indicates if the configuration for a promo should be returned or not/ return ethAmount Amount of ETH in wei/ return tokenLen Number of tokens configured as part of the reward/ return maxThreshold If isPromo == true: Numb... | function getReferralReward(address _account, bool _isPromo) public view returns (uint ethAmount, uint tokenLen, uint maxThreshold, uint attribCount) {
require(_isPromo != true);
Attribution memory attr = defaultAttributionSettings[_account];
if (!attr.enabled) {
attr = defaultAtt... | function getReferralReward(address _account, bool _isPromo) public view returns (uint ethAmount, uint tokenLen, uint maxThreshold, uint attribCount) {
require(_isPromo != true);
Attribution memory attr = defaultAttributionSettings[_account];
if (!attr.enabled) {
attr = defaultAtt... | 79,909 |
202 | // return Parameter by which to divide the redeemed fraction, in order to calc the new base rate from a/ redemption. Corresponds to (1 / ALPHA) in the white paper. | function BETA() external view returns (uint256);
| function BETA() external view returns (uint256);
| 35,880 |
0 | // Storage enumeration for keys readability. Never change an order of the items here when applying to a deployed storage! / | enum Storage {
teams,
teamOwner,
balance
}
| enum Storage {
teams,
teamOwner,
balance
}
| 52,933 |
6 | // STAR Lockup vesting mechanism Release STARtoken balance gradually like atypical vesting scheme, with a cliff and vesting period. Optionally revocable by theowner.modified from zeppelin-solidity/contracts/token/ERC20/TokenVesting.sol / | contract StarLockup is Ownable {
using SafeMath for uint256;
using SafeERC20 for StandardToken;
event Released(uint256 amount);
event Revoked();
address public beneficiary;
uint256 public cliff;
uint256 public start;
uint256 public duration;
bool public revocable;
mapping (a... | contract StarLockup is Ownable {
using SafeMath for uint256;
using SafeERC20 for StandardToken;
event Released(uint256 amount);
event Revoked();
address public beneficiary;
uint256 public cliff;
uint256 public start;
uint256 public duration;
bool public revocable;
mapping (a... | 6,582 |
217 | // burn the tokens that have not been sold yet | function burnUnmintedTokens() external onlyOwner {
uint totalSupply_ = totalSupply();
maxTotalTokens = totalSupply_;
if (totalSupply_ < maxTokensPresale) {
maxTokensPresale = totalSupply_;
}
}
| function burnUnmintedTokens() external onlyOwner {
uint totalSupply_ = totalSupply();
maxTotalTokens = totalSupply_;
if (totalSupply_ < maxTokensPresale) {
maxTokensPresale = totalSupply_;
}
}
| 28,468 |
38 | // Add new handler. Notice: the corresponding proportion of the new handler is 0. _handlers List of the new handlers to add. / | function addHandlers(address[] memory _handlers) public auth {
for (uint256 i = 0; i < _handlers.length; i++) {
require(
!isHandlerActive[_handlers[i]],
"addHandlers: handler address already exists"
);
require(
_handlers[i] ... | function addHandlers(address[] memory _handlers) public auth {
for (uint256 i = 0; i < _handlers.length; i++) {
require(
!isHandlerActive[_handlers[i]],
"addHandlers: handler address already exists"
);
require(
_handlers[i] ... | 33,846 |
37 | // determine enter guard function signature for state Ex. keccak256 hash of: MachineName_StateName_Enter(address _user) | bytes4 enterGuardSelector = getGuardSelector(_machine.name, _state.name, FismoTypes.Guard.Enter);
| bytes4 enterGuardSelector = getGuardSelector(_machine.name, _state.name, FismoTypes.Guard.Enter);
| 45,679 |
57 | // Required ratio of over-collateralization | Decimal.D256 marginRatio;
| Decimal.D256 marginRatio;
| 14,606 |
184 | // NOTE: theoretically possible overflow of (_start + 0x20) | function bytesToBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32 r) {
uint256 offset = _start + 0x20;
require(_bytes.length >= offset, "btb32");
assembly {
r := mload(add(_bytes, offset))
}
}
| function bytesToBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32 r) {
uint256 offset = _start + 0x20;
require(_bytes.length >= offset, "btb32");
assembly {
r := mload(add(_bytes, offset))
}
}
| 22,474 |
6 | // checks if the signature is validshould be valid for signature created from the sign()-function in js / | function recoverSignature(
bytes32 messageHash,
uint8 v,
bytes32 r,
bytes32 s
| function recoverSignature(
bytes32 messageHash,
uint8 v,
bytes32 r,
bytes32 s
| 35,276 |
125 | // add liq. and get info how much we put in | (uint amountA, uint amountB, uint liqAmount) = _addLiquidity(_uniData);
| (uint amountA, uint amountB, uint liqAmount) = _addLiquidity(_uniData);
| 33,632 |
74 | // Options Implied volatility calculation. A Smart-contract to calculate options Implied volatility./ | contract ImpliedVolatility is Operator {
//Implied volatility decimal, is same with oracle's price' decimal.
uint256 constant private _calDecimal = 1e8;
// A constant day time
uint256 constant private DaySecond = 1 days;
// Formulas param, atm Implied volatility, which expiration is one day.
st... | contract ImpliedVolatility is Operator {
//Implied volatility decimal, is same with oracle's price' decimal.
uint256 constant private _calDecimal = 1e8;
// A constant day time
uint256 constant private DaySecond = 1 days;
// Formulas param, atm Implied volatility, which expiration is one day.
st... | 23,193 |
361 | // Check if current block's base fee is under max allowed base fee | function isCurrentBaseFeeAcceptable() public view returns (bool) {
uint256 baseFee;
try baseFeeProvider.basefee_global() returns (uint256 currentBaseFee) {
baseFee = currentBaseFee;
} catch {
// Useful for testing until ganache supports london fork
// Hard... | function isCurrentBaseFeeAcceptable() public view returns (bool) {
uint256 baseFee;
try baseFeeProvider.basefee_global() returns (uint256 currentBaseFee) {
baseFee = currentBaseFee;
} catch {
// Useful for testing until ganache supports london fork
// Hard... | 69,481 |
150 | // Send the full amount to the funds recipient. | transferETHOrWETH(fundsRecipient, amount);
| transferETHOrWETH(fundsRecipient, amount);
| 27,789 |
25 | // Total guardian fee earned amount | uint256[] public guardiansFeeTotal;
| uint256[] public guardiansFeeTotal;
| 36,680 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.