Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,608 changes: 1,511 additions & 97 deletions blockchain/contracts/abis/Staking.abi

Large diffs are not rendered by default.

2,103 changes: 1,814 additions & 289 deletions blockchain/contracts/abis/generated.ts

Large diffs are not rendered by default.

159 changes: 159 additions & 0 deletions blockchain/contracts/contracts/interfaces/IERC721.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

/**
* @dev Required interface of an ERC721 compliant contract.
* @dev This is an exact copy of the OpenZeppelin IERC721 interface EXCEPT for the supportsInterface function
* because diamond contracts already implement this via the DiamondLoupeFacet and this breaks some tools'
* ability to compile, for example WAGMI with `npx wagmi generate`.
*/
interface IERC721 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(
address indexed from,
address indexed to,
uint256 indexed tokenId
);

/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(
address indexed owner,
address indexed approved,
uint256 indexed tokenId
);

/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(
address indexed owner,
address indexed operator,
bool approved
);

/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);

/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);

/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved 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,
bytes calldata data
) external;

/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must 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;

/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
* or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
* understand this adds an external call which potentially creates a reentrancy vulnerability.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;

/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;

/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool approved) external;

/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(
uint256 tokenId
) external view returns (address operator);

/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(
address owner,
address operator
) external view returns (bool);
}
1 change: 0 additions & 1 deletion blockchain/contracts/contracts/lit-node/Staking.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { LibDiamond } from "../libraries/LibDiamond.sol";
import { IDiamondCut } from "../interfaces/IDiamondCut.sol";
import { IDiamondLoupe } from "../interfaces/IDiamondLoupe.sol";
import { IERC173 } from "../interfaces/IERC173.sol";
import { IERC165 } from "../interfaces/IERC165.sol";
import { ContractResolver } from "../lit-core/ContractResolver.sol";
import { LibStakingStorage } from "./Staking/LibStakingStorage.sol";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ contract FunctionSelectorHelper {

// View functions that are either public or external. These are included here not
// for invariant testing, but for interacting via the Handler-based invariant tests.
functionSignatures[14] = "balanceOf(address)";
functionSignatures[14] = "selfStakeBalanceOf(address)";
functionSignatures[15] = "getMinimumStake()";
functionSignatures[16] = "getMinimumSelfStake()";
functionSignatures[17] = "getMaximumStake()";
Expand All @@ -56,7 +56,7 @@ contract FunctionSelectorHelper {
returns (string[] memory)
{
// Define the function signatures
string[] memory functionSignatures = new string[](71);
string[] memory functionSignatures = new string[](73);

// View functions that are either public or external.
functionSignatures[0] = "epoch(uint256)";
Expand Down Expand Up @@ -120,14 +120,14 @@ contract FunctionSelectorHelper {
] = "getActiveUnkickedValidatorStructsAndCounts(uint256)";
functionSignatures[
43
] = "getTimelockInEpoch(address,(uint256,uint256,uint256,uint256,uint256,uint256,uint256,bool,bool,address),uint256)";
] = "getTimelockInEpoch(address,(uint256,uint256,uint256,uint256,uint256,uint256,uint256,bool,bool,address,uint256),uint256)";
functionSignatures[
44
] = "getStakeWeightInEpoch(address,uint256,address,uint256)";
functionSignatures[45] = "calculateStakeWeight(uint256,uint256)";
functionSignatures[
46
] = "getTokensStaked(address,(uint256,uint256,uint256,uint256,uint256,uint256,uint256,bool,bool,address),uint256)";
] = "getTokensStaked(address,(uint256,uint256,uint256,uint256,uint256,uint256,uint256,bool,bool,address,uint256),uint256)";
functionSignatures[47] = "getRewardEpochNumber(uint256)";
functionSignatures[48] = "pow(uint256,uint256)";
functionSignatures[
Expand Down Expand Up @@ -162,6 +162,9 @@ contract FunctionSelectorHelper {
functionSignatures[
70
] = "getUnfrozenStakeCountForUser(address,address)";
functionSignatures[71] = "getEmptyStakeRecordSlots(address,address)";
functionSignatures[72] = "getMostRecentStakeRecord(address,address)";

return functionSignatures;
}

Expand Down Expand Up @@ -371,6 +374,46 @@ contract FunctionSelectorHelper {

return selectors;
}

function getSignaturesStakingNFTFacet()
public
pure
returns (string[] memory)
{
string[] memory functionSignatures = new string[](13);
functionSignatures[0] = "balanceOf(address)";
functionSignatures[1] = "ownerOf(uint256)";
functionSignatures[
2
] = "safeTransferFrom(address,address,uint256,bytes)";
functionSignatures[3] = "safeTransferFrom(address,address,uint256)";
functionSignatures[4] = "transferFrom(address,address,uint256)";
functionSignatures[5] = "approve(address,uint256)";
functionSignatures[6] = "setApprovalForAll(address,bool)";
functionSignatures[7] = "tokenOfOwnerByIndex(address,uint256)";
functionSignatures[8] = "totalSupply()";
functionSignatures[9] = "getApproved(uint256)";
functionSignatures[10] = "isApprovedForAll(address,address)";
functionSignatures[11] = "ownershipChange(uint256)";
functionSignatures[12] = "tokenToStakeRecord(uint256)";

return functionSignatures;
}

function getSelectorsStakingNFTFacet()
public
pure
returns (bytes4[] memory)
{
string[] memory functionSignatures = getSignaturesStakingNFTFacet();
bytes4[] memory selectors = new bytes4[](functionSignatures.length);

for (uint256 i = 0; i < functionSignatures.length; i++) {
selectors[i] = bytes4(keccak256(bytes(functionSignatures[i])));
}

return selectors;
}
}

contract PriceFeedFunctionSelectorHelper {
Expand Down
Loading
Loading