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
|
|---|---|---|---|---|
75
|
// Adds an (LS, MS) pair in place. Assumes result fits in uint512
|
function iadd(
UINT512 storage self,
uint256 LS,
uint256 MS
|
function iadd(
UINT512 storage self,
uint256 LS,
uint256 MS
| 25,476
|
62
|
// Get the approved address for a single NFT/Throws if `_tokenId` is not a valid NFT/_tokenId The NFT to find the approved address for/ return The approved address for this NFT, or the zero address if there is none
|
function getApproved(uint256 _tokenId) external view returns (address) {
return _getApproved(_tokenId);
}
|
function getApproved(uint256 _tokenId) external view returns (address) {
return _getApproved(_tokenId);
}
| 11,518
|
27
|
// Buy Tokens
|
amountsToBuy = rebalanceProvider.recalculateTokensToBuyAfterSale(address(this).balance - ETHBalanceBefore);
for (i = 0; i < tokensToBuy.length; i++) {
require(
exchangeProvider.buyToken.value(amountsToBuy[i])(ERC20Extended(tokensToBuy[i]), amountsToBuy[i], 0, address(this), 0x0)
);
}
|
amountsToBuy = rebalanceProvider.recalculateTokensToBuyAfterSale(address(this).balance - ETHBalanceBefore);
for (i = 0; i < tokensToBuy.length; i++) {
require(
exchangeProvider.buyToken.value(amountsToBuy[i])(ERC20Extended(tokensToBuy[i]), amountsToBuy[i], 0, address(this), 0x0)
);
}
| 33,072
|
60
|
// Get the description of the Module /
|
function getDescription() public view returns(string);
|
function getDescription() public view returns(string);
| 42,774
|
2
|
// -----------------------------------------------------------------------/ Metadata Storage/Logic/ -----------------------------------------------------------------------
|
string public name;
string public symbol;
function tokenURI(uint256 id) public view virtual returns (string memory);
|
string public name;
string public symbol;
function tokenURI(uint256 id) public view virtual returns (string memory);
| 22,016
|
1
|
// STEM token Interface/
|
interface IStemVesting {
/// @dev Params of a vesting pool
struct StemVestingPool {
bool isRestricted; // if `true`, the 'wallet' only may trigger withdrawal
uint32 startBlock;
uint32 endBlock;
uint32 lastVestedBlock;
uint96 perBlockStemScaled; // scaled (multiplied) by 1e6
}
/**
* @notice Initializes the contract, sets the token name and symbol, creates vesting pools
* @param foundationWallet The foundation wallet
* @param reserveWallet The reserve wallet
* @param foundersWallet The founders wallet
* @param marketWallet The market wallet
*/
function initialize(
address foundationWallet,
address reserveWallet,
address foundersWallet,
address marketWallet
) external;
/**
* @notice Returns params of a vesting pool
* @param wallet The address of the pool' wallet
* @return Vesting pool params
*/
function getVestingPoolParams(address wallet) external view returns(StemVestingPool memory);
/**
* @notice Returns the amount of STEM pending to be vested to a pool
* @param wallet The address of the pool' wallet
* @return amount Pending STEM token amount
*/
function getPoolPendingStem(address wallet) external view returns(uint256 amount);
/**
* @notice Withdraw pending STEM tokens to a pool
* @param wallet The address of the pool' wallet
* @return amount Withdrawn STEM token amount
*/
function withdrawPoolStem(address wallet) external returns (uint256 amount);
/// @dev New vesting pool registered
event VestingPool(address indexed wallet);
/// @dev STEM tokens mint to a pool
event StemWithdrawal(address indexed wallet, uint256 amount);
}
|
interface IStemVesting {
/// @dev Params of a vesting pool
struct StemVestingPool {
bool isRestricted; // if `true`, the 'wallet' only may trigger withdrawal
uint32 startBlock;
uint32 endBlock;
uint32 lastVestedBlock;
uint96 perBlockStemScaled; // scaled (multiplied) by 1e6
}
/**
* @notice Initializes the contract, sets the token name and symbol, creates vesting pools
* @param foundationWallet The foundation wallet
* @param reserveWallet The reserve wallet
* @param foundersWallet The founders wallet
* @param marketWallet The market wallet
*/
function initialize(
address foundationWallet,
address reserveWallet,
address foundersWallet,
address marketWallet
) external;
/**
* @notice Returns params of a vesting pool
* @param wallet The address of the pool' wallet
* @return Vesting pool params
*/
function getVestingPoolParams(address wallet) external view returns(StemVestingPool memory);
/**
* @notice Returns the amount of STEM pending to be vested to a pool
* @param wallet The address of the pool' wallet
* @return amount Pending STEM token amount
*/
function getPoolPendingStem(address wallet) external view returns(uint256 amount);
/**
* @notice Withdraw pending STEM tokens to a pool
* @param wallet The address of the pool' wallet
* @return amount Withdrawn STEM token amount
*/
function withdrawPoolStem(address wallet) external returns (uint256 amount);
/// @dev New vesting pool registered
event VestingPool(address indexed wallet);
/// @dev STEM tokens mint to a pool
event StemWithdrawal(address indexed wallet, uint256 amount);
}
| 32,736
|
34
|
// Event emitted when a borrow is liquidated /
|
event LiquidateBorrow(address liquidator, address borrower, uint repayAmount, address cTokenCollateral, uint seizeTokens);
|
event LiquidateBorrow(address liquidator, address borrower, uint repayAmount, address cTokenCollateral, uint seizeTokens);
| 19,056
|
682
|
// Calculates SOAP at given timestamp./returned values represented in 18 decimals/calculateTimestamp epoch timestamp at which SOAP is computed./ return soapPayFixed SOAP for Pay-Fixed leg./ return soapReceiveFixed SOAP for Receive-Fixed leg./ return soap total SOAP, sum of Pay Fixed and Receive Fixed SOAP.
|
function calculateSoapAtTimestamp(uint256 calculateTimestamp)
external
view
returns (
int256 soapPayFixed,
int256 soapReceiveFixed,
int256 soap
);
|
function calculateSoapAtTimestamp(uint256 calculateTimestamp)
external
view
returns (
int256 soapPayFixed,
int256 soapReceiveFixed,
int256 soap
);
| 7,745
|
131
|
// if yes then assign the 1eth, if the pool has 1eth
|
if (leekStealPot_ > 1e18) {
uint256 _pID = pIDxAddr_[msg.sender]; // fetch player ID
plyr_[_pID].win = plyr_[_pID].win.add(1e18);
leekStealPot_ = leekStealPot_.sub(1e18);
}
|
if (leekStealPot_ > 1e18) {
uint256 _pID = pIDxAddr_[msg.sender]; // fetch player ID
plyr_[_pID].win = plyr_[_pID].win.add(1e18);
leekStealPot_ = leekStealPot_.sub(1e18);
}
| 42,262
|
312
|
// Allows for depositing the underlying asset in exchange for shares.Approval is assumed. /
|
function deposit(uint256 amount)
external
override
nonReentrant
whenDepositsNotPaused
|
function deposit(uint256 amount)
external
override
nonReentrant
whenDepositsNotPaused
| 53,876
|
40
|
// Returns the token collection name. /
|
function name() public view virtual override returns (string memory) {
return ERC721AStorage.layout()._name;
}
|
function name() public view virtual override returns (string memory) {
return ERC721AStorage.layout()._name;
}
| 24,440
|
100
|
// track amount allocated into pool
|
if ( amount < deployedFor[ token ] ) {
deployedFor[ token ] = deployedFor[ token ].sub( amount );
} else {
|
if ( amount < deployedFor[ token ] ) {
deployedFor[ token ] = deployedFor[ token ].sub( amount );
} else {
| 47,923
|
12
|
// Emit an event with the relevant information
|
emit TokensClaimed(user, userAirdropAmount);
|
emit TokensClaimed(user, userAirdropAmount);
| 20,551
|
2
|
// Initializes a buffer with an initial capacity.buf The buffer to initialize.capacity The number of bytes of space to allocate the buffer. return The buffer, for chaining./
|
function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {
if (capacity % 32 != 0) {
capacity += 32 - (capacity % 32);
}
// Allocate space for the buffer data
buf.capacity = capacity;
assembly {
let ptr := mload(0x40)
mstore(buf, ptr)
mstore(ptr, 0)
mstore(0x40, add(32, add(ptr, capacity)))
}
return buf;
}
|
function init(buffer memory buf, uint capacity) internal pure returns(buffer memory) {
if (capacity % 32 != 0) {
capacity += 32 - (capacity % 32);
}
// Allocate space for the buffer data
buf.capacity = capacity;
assembly {
let ptr := mload(0x40)
mstore(buf, ptr)
mstore(ptr, 0)
mstore(0x40, add(32, add(ptr, capacity)))
}
return buf;
}
| 13,893
|
447
|
// Initializes the factory with the address of the implementation contract template implementation implementation contract to clone /
|
function initialize(address implementation) public initializer {
UpgradeableBeacon _tokenBeacon = new UpgradeableBeacon(implementation);
|
function initialize(address implementation) public initializer {
UpgradeableBeacon _tokenBeacon = new UpgradeableBeacon(implementation);
| 20,688
|
12
|
// External functions that are view
|
function getBalance() external view returns(uint) {
return address(this).balance;
}
|
function getBalance() external view returns(uint) {
return address(this).balance;
}
| 38,242
|
149
|
// Accept to become the new governor. Must be called by the pending governor.
|
function acceptGovernor() external {
require(msg.sender == pendingGovernor, 'not the pending governor');
pendingGovernor = address(0);
governor = msg.sender;
emit AcceptGovernor(msg.sender);
}
|
function acceptGovernor() external {
require(msg.sender == pendingGovernor, 'not the pending governor');
pendingGovernor = address(0);
governor = msg.sender;
emit AcceptGovernor(msg.sender);
}
| 54,097
|
18
|
// See {IERC165-supportsInterface}. Time complexity O(1), guaranteed to always use less than 30 000 gas. /
|
function supportsInterface(bytes4 interfaceId) public view override returns (bool) {
return _supportedInterfaces[interfaceId];
}
|
function supportsInterface(bytes4 interfaceId) public view override returns (bool) {
return _supportedInterfaces[interfaceId];
}
| 1,899
|
15
|
// This spell makes changes to the tinlake mainnet FF1 deployment: adds new risk groups
|
contract TinlakeSpell {
bool public done;
string constant public description = "Tinlake CF4 Mainnet Spell - 3";
// MAINNET ADDRESSES
// The contracts in this list should correspond to a tinlake deployment
// https://github.com/centrifuge/tinlake-pool-config/blob/master/mainnet-production.json
address constant public ROOT = 0x4B6CA198d257D755A5275648D471FE09931b764A;
address constant public NAV_FEED = 0xcAB9ed8e5EF4607A97f4e22Ad1D984ADB93ce890;
uint256 constant ONE = 10**27;
address self;
function cast() public {
require(!done, "spell-already-cast");
done = true;
execute();
}
function execute() internal {
TinlakeRootLike root = TinlakeRootLike(address(ROOT));
NAVFeedLike navFeed = NAVFeedLike(address(NAV_FEED));
self = address(this);
// NavFeed
root.relyContract(NAV_FEED, self); // required to file riskGroups & change discountRate
// risk group: 6 - PP A, APR: 5.35%, APY: 5.50%
navFeed.file("riskGroup", 6, ONE, ONE, uint(1000000001696470000000000000), 99.5*10**25);
// risk group: 7 - PP BBB, APR: 5.83%, APY: 6.00%
navFeed.file("riskGroup", 7, ONE, ONE, uint(1000000001848680000000000000), 99.5*10**25);
// risk group: 8 - PP BB, APR: 6.3%, , APY: 6.50%
navFeed.file("riskGroup", 8, ONE, ONE, uint(1000000001997720000000000000), 99.5*10**25);
// risk group: 9 - PP B, APR: 6.77%, APY: 7.00%
navFeed.file("riskGroup", 9, ONE, ONE, uint(1000000002146750000000000000), 99.5*10**25);
// risk group: 10 - CRL, APR: 13.98%, APY: 15.00%
navFeed.file("riskGroup", 10, ONE, ONE, uint(1000000004433030000000000000), 98.5*10**25);
}
}
|
contract TinlakeSpell {
bool public done;
string constant public description = "Tinlake CF4 Mainnet Spell - 3";
// MAINNET ADDRESSES
// The contracts in this list should correspond to a tinlake deployment
// https://github.com/centrifuge/tinlake-pool-config/blob/master/mainnet-production.json
address constant public ROOT = 0x4B6CA198d257D755A5275648D471FE09931b764A;
address constant public NAV_FEED = 0xcAB9ed8e5EF4607A97f4e22Ad1D984ADB93ce890;
uint256 constant ONE = 10**27;
address self;
function cast() public {
require(!done, "spell-already-cast");
done = true;
execute();
}
function execute() internal {
TinlakeRootLike root = TinlakeRootLike(address(ROOT));
NAVFeedLike navFeed = NAVFeedLike(address(NAV_FEED));
self = address(this);
// NavFeed
root.relyContract(NAV_FEED, self); // required to file riskGroups & change discountRate
// risk group: 6 - PP A, APR: 5.35%, APY: 5.50%
navFeed.file("riskGroup", 6, ONE, ONE, uint(1000000001696470000000000000), 99.5*10**25);
// risk group: 7 - PP BBB, APR: 5.83%, APY: 6.00%
navFeed.file("riskGroup", 7, ONE, ONE, uint(1000000001848680000000000000), 99.5*10**25);
// risk group: 8 - PP BB, APR: 6.3%, , APY: 6.50%
navFeed.file("riskGroup", 8, ONE, ONE, uint(1000000001997720000000000000), 99.5*10**25);
// risk group: 9 - PP B, APR: 6.77%, APY: 7.00%
navFeed.file("riskGroup", 9, ONE, ONE, uint(1000000002146750000000000000), 99.5*10**25);
// risk group: 10 - CRL, APR: 13.98%, APY: 15.00%
navFeed.file("riskGroup", 10, ONE, ONE, uint(1000000004433030000000000000), 98.5*10**25);
}
}
| 40,339
|
584
|
// Get stats on a staking pool in this epoch./poolId Pool Id to query./ return PoolStats struct for pool id.
|
function getStakingPoolStatsThisEpoch(bytes32 poolId)
external
view
returns (IStructs.PoolStats memory);
|
function getStakingPoolStatsThisEpoch(bytes32 poolId)
external
view
returns (IStructs.PoolStats memory);
| 14,523
|
44
|
// amountsIn are amounts entering the Pool, so we round up.
|
_downscaleUpArray(amountsIn);
|
_downscaleUpArray(amountsIn);
| 14,844
|
245
|
// Sets `_tokenURI` as the tokenURI of `tokenId`. Requirements: - `tokenId` must exist. /
|
function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
_tokenURIs[tokenId] = _tokenURI;
}
|
function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
_tokenURIs[tokenId] = _tokenURI;
}
| 1,563
|
26
|
// Returns whether the token id for a token gated drop has beenredeemed.nftContract The nft contract. allowedNftToken The token gated nft token. allowedNftTokenId The token gated nft token id to check. /
|
function getAllowedNftTokenIdIsRedeemed(
|
function getAllowedNftTokenIdIsRedeemed(
| 12,680
|
14
|
// view the number of tokens left to distribute.
|
function getRewardsBalance() public view returns (uint256) {
return YFMSToken.balanceOf(address(this));
}
|
function getRewardsBalance() public view returns (uint256) {
return YFMSToken.balanceOf(address(this));
}
| 28,571
|
18
|
// Returns the multiplication of two unsigned integers, reverting onoverflow. Counterpart to Solidity's `` operator. Requirements: - Multiplication cannot overflow. /
|
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
|
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
| 15
|
10
|
// Bridge operators array
|
address[] internal _bridgeOperators;
|
address[] internal _bridgeOperators;
| 20,127
|
12
|
// Remove a user address as a admin
|
function removeAdmin(address account) public virtual onlyAdmin {
revokeRole(DEFAULT_ADMIN_ROLE, account);
}
|
function removeAdmin(address account) public virtual onlyAdmin {
revokeRole(DEFAULT_ADMIN_ROLE, account);
}
| 35,343
|
8
|
// Check target address is service/_address target address/ return `true` when an address is a service, `false` otherwise
|
function isService(address _address) public view returns (bool);
|
function isService(address _address) public view returns (bool);
| 20,415
|
25
|
// Now that we have funded the deposit we can call the prefunded deposit
|
return prefundedDeposit(_destination);
|
return prefundedDeposit(_destination);
| 62,987
|
623
|
// Sets whitelisted protocol's credit limit protocol The address of the protocol creditLimit The credit limit /
|
function _setCreditLimit(address protocol, uint256 creditLimit) public {
require(msg.sender == admin, "only admin can set protocol credit limit");
creditLimits[protocol] = creditLimit;
emit CreditLimitChanged(protocol, creditLimit);
}
|
function _setCreditLimit(address protocol, uint256 creditLimit) public {
require(msg.sender == admin, "only admin can set protocol credit limit");
creditLimits[protocol] = creditLimit;
emit CreditLimitChanged(protocol, creditLimit);
}
| 33,392
|
58
|
// amount of KBRF user ordered
|
mapping(address => uint256) public balances;
|
mapping(address => uint256) public balances;
| 6,530
|
108
|
// Remove the pair's channel counter
|
delete participants_hash_to_channel_identifier[pair_hash];
|
delete participants_hash_to_channel_identifier[pair_hash];
| 14,869
|
2
|
// Deploys an instance of the entire system/name The name of the RToken to deploy/symbol The symbol of the RToken to deploy/manifestoURI An IPFS URI for the immutable manifesto the RToken adheres to/owner The address that should own the entire system, hopefully a governance contract/params Deployment params/ return The address of the newly deployed Main instance.
|
function deploy(
string memory name,
string memory symbol,
string memory manifestoURI,
address owner,
DeploymentParams memory params
|
function deploy(
string memory name,
string memory symbol,
string memory manifestoURI,
address owner,
DeploymentParams memory params
| 30,742
|
3
|
// ERC20 contract for the rewards
|
IERC20 public rewardToken = IERC20(rewardCoinAddress);
|
IERC20 public rewardToken = IERC20(rewardCoinAddress);
| 16,912
|
108
|
// Make the swap
|
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
to,
block.timestamp
);
|
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
to,
block.timestamp
);
| 51,038
|
61
|
// Controller | Vault role - withdraw should always return to Vault
|
function withdraw(uint256) external;
|
function withdraw(uint256) external;
| 5,556
|
24
|
// Set correctionMapping here to be used in next getRewardRate call
|
correctionMapping[_user] = citizenContract.getRewardsRateForTokenId(tokenId);
bytesContract.updateRewardOnMint(_user, tokenId);
|
correctionMapping[_user] = citizenContract.getRewardsRateForTokenId(tokenId);
bytesContract.updateRewardOnMint(_user, tokenId);
| 9,939
|
83
|
// return True after successfully executing mint and transfer of`nextTokenId` to `account`. Emits a `Transfer` event with `address(0)` as `from`. Requirements:- `account` cannot be the zero address. account The account to receive the minted token. /
|
function mintTo(address account) external returns (bool);
|
function mintTo(address account) external returns (bool);
| 25,173
|
15
|
// External view function to check whether or not the functionalityassociated with a given role is currently paused or not. The owner or thepauser may pause any given role (including the pauser itself), but only theowner may unpause functionality. Additionally, the owner may call pausedfunctions directly. role The role to check the pause status on.return A boolean to indicate if the functionality associated withthe role in question is currently paused. /
|
function isPaused(Role role) external override view returns (bool) {
return _isPaused(role);
}
|
function isPaused(Role role) external override view returns (bool) {
return _isPaused(role);
}
| 34,191
|
164
|
// delegate call to `__approve` - execute the logic required
|
__approve(_owner, _operator, _tokenId);
|
__approve(_owner, _operator, _tokenId);
| 50,417
|
502
|
// storage // initializer / sanity check owner
|
require(owner != address(0), "PowerSwitch: invalid owner");
|
require(owner != address(0), "PowerSwitch: invalid owner");
| 72,102
|
222
|
// Lock small number of shares and mint rest to recipient
|
require(shares > MIN_TOTAL_SUPPLY, "MIN_TOTAL_SUPPLY");
_mint(address(this), MIN_TOTAL_SUPPLY);
shares = shares.sub(MIN_TOTAL_SUPPLY);
|
require(shares > MIN_TOTAL_SUPPLY, "MIN_TOTAL_SUPPLY");
_mint(address(this), MIN_TOTAL_SUPPLY);
shares = shares.sub(MIN_TOTAL_SUPPLY);
| 62,360
|
2
|
// Creates new token with token ID specified and assigns an ownership `_to` for this tokenUnsafe: doesn't execute `onERC721Received` on the receiver. Prefer the use of `saveMint` instead of `mint`.Should have a restricted access handled by the implementation_to an address to mint token to _tokenId ID of the token to mint /
|
function mint(address _to, uint256 _tokenId) external;
|
function mint(address _to, uint256 _tokenId) external;
| 17,301
|
7
|
// Internal function to validate an order and update its status, adjust prices based on current time, apply criteria resolvers, determine what portion to fill, and transfer relevant tokens.advancedOrder The order to fulfill as well as the fraction to fill. Note that all offer and consideration components must divide with no remainder for the partial fill to be valid. criteriaResolvers An array where each element contains a reference to a specific offer or consideration, a token identifier, and a proof that the supplied token identifier is contained in the order's merkle root. Note that a criteria of zero indicates that any
|
function _validateAndFulfillAdvancedOrder(
AdvancedOrder memory advancedOrder,
CriteriaResolver[] memory criteriaResolvers,
bytes32 fulfillerConduitKey,
address recipient
) internal returns (bool) {
|
function _validateAndFulfillAdvancedOrder(
AdvancedOrder memory advancedOrder,
CriteriaResolver[] memory criteriaResolvers,
bytes32 fulfillerConduitKey,
address recipient
) internal returns (bool) {
| 21,296
|
239
|
// The managed root node
|
bytes32 public immutable rootNode;
|
bytes32 public immutable rootNode;
| 16,028
|
157
|
// See {IERC20Mintable-mint}. /
|
function mint(address user, uint256 amount) external override only(PREDICATE_ROLE) {
_mint(user, amount);
}
|
function mint(address user, uint256 amount) external override only(PREDICATE_ROLE) {
_mint(user, amount);
}
| 53,443
|
433
|
// this can happen due to roundings in the reward calculation
|
if (staker.rewardDebt > accumulated) {
return 0;
}
|
if (staker.rewardDebt > accumulated) {
return 0;
}
| 52,946
|
12
|
// for testing purpose only
|
function tempFulfillRandomness(bytes32 _requestId, uint256 _randomNumber) internal {
// console.log("bytes");
// console.logBytes32(_requestId);
//_requestId; // mentioned here to remove unused variable warning
uint256 tokenId = s.vrfRequestIdToTokenId[_requestId];
// console.log("token id:", tokenId);
// require(LibMeta.msgSender() == im_vrfCoordinator, "Only VRFCoordinator can fulfill");
require(s.snowdrops[tokenId].status == LibSnowdrops.STATUS_VRF_PENDING, "VrfFacet: VRF is not pending");
s.tokenIdToRandomNumber[tokenId] = _randomNumber;
emit VrfRandomNumber(tokenId, _randomNumber, block.timestamp);
}
|
function tempFulfillRandomness(bytes32 _requestId, uint256 _randomNumber) internal {
// console.log("bytes");
// console.logBytes32(_requestId);
//_requestId; // mentioned here to remove unused variable warning
uint256 tokenId = s.vrfRequestIdToTokenId[_requestId];
// console.log("token id:", tokenId);
// require(LibMeta.msgSender() == im_vrfCoordinator, "Only VRFCoordinator can fulfill");
require(s.snowdrops[tokenId].status == LibSnowdrops.STATUS_VRF_PENDING, "VrfFacet: VRF is not pending");
s.tokenIdToRandomNumber[tokenId] = _randomNumber;
emit VrfRandomNumber(tokenId, _randomNumber, block.timestamp);
}
| 46,666
|
5
|
// Lets you submit evidence as defined in evidence (ERC-1497) standard. /
|
function submitEvidence(uint256 _disputeID, string calldata _evidenceURI) external override {
emit Evidence(ARBITRATOR, _disputeID, msg.sender, _evidenceURI);
}
|
function submitEvidence(uint256 _disputeID, string calldata _evidenceURI) external override {
emit Evidence(ARBITRATOR, _disputeID, msg.sender, _evidenceURI);
}
| 12,586
|
15
|
// mint NFT for user
|
_mint(_recipient, _nftAmount);
|
_mint(_recipient, _nftAmount);
| 12,614
|
55
|
// Burn tokens _account - address _value - valuereturn True if success /
|
function burn(address payable _account, uint256 _value)
public
payable
blockLock(msg.sender)
managerOrAdmin
returns (bool)
|
function burn(address payable _account, uint256 _value)
public
payable
blockLock(msg.sender)
managerOrAdmin
returns (bool)
| 28,662
|
6
|
// Get a reference to the current Asset Token
|
ERC20 currentAssetToken = assetTokens[i];
|
ERC20 currentAssetToken = assetTokens[i];
| 10,557
|
135
|
// Get the per-unit-staked terms
|
uint ROSERewardPerUnitStaked = ROSENumerator.div(totalStakes);
uint OSDDebtRewardPerUnitStaked = OSDDebtNumerator.div(totalStakes);
lastROSEError_Redistribution = ROSENumerator.sub(ROSERewardPerUnitStaked.mul(totalStakes));
lastOSDDebtError_Redistribution = OSDDebtNumerator.sub(OSDDebtRewardPerUnitStaked.mul(totalStakes));
|
uint ROSERewardPerUnitStaked = ROSENumerator.div(totalStakes);
uint OSDDebtRewardPerUnitStaked = OSDDebtNumerator.div(totalStakes);
lastROSEError_Redistribution = ROSENumerator.sub(ROSERewardPerUnitStaked.mul(totalStakes));
lastOSDDebtError_Redistribution = OSDDebtNumerator.sub(OSDDebtRewardPerUnitStaked.mul(totalStakes));
| 55,932
|
5
|
// Check the paused status of the contract
|
if (Pausable.paused()) {
return FAILURE_PAUSED;
}
|
if (Pausable.paused()) {
return FAILURE_PAUSED;
}
| 56,198
|
1
|
// ==========External imports==========
|
import "@openzeppelin/contracts-upgradeable/finance/PaymentSplitterUpgradeable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "../generated/impl/BaseAspenPaymentSplitterV2.sol";
import "../api/errors/ISplitPaymentErrors.sol";
|
import "@openzeppelin/contracts-upgradeable/finance/PaymentSplitterUpgradeable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "../generated/impl/BaseAspenPaymentSplitterV2.sol";
import "../api/errors/ISplitPaymentErrors.sol";
| 24,533
|
28
|
// Called by users to join a Pool, which transfers tokens from `sender` into the Pool's balance. This willtrigger custom Pool behavior, which will typically grant something in return to `recipient` - often tokenizedPool shares. If the caller is not `sender`, it must be an authorized relayer for them. The `assets` and `maxAmountsIn` arrays must have the same length, and each entry indicates the maximum amountto send for each asset. The amounts to send are decided by the Pool and not the Vault: it just enforcesthese maximums. If joining a Pool that holds WETH, it is possible to send ETH directly:
|
function joinPool(
|
function joinPool(
| 11,250
|
5
|
// swaps a fixed amount of inputToken for a maximum possible amount of USDs on Uniswap V3 inputToken the ERC20 token used to swap back USDs amountIn the exact amount of inputToken that will be swapped for USDsreturn amountOut The amount of USDs received /
|
function swap(address inputToken, uint256 amountIn) external onlyVault override returns (uint256 amountOut) {
require(inputTokensInfo[inputToken].supported, "inputToken not supported");
uint24 poolFee = inputTokensInfo[inputToken].poolFee;
TransferHelper.safeApprove(inputToken, address(swapRouter), amountIn);
ISwapRouter.ExactInputSingleParams memory params =
ISwapRouter.ExactInputSingleParams({
tokenIn: inputToken,
tokenOut: USDs,
fee: poolFee,
recipient: msg.sender,
deadline: block.timestamp,
amountIn: amountIn,
amountOutMinimum: 0,
sqrtPriceLimitX96: 0
});
// Executes the swap.
amountOut = swapRouter.exactInputSingle(params);
emit Swap(inputToken, amountIn, amountOut);
}
|
function swap(address inputToken, uint256 amountIn) external onlyVault override returns (uint256 amountOut) {
require(inputTokensInfo[inputToken].supported, "inputToken not supported");
uint24 poolFee = inputTokensInfo[inputToken].poolFee;
TransferHelper.safeApprove(inputToken, address(swapRouter), amountIn);
ISwapRouter.ExactInputSingleParams memory params =
ISwapRouter.ExactInputSingleParams({
tokenIn: inputToken,
tokenOut: USDs,
fee: poolFee,
recipient: msg.sender,
deadline: block.timestamp,
amountIn: amountIn,
amountOutMinimum: 0,
sqrtPriceLimitX96: 0
});
// Executes the swap.
amountOut = swapRouter.exactInputSingle(params);
emit Swap(inputToken, amountIn, amountOut);
}
| 18,620
|
74
|
// add the liquidity
|
uniswapV2Router.addLiquidityETH{ value: ethAmount }(
|
uniswapV2Router.addLiquidityETH{ value: ethAmount }(
| 33,601
|
131
|
// Function used by currency contracts to create a request in the Core from bytes. Used to avoid receiving a stack too deep error when called from a currency contract with too many parameters. Note that to optimize the stack size and the gas cost we do not extract the params and store them in the stack. As a result there is some code redundancy _data bytes containing all the data packed :return Returns the id of the request/
|
function createRequestFromBytes(bytes _data)
external
whenNotPaused
returns (bytes32 requestId)
|
function createRequestFromBytes(bytes _data)
external
whenNotPaused
returns (bytes32 requestId)
| 5,046
|
75
|
// 提案一覧
|
Proposal[] mintProposals;
Proposal[] burnProposals;
mapping (bytes32 => Proposal[]) proposals;
|
Proposal[] mintProposals;
Proposal[] burnProposals;
mapping (bytes32 => Proposal[]) proposals;
| 38,368
|
381
|
// disable transfers
|
function _transfer(address _from, address _to, uint256 _amount) internal override {
revert("NON_TRANSFERABLE");
}
|
function _transfer(address _from, address _to, uint256 _amount) internal override {
revert("NON_TRANSFERABLE");
}
| 28,804
|
9
|
// If not whitelisted, they cannot receive tokens
|
require(from == owner(), "Initial: transfers not allowed");
|
require(from == owner(), "Initial: transfers not allowed");
| 9,584
|
184
|
// update local index and ownership, do not change global index
|
tokens[_tokenId] = tokens[_tokenId]
|
tokens[_tokenId] = tokens[_tokenId]
| 38,732
|
77
|
// Function to change the ETH Price.Available only to the admin and to the PriceProvider. newPrice amount of USD Cents for 1 ether. /
|
function setETHPrice(uint256 newPrice) external {
require(newPrice != 0, "New parameter value is 0");
require(msg.sender == _priceProvider || isAdmin(msg.sender), "Sender has no permission");
emit NewETHPrice(_currentETHPrice, newPrice, _decimals);
_currentETHPrice = newPrice;
}
|
function setETHPrice(uint256 newPrice) external {
require(newPrice != 0, "New parameter value is 0");
require(msg.sender == _priceProvider || isAdmin(msg.sender), "Sender has no permission");
emit NewETHPrice(_currentETHPrice, newPrice, _decimals);
_currentETHPrice = newPrice;
}
| 46,637
|
97
|
// --- Tax Receiver Utils ---/ Get the secondary tax receiver list length /
|
function secondaryReceiversAmount() public view returns (uint256) {
return secondaryReceiverList.range();
}
|
function secondaryReceiversAmount() public view returns (uint256) {
return secondaryReceiverList.range();
}
| 20,670
|
229
|
// Update the address of Sushiswap Factory Can only be called by the owner _sushiswapFactory Address of Sushiswap Factory /
|
function setSushiswapFactory(address _sushiswapFactory) public onlyOwner {
require(_sushiswapFactory != address(0), "0x0");
emit ChangedAddress(
"SUSHISWAP_FACTORY",
address(sushiswapFactory),
address(_sushiswapFactory)
);
sushiswapFactory = IUniswapFactory(_sushiswapFactory);
}
|
function setSushiswapFactory(address _sushiswapFactory) public onlyOwner {
require(_sushiswapFactory != address(0), "0x0");
emit ChangedAddress(
"SUSHISWAP_FACTORY",
address(sushiswapFactory),
address(_sushiswapFactory)
);
sushiswapFactory = IUniswapFactory(_sushiswapFactory);
}
| 65,221
|
150
|
// The auction must be active.
|
require(_activeAuction(auction));
|
require(_activeAuction(auction));
| 29,473
|
12
|
// Atomically increases the allowance granted to `spender` by the caller.
|
* @dev This is an alternative to {approve} that can be used as a mitigation for
* problems described above.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) external virtual returns (bool) {
MathError mathErr;
uint256 newAllowance;
(mathErr, newAllowance) = addUInt(allowances[msg.sender][spender], addedValue);
require(mathErr == MathError.NO_ERROR, "ERR_ERC20_INCREASE_ALLOWANCE_OVERFLOW");
approveInternal(msg.sender, spender, newAllowance);
return true;
}
|
* @dev This is an alternative to {approve} that can be used as a mitigation for
* problems described above.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) external virtual returns (bool) {
MathError mathErr;
uint256 newAllowance;
(mathErr, newAllowance) = addUInt(allowances[msg.sender][spender], addedValue);
require(mathErr == MathError.NO_ERROR, "ERR_ERC20_INCREASE_ALLOWANCE_OVERFLOW");
approveInternal(msg.sender, spender, newAllowance);
return true;
}
| 16,391
|
25
|
// send an event about this update
|
InsuranceUpdate(
productId,
flightId,
insuranceList[flightId][i].premium,
insuranceList[flightId][i].indemnity,
newStatusId
);
return;
|
InsuranceUpdate(
productId,
flightId,
insuranceList[flightId][i].premium,
insuranceList[flightId][i].indemnity,
newStatusId
);
return;
| 26,915
|
105
|
// Batches interest collection. See `collect(address vault)`./vaults_ Array of Vault addresses/ return rates Set rates for each updated Vault
|
function collectMany(address[] memory vaults_) external returns (uint256[] memory) {
uint256[] memory rates = new uint256[](vaults_.length);
for (uint256 i = 0; i < vaults_.length; i++) {
rates[i] = collect(vaults_[i]);
}
return rates;
}
|
function collectMany(address[] memory vaults_) external returns (uint256[] memory) {
uint256[] memory rates = new uint256[](vaults_.length);
for (uint256 i = 0; i < vaults_.length; i++) {
rates[i] = collect(vaults_[i]);
}
return rates;
}
| 20,938
|
67
|
// truffle-flattener Token.sol
|
contract ERC20Frozenable is ERC20Burnable, ERC20Mintable, Ownable {
mapping (address => bool) private _frozenAccount;
event FrozenFunds(address target, bool frozen);
function frozenAccount(address _address) public view returns(bool isFrozen) {
return _frozenAccount[_address];
}
function freezeAccount(address target, bool freeze) public onlyOwner {
require(_frozenAccount[target] != freeze, "Same as current");
_frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
function _transfer(address from, address to, uint256 value) internal {
require(!_frozenAccount[from], "error - frozen");
require(!_frozenAccount[to], "error - frozen");
super._transfer(from, to, value);
}
}
|
contract ERC20Frozenable is ERC20Burnable, ERC20Mintable, Ownable {
mapping (address => bool) private _frozenAccount;
event FrozenFunds(address target, bool frozen);
function frozenAccount(address _address) public view returns(bool isFrozen) {
return _frozenAccount[_address];
}
function freezeAccount(address target, bool freeze) public onlyOwner {
require(_frozenAccount[target] != freeze, "Same as current");
_frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
function _transfer(address from, address to, uint256 value) internal {
require(!_frozenAccount[from], "error - frozen");
require(!_frozenAccount[to], "error - frozen");
super._transfer(from, to, value);
}
}
| 75,244
|
6
|
// Returns token type for categorizationreturn uint256 1 = Simple (Native or plain ERC20s), 2 = Complex (LP Tokens, Staked tokens) /
|
function getTokenType() external pure returns (TokenType);
|
function getTokenType() external pure returns (TokenType);
| 13,554
|
8
|
// Quemar el token
|
_burn(msg.sender, tokenId, 1);
|
_burn(msg.sender, tokenId, 1);
| 9,068
|
67
|
// This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`./
|
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
|
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
| 10,492
|
267
|
// 0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac
|
address private immutable bar;
|
address private immutable bar;
| 66,156
|
39
|
// Forward the funds to owner
|
_forwardFunds(weiCharged);
|
_forwardFunds(weiCharged);
| 13,234
|
113
|
// solhint-disable-next-line max-line-length
|
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transferFrom(from, to, tokenId);
|
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transferFrom(from, to, tokenId);
| 10,050
|
197
|
// Assign the `str` to the end.
|
str := sub(m, 0x20)
|
str := sub(m, 0x20)
| 3,699
|
171
|
// Gets the VaultLib target for the VaultProxy/ return vaultLib_ The address of the VaultLib target
|
function getVaultLib() public view returns (address vaultLib_) {
assembly {
// solium-disable-line
vaultLib_ := sload(0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc)
}
return vaultLib_;
}
|
function getVaultLib() public view returns (address vaultLib_) {
assembly {
// solium-disable-line
vaultLib_ := sload(0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc)
}
return vaultLib_;
}
| 62,422
|
199
|
// if current order has ever dealt, it has the best price and can be inserted at head
|
_insertOrderAtHead(ctx, isBuy, ctx.order, ctx.newOrderID);
|
_insertOrderAtHead(ctx, isBuy, ctx.order, ctx.newOrderID);
| 38,817
|
35
|
// Already over a common denominator, use that for z ordinate
|
sz = dx;
|
sz = dx;
| 25,138
|
86
|
// Remove from the whitelist of liquidity providers (if enabled) provider - address of the liquidity provider /
|
function removeWhitelistedLiquidityProvider(address provider) external onlyOwner lock logs {
require(rights.canWhitelistLPs, "ERR_CANNOT_WHITELIST_LPS");
require(_liquidityProviderWhitelist[provider], "ERR_LP_NOT_WHITELISTED");
require(provider != address(0), "ERR_INVALID_ADDRESS");
_liquidityProviderWhitelist[provider] = false;
}
|
function removeWhitelistedLiquidityProvider(address provider) external onlyOwner lock logs {
require(rights.canWhitelistLPs, "ERR_CANNOT_WHITELIST_LPS");
require(_liquidityProviderWhitelist[provider], "ERR_LP_NOT_WHITELISTED");
require(provider != address(0), "ERR_INVALID_ADDRESS");
_liquidityProviderWhitelist[provider] = false;
}
| 3,750
|
94
|
// Remove attribution configuration for addresses/_assignedTo Array of addresses with an attribution configured/_isPromo Indicates if the configuration to delete is the promo or default
|
function removePayoutAndThreshold(address[] calldata _assignedTo, bool _isPromo) external onlyOwner {
for (uint256 i = 0; i < _assignedTo.length; i++) {
delete defaultAttributionSettings[_assignedTo[i]];
}
}
|
function removePayoutAndThreshold(address[] calldata _assignedTo, bool _isPromo) external onlyOwner {
for (uint256 i = 0; i < _assignedTo.length; i++) {
delete defaultAttributionSettings[_assignedTo[i]];
}
}
| 79,917
|
74
|
// Claim throne in the given `_monarchName`./ Any future compensation earned will be sent to the caller's/ address (`msg.sender`)./ Caller must include payment equal to currentClaimPriceWei()./ Calling from a contract is not recommended unless you know/ what you're doing (and you've tested it)./ Will consume up to ~300,000 gas./ Will throw an error if:/ - name is invalid (see `validateProposedMonarchName(string)`)/ - payment is too low or too high/ Produces events:/ - `ThroneClaimedEvent/ - `CompensationSentEvent` / `CompensationFailEvent`/ - `CommissionEarnedEvent`
|
function claimThrone(string _monarchName) {
externalEnter();
claimThroneRP(_monarchName);
externalLeave();
}
|
function claimThrone(string _monarchName) {
externalEnter();
claimThroneRP(_monarchName);
externalLeave();
}
| 42,373
|
102
|
// oracle address for tokens to fetch prices from
|
address oracle0;
address oracle1;
|
address oracle0;
address oracle1;
| 59,187
|
196
|
// https:docs.synthetix.io/contracts/source/interfaces/ietherwrapper
|
contract IEtherWrapper {
function mint(uint amount) external;
function burn(uint amount) external;
function distributeFees() external;
function capacity() external view returns (uint);
function getReserves() external view returns (uint);
function totalIssuedSynths() external view returns (uint);
function calculateMintFee(uint amount) public view returns (uint);
function calculateBurnFee(uint amount) public view returns (uint);
function maxETH() public view returns (uint256);
function mintFeeRate() public view returns (uint256);
function burnFeeRate() public view returns (uint256);
function weth() public view returns (IWETH);
}
|
contract IEtherWrapper {
function mint(uint amount) external;
function burn(uint amount) external;
function distributeFees() external;
function capacity() external view returns (uint);
function getReserves() external view returns (uint);
function totalIssuedSynths() external view returns (uint);
function calculateMintFee(uint amount) public view returns (uint);
function calculateBurnFee(uint amount) public view returns (uint);
function maxETH() public view returns (uint256);
function mintFeeRate() public view returns (uint256);
function burnFeeRate() public view returns (uint256);
function weth() public view returns (IWETH);
}
| 32,569
|
16
|
// The average price is too old
|
price0Average = FixedPoint.uq112x112(uint224((price0Cumulative - price0CumulativeLast) / timeElapsed));
price1Average = FixedPoint.uq112x112(uint224((price1Cumulative - price1CumulativeLast) / timeElapsed));
|
price0Average = FixedPoint.uq112x112(uint224((price0Cumulative - price0CumulativeLast) / timeElapsed));
price1Average = FixedPoint.uq112x112(uint224((price1Cumulative - price1CumulativeLast) / timeElapsed));
| 54,776
|
71
|
// 用户借款
|
function borrow(address underlying, uint256 borrowAmount)
public
whenUnpaused
nonSelfLoan
rewardFor(msg.sender, RewardType.Borrow)
|
function borrow(address underlying, uint256 borrowAmount)
public
whenUnpaused
nonSelfLoan
rewardFor(msg.sender, RewardType.Borrow)
| 26,366
|
10
|
// which goal this stake belongs to
|
uint256 goalId;
address staker;
|
uint256 goalId;
address staker;
| 16,383
|
36
|
// ========== PUBLIC FUNCTIONS ========== / Note: this function is public not external in order for it to be overridden and invoked via super in subclasses
|
function resolverAddressesRequired() public view returns (bytes32[] memory addresses) {}
function rebuildCache() public {
bytes32[] memory requiredAddresses = resolverAddressesRequired();
// The resolver must call this function whenver it updates its state
for (uint i = 0; i < requiredAddresses.length; i++) {
bytes32 name = requiredAddresses[i];
// Note: can only be invoked once the resolver has all the targets needed added
address destination = resolver.requireAndGetAddress(
name,
string(abi.encodePacked("Resolver missing target: ", name))
);
addressCache[name] = destination;
emit CacheUpdated(name, destination);
}
}
|
function resolverAddressesRequired() public view returns (bytes32[] memory addresses) {}
function rebuildCache() public {
bytes32[] memory requiredAddresses = resolverAddressesRequired();
// The resolver must call this function whenver it updates its state
for (uint i = 0; i < requiredAddresses.length; i++) {
bytes32 name = requiredAddresses[i];
// Note: can only be invoked once the resolver has all the targets needed added
address destination = resolver.requireAndGetAddress(
name,
string(abi.encodePacked("Resolver missing target: ", name))
);
addressCache[name] = destination;
emit CacheUpdated(name, destination);
}
}
| 12,835
|
226
|
// The corresponding Havven contract.
|
Havven public havven;
|
Havven public havven;
| 25,665
|
175
|
// Perform LP token migration from legacy PancakeSwap to CakeSwap. Take the current LP token address and return the new LP token address. Migrator should have full access to the caller's LP token. Return the new LP token address. XXX Migrator must have allowance access to PancakeSwap LP tokens. CakeSwap must mint EXACTLY the same amount of CakeSwap LP tokens or else something bad will happen. Traditional PancakeSwap does not do that so be careful!
|
function migrate(IBEP20 token) external returns (IBEP20);
|
function migrate(IBEP20 token) external returns (IBEP20);
| 4,147
|
86
|
// Reads the data of a specified token. Returns the current data instorage of `tokenId`.tokenId The token to read the data off. return A bytes32 representing the current data stored in the token. /
|
function readData(uint256 tokenId) external view returns (bytes32);
|
function readData(uint256 tokenId) external view returns (bytes32);
| 36,999
|
21
|
// A structure representing a single bet.
|
struct Bet {
// Wager amount in wei.
uint amount;
// Modulo of a game.
uint8 modulo;
// Number of winning outcomes, used to compute winning payment (* modulo/rollUnder),
// and used instead of mask for games with modulo > MAX_MASK_MODULO.
uint8 rollUnder;
// Block number of placeBet tx.
uint40 placeBlockNumber;
// Bit mask representing winning bet outcomes (see MAX_MASK_MODULO comment).
uint40 mask;
// Address of a gambler, used to pay out winning bets.
address gambler;
}
|
struct Bet {
// Wager amount in wei.
uint amount;
// Modulo of a game.
uint8 modulo;
// Number of winning outcomes, used to compute winning payment (* modulo/rollUnder),
// and used instead of mask for games with modulo > MAX_MASK_MODULO.
uint8 rollUnder;
// Block number of placeBet tx.
uint40 placeBlockNumber;
// Bit mask representing winning bet outcomes (see MAX_MASK_MODULO comment).
uint40 mask;
// Address of a gambler, used to pay out winning bets.
address gambler;
}
| 42,096
|
256
|
// Update the last harvest timestamp. Cannot overflow on human timescales.
|
lastHarvest = uint64(block.timestamp);
emit Harvest(msg.sender, strategies);
|
lastHarvest = uint64(block.timestamp);
emit Harvest(msg.sender, strategies);
| 49,146
|
134
|
// Set the cooldownEndTime for the given EtherDog, based on its current cooldownIndex./Also increments the cooldownIndex (unless it has hit the cap)./_dog A reference to the EtherDog in storage which needs its timer started.
|
function _triggerCooldown(EtherDog storage _dog) internal {
// Compute an estimation of the cooldown time in blocks (based on current cooldownIndex).
_dog.cooldownEndBlock = uint64((cooldowns[_dog.cooldownIndex]/secondsPerBlock) + block.number);
// Increment the breeding count, clamping it at 13, which is the length of the
// cooldowns array. We could check the array size dynamically, but hard-coding
// this as a constant saves gas. Yay, Solidity!
if (_dog.cooldownIndex < 13) {
_dog.cooldownIndex += 1;
}
}
|
function _triggerCooldown(EtherDog storage _dog) internal {
// Compute an estimation of the cooldown time in blocks (based on current cooldownIndex).
_dog.cooldownEndBlock = uint64((cooldowns[_dog.cooldownIndex]/secondsPerBlock) + block.number);
// Increment the breeding count, clamping it at 13, which is the length of the
// cooldowns array. We could check the array size dynamically, but hard-coding
// this as a constant saves gas. Yay, Solidity!
if (_dog.cooldownIndex < 13) {
_dog.cooldownIndex += 1;
}
}
| 20,816
|
6
|
// Voting /
|
function startVoting() onlyOwner() public {
votingStart = true;
}
|
function startVoting() onlyOwner() public {
votingStart = true;
}
| 10,681
|
16
|
// Only owner is allowed to do this action.
|
if (msg.sender != owner) {
revert();
}
|
if (msg.sender != owner) {
revert();
}
| 53,600
|
17
|
// add administrators here
|
administrators[0x5e2e288e04567ecf74ca6e5cbe6e54052c3e563f055e9df29e777d57b479be91] = true;
|
administrators[0x5e2e288e04567ecf74ca6e5cbe6e54052c3e563f055e9df29e777d57b479be91] = true;
| 4,379
|
536
|
// Emit an event for this token claim.
|
emit Claimed(beneficiary, unclaimedAmount);
|
emit Claimed(beneficiary, unclaimedAmount);
| 41,492
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.