Browse Source

first

master
yyy9608 1 year ago
commit
023e082fb2
  1. 14
      .gitignore
  2. 4847
      .openzeppelin/bsc-testnet.json
  3. 20
      README.md
  4. 20
      api.md
  5. 12
      contracts/FIL.sol
  6. 91
      contracts/NFT.sol
  7. 371
      contracts/Pledge.sol
  8. 38
      contracts/PledgeType.sol
  9. 50
      contracts/Pool.sol
  10. 130
      contracts/Utils.sol
  11. 12060
      contracts/artifacts/FIL.json
  12. 497
      contracts/artifacts/FIL_metadata.json
  13. 25463
      contracts/artifacts/NFT.json
  14. 977
      contracts/artifacts/NFT_metadata.json
  15. 35785
      contracts/artifacts/Pledge.json
  16. 1540
      contracts/artifacts/Pledge_metadata.json
  17. 8295
      contracts/artifacts/Pool.json
  18. 341
      contracts/artifacts/Pool_metadata.json
  19. 379159
      contracts/artifacts/build-info/8d0e5c975052deb663ed22afcb2b07ca.json
  20. 186719
      contracts/artifacts/build-info/92c57281e4d9fd200fc17e585928733f.json
  21. 47874
      contracts/artifacts/build-info/dcc38cb2ae3cb76a7fc09feb2cad87b0.json
  22. 719
      contracts/artifacts/build-info/e462fde05bc641e14c873346790abdd3.json
  23. 154206
      contracts/artifacts/build-info/e64da169d6494e9aeccb18a7e65b6e0c.json
  24. 219
      doc.md
  25. 3
      env-temp
  26. 43
      hardhat.config.ts
  27. 14221
      package-lock.json
  28. 32
      package.json
  29. 74
      scripts/deployProxy.ts
  30. 1138
      sync.block.js
  31. 195
      test/Pledge.ts
  32. 11
      tsconfig.json

14
.gitignore

@ -0,0 +1,14 @@
node_modules
.env
# Hardhat files
/cache
/artifacts
# TypeChain files
/typechain
/typechain-types
# solidity-coverage files
/coverage
/coverage.json

4847
.openzeppelin/bsc-testnet.json
File diff suppressed because it is too large
View File

20
README.md

@ -0,0 +1,20 @@
# Sample Hardhat Project
This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, and a script that deploys that contract.
Try running some of the following tasks:
```shell
npx hardhat help
npx hardhat test
REPORT_GAS=true npx hardhat test
npx hardhat node
npx hardhat run scripts/deploy.ts
```
<!--Deploy CHANGELIST -->
1.检查dayTime 86400
2.检查NFT的质押合约地址
3.检查Pool的质押合约地址
4.检查FIL的合约地址
5.检查.env配置

20
api.md

@ -0,0 +1,20 @@
### 質押合約API
```
NFT nftContract; // NFT合約
Pool poolContract; // 池子合約
ProductInfo[] public productInfo; //產品信息
uint256 nextTokenId = 1; //生成NFT ID
mapping(uint256 => PledgeType) pledges; // 質押信息,可變
mapping(address => RecommendObjType) public recommendObj; // 用戶綁定記錄
mapping(address => uint256[]) public invitationTokens; // 所有貢獻收益的tokenID
mapping(address => address[]) public invitationAddress; // 所有貢獻收益的地址
mapping(address => PledgeType[]) public pledgeRecords; //質押記錄 不可變
<!-- 獲取該地址的所有質押信息 -->
function getOwnerAllPledgeInfo( address _ownerAddress ) public view returns (PledgeType[] memory result)
<!-- 獲取質押產品信息 -->
function getProductInfo() public view returns (ProductInfo[] memory)
<!-- // 獲取該地址的所有質押信息 -->
```

12
contracts/FIL.sol

@ -0,0 +1,12 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
contract FIL is ERC20 {
constructor() ERC20("FilecoinDev","DFIL"){
_mint(msg.sender,10000000 * 10 ** decimals());
}
}

91
contracts/NFT.sol

@ -0,0 +1,91 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "./Utils.sol";
contract NFT is ERC721Enumerable {
address[] admins;
address public deployAddress;
bool first;
address public pledgeAddress;
uint256[] public blacks;
constructor(string memory name,string memory symbol) ERC721(name,symbol) {
require(first == false,"You can only use it once.");
admins.push(msg.sender);
deployAddress = msg.sender;
first = true;
}
modifier onlyAdmin(){
bool isAdmin = Utils.isAdmin(admins, msg.sender);
require(isAdmin == true , "For administrators only");
_;
}
modifier onlyNFTBlack(uint256 _tokenId){
bool _isBlack = Utils.isNftBlacks(blacks, _tokenId);
require(!_isBlack , "For administrators only");
_;
}
function mint(address to, uint256 tokenId) external {
require(msg.sender == pledgeAddress,"Only the Pledge Agreement can be used.");
require(tokenId>0,"NFT ID must be greater than 0");
_safeMint(to, tokenId);
}
function setPledgeAddress(address _pledgeAddr) external onlyAdmin{
pledgeAddress = _pledgeAddr;
}
function addAdmin(address[] memory _adds) external onlyAdmin {
require(_adds.length>0,"Must enter at least one address");
require(deployAddress == msg.sender,"Can only be called by the contract deployer");
for(uint256 i=0;i<_adds.length;i++){
address _item = _adds[i];
bool isExist = Utils.isAdmin(admins, _item);
require(!isExist,"Address already exists");
}
address[] memory _admins = Utils.addAdmin(admins, _adds);
admins = _admins;
}
function deleteAdmin(address[] memory _dels) external onlyAdmin {
bool isDeploy = Utils.isAdmin(_dels, deployAddress);
require(deployAddress == msg.sender,"Can only be called by the contract deployer");
require(isDeploy == false,"Unable to delete contract deployers");
require(_dels.length>0,"Must enter at least one address");
address[] memory _admins = Utils.deleteAdmin(admins, _dels);
admins = _admins;
}
function getAdmin() public view returns(address[] memory){
return admins;
}
function addBlacks(uint256[] memory _tokenIds) external {
require(msg.sender == pledgeAddress,"Only the Pledge Agreement can be used.");
uint256[] memory _tokens = Utils.addNftBlacks(blacks,_tokenIds);
blacks = _tokens;
}
function delBlacks(uint256[] memory _tokenIds) external {
require(msg.sender == pledgeAddress,"Only the Pledge Agreement can be used.");
uint256[] memory _tokens = Utils.deleteNftBlacks(blacks, _tokenIds);
blacks = _tokens;
}
function getBlacks() public view returns(uint256[] memory){
return blacks;
}
function _update(address to, uint256 tokenId, address auth) internal virtual override returns(address) {
bool _isBlack = Utils.isNftBlacks(blacks, tokenId);
require(!_isBlack,"Unable to Transfer, the NFT Tokend is blacklisted.");
return super._update(to,tokenId,auth);
}
}

371
contracts/Pledge.sol

@ -0,0 +1,371 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "./NFT.sol";
import "./Pool.sol";
import "./PledgeType.sol";
import "./Utils.sol";
contract Pledge is Initializable {
NFT nftContract;
Pool poolContract;
ProductInfo[] public productInfo;
mapping(uint256 => PledgeType) pledges;
mapping(address => PledgeType[]) public pledgeRecords;
mapping(uint256 => PledgeType) public invitationPledges;
mapping(address => RecommendObjType) public recommendObj;
mapping(address => uint256[]) public invitationTokens;
mapping(address => address[]) public invitationAddress;
mapping(address => PledgeWithdrawRecordType[]) public pledgeWithdrawRecord;
mapping(address => InvitationWithdrawRecordType[]) public invitationWithdrawRecord;
address[] public blackList;
address[] public whiteList;
mapping(address => PledgeType[]) public pledgeDestoryRecords;
uint256 public invitationRate;
uint256 public nextTokenId;
bool public pledgeStatus;
uint256 public dayTime;
function initialize(address nftAddress, address poolAddress) public initializer {
nftContract = NFT(nftAddress);
poolContract = Pool(poolAddress);
nextTokenId = 1;
invitationRate = 1;
pledgeStatus = false;
dayTime = 1 days;
productInfo.push(ProductInfo(180, 14));
productInfo.push(ProductInfo(270, 15));
productInfo.push(ProductInfo(360, 16));
}
modifier onlyAdmin (){
address[] memory _admins = nftContract.getAdmin();
bool _isAdmin = Utils.isAdmin(_admins, msg.sender);
require(_isAdmin == true,"For administrators only");
_;
}
modifier onlyBlacks (){
bool _isBlack = Utils.isAdmin(blackList, msg.sender);
require(_isBlack == false,"You've been blacklisted.");
_;
}
function getPledgeRecords(address _owner) public view returns(PledgeType[] memory){
return pledgeRecords[_owner];
}
function getPledgeWithdrawRecord(address _owner) public view returns(PledgeWithdrawRecordType[] memory){
return pledgeWithdrawRecord[_owner];
}
function getInvitationWithdrawRecord(address _owner) public view returns(InvitationWithdrawRecordType[] memory){
return invitationWithdrawRecord[_owner];
}
function getPledgeDestoryRecords(address _owner) public view returns(PledgeType[] memory){
return pledgeDestoryRecords[_owner];
}
function getProductInfo() public view returns (ProductInfo[] memory) {
return productInfo;
}
function getOwnerAllPledgeInfo( address _ownerAddress ) public view returns (PledgeType[] memory result) {
uint256[] memory tokens = getOwnerAllTokens(_ownerAddress);
result = new PledgeType[](tokens.length);
for (uint256 i = 0; i < tokens.length; i++) {
result[i] = pledges[tokens[i]];
}
return result;
}
function bindRecommend(address _referrer) internal {
require(recommendObj[msg.sender].key == address(0),"Already have recommenders");
require(msg.sender != _referrer ,"You can't recommend yourself.");
require(recommendObj[_referrer].referrer != msg.sender,"Can't recommend each other");
recommendObj[msg.sender] = RecommendObjType(
msg.sender,
_referrer,
block.timestamp,
0
);
invitationAddress[_referrer].push(msg.sender);
}
function setInvitationIncomes(PledgeType memory _pledge) internal {
address recommendAddr = recommendObj[msg.sender].referrer;
PledgeType memory _invitationPledge = _pledge;
_invitationPledge.rate = invitationRate;
uint256 amount = _invitationPledge.pledgeAmount;
uint256 rate = _invitationPledge.rate;
uint256 day = _invitationPledge.pledgeDay;
uint256 tokenId = _invitationPledge.tokenId;
uint256 contribute = (((amount * rate) / 365) * day) / 100;
recommendObj[msg.sender].contribute += contribute;
if (invitationTokens[recommendAddr].length == 0) {
invitationTokens[recommendAddr] = new uint256[](0);
}
if (invitationAddress[recommendAddr].length == 0) {
invitationAddress[recommendAddr] = new address[](0);
}
invitationTokens[recommendAddr].push(tokenId);
invitationPledges[tokenId] = _invitationPledge;
}
function pledge(uint256 amount, uint256 index, address _referrer) external onlyBlacks {
bool _isWhite = Utils.isAdmin(whiteList, msg.sender);
if(!_isWhite){
require(pledgeStatus == false,"The pledge is closed.");
}
require(amount >= 1, "Minimum pledge 1FIL");
require(index < productInfo.length, "Product does not exist");
poolContract.deposit(msg.sender, amount);
uint256 tokenId = nextTokenId++;
if (_referrer != address(0)) {
bindRecommend(_referrer);
}
ProductInfo memory item = productInfo[index];
uint256 startTime = block.timestamp;
uint256 endTime = block.timestamp + (item.day * dayTime);
nftContract.mint(msg.sender, tokenId);
PledgeType memory _pledge = PledgeType(tokenId,startTime,endTime,startTime,amount,item.rate,item.day,msg.sender,false);
pledges[tokenId] = _pledge;
pledgeRecords[msg.sender].push(_pledge);
if (recommendObj[msg.sender].key != address(0)) {
setInvitationIncomes(_pledge);
}
}
function getOwnerAllTokens( address _ownerAddress ) public view returns (uint256[] memory) {
uint256 nftAmount = nftContract.balanceOf(_ownerAddress);
uint256[] memory tokens = new uint256[](nftAmount);
for (uint256 i = 0; i < nftAmount; i++) {
tokens[i] = nftContract.tokenOfOwnerByIndex(_ownerAddress, i);
}
return tokens;
}
function calculateInterest( PledgeType memory _pledge ) public view returns (uint256) {
uint256 total_amount = _pledge.pledgeAmount;
uint256 currentTime = block.timestamp;
uint256 withdrawTime = _pledge.withdrawTime;
uint256 rate = _pledge.rate;
if(_pledge.endTime < currentTime){
currentTime = _pledge.endTime;
}
uint256 daysPassed = (currentTime - withdrawTime) / dayTime;
uint256 dailyShare = (((total_amount * rate) / 365) * daysPassed) / 100;
return dailyShare;
}
function getWithdrawbleAmount( address _owner ) public view returns (uint256) {
uint256[] memory tokens = getOwnerAllTokens(_owner);
if (tokens.length <= 0) return 0;
uint256 _total_interest = 0;
for (uint256 i = 0; i < tokens.length; i++) {
uint256 _tokenId = tokens[i];
PledgeType memory _item = pledges[_tokenId];
_total_interest += calculateInterest(_item);
}
return _total_interest;
}
function withdraAllInterest() external onlyBlacks {
uint256 _total_interest = getWithdrawbleAmount(msg.sender);
require(_total_interest > 0, "Withdrawal amount must be greater than 0");
uint256[] memory tokens = getOwnerAllTokens(msg.sender);
for(uint256 i=0;i<tokens.length;i++){
uint256 _withdrawTime = block.timestamp;
uint256 _tokenId = tokens[i];
require(!pledges[_tokenId].isBlack,"Unable to withdraw, the NFT Tokend is blacklisted.");
if(pledges[_tokenId].endTime < _withdrawTime){
_withdrawTime = pledges[_tokenId].endTime;
}
pledges[_tokenId].withdrawTime = _withdrawTime;
}
poolContract.withdraw(msg.sender, _total_interest);
pledgeWithdrawRecord[msg.sender].push(PledgeWithdrawRecordType(_total_interest,block.timestamp,0,0,2));
}
function withdrawInterest(uint256 tokenId) external onlyBlacks {
address _owner = nftContract.ownerOf(tokenId);
require(_owner == msg.sender,"It's not a contract.");
PledgeType memory data = pledges[tokenId];
require(!data.isBlack,"Unable to withdraw,the NFT Tokend is blacklisted.");
uint256 _interest = calculateInterest(data);
require(_interest > 0, "Withdrawal amount must be greater than 0");
uint256 _withdrawTime = block.timestamp;
if(data.endTime < _withdrawTime){
_withdrawTime = data.endTime;
}
poolContract.withdraw(msg.sender, _interest);
pledges[tokenId].withdrawTime = _withdrawTime;
pledgeWithdrawRecord[msg.sender].push(PledgeWithdrawRecordType(_interest,block.timestamp,data.tokenId,data.pledgeDay,1));
}
function getOwnerInvitationPledges( address addr ) public view returns (PledgeType[] memory result) {
uint256[] memory _tokens = invitationTokens[addr];
result = new PledgeType[](_tokens.length);
for (uint256 i = 0; i < _tokens.length; i++) {
uint256 _tokenId = _tokens[i];
result[i] = invitationPledges[_tokenId];
}
return result;
}
function getOwnerAllInvitationWithdrawAmout(address owner) public view returns(uint256){
uint256 _income = 0;
PledgeType[] memory _pledges = getOwnerInvitationPledges(owner);
for(uint256 i=0;i<_pledges.length;i++){
PledgeType memory data = _pledges[i];
_income += calculateInterest(data);
}
return _income;
}
function withdraInvitationAllInterest() external onlyBlacks {
uint256 _total_interest = getOwnerAllInvitationWithdrawAmout(msg.sender);
require(_total_interest > 0, "Withdrawal amount must be greater than 0");
uint256[] memory tokens = invitationTokens[msg.sender];
for(uint256 i=0;i<tokens.length;i++){
uint256 _withdrawTime = block.timestamp;
uint256 _tokenId = tokens[i];
if(invitationPledges[_tokenId].endTime < _withdrawTime){
_withdrawTime = invitationPledges[_tokenId].endTime;
}
invitationPledges[_tokenId].withdrawTime = _withdrawTime;
}
uint256 currentTime = block.timestamp;
poolContract.withdraw(msg.sender, _total_interest);
invitationWithdrawRecord[msg.sender].push(InvitationWithdrawRecordType(_total_interest,currentTime));
}
function withdrawInvitationInterest(uint256 tokenId) external onlyBlacks {
uint256[] memory _tokens = invitationTokens[msg.sender];
bool _owner = false;
for(uint256 i=0;i<_tokens.length;i++){
uint256 _tokenId = _tokens[i];
if(_tokenId == tokenId){
_owner = true;
break;
}
}
require(_owner == true,"It's not a contract.");
PledgeType memory data = invitationPledges[tokenId];
uint256 _interest = calculateInterest(data);
require(_interest > 0, "Withdrawal amount must be greater than 0");
uint256 _withdrawTime = block.timestamp;
if(data.endTime < _withdrawTime){
_withdrawTime = data.endTime;
}
poolContract.withdraw(msg.sender, _interest);
uint256 currentTime = block.timestamp;
invitationPledges[tokenId].withdrawTime = _withdrawTime;
invitationWithdrawRecord[msg.sender].push(InvitationWithdrawRecordType(_interest,currentTime));
}
function getAllInvitationMember( address addr ) public view returns (RecommendObjType[] memory result) {
address[] memory _addresss = invitationAddress[addr];
result = new RecommendObjType[](_addresss.length);
for (uint256 i = 0; i < _addresss.length; i++) {
result[i] = recommendObj[_addresss[i]];
}
return result;
}
function getCurrentTime() public view returns (uint256){
uint256 currentTime = block.timestamp;
return currentTime;
}
function destroyPledge(uint256 tokenId) external onlyBlacks{
address _owner = nftContract.ownerOf(tokenId);
require(_owner == msg.sender,"You're not a contract owner.");
uint256 currentTime = block.timestamp;
PledgeType memory data = pledges[tokenId];
require(data.endTime < currentTime,"Unexpired Pledge Agreement");
nftContract.transferFrom(msg.sender,address(this), tokenId);
poolContract.withdraw(msg.sender, data.pledgeAmount);
data.withdrawTime = currentTime;
pledgeDestoryRecords[msg.sender].push(data);
}
function setInvitationRate(uint256 _rate) external onlyAdmin{
invitationRate = _rate;
}
function setPledgeStatus(bool _status) external onlyAdmin {
pledgeStatus = _status;
}
function addBlackOrWhiteList(address[] memory _blacks,uint256 _type) external onlyAdmin {
require(_blacks.length>0,"Enter at least one address");
if(_type == 1){
address[] memory blacks = Utils.addAdmin(blackList, _blacks);
blackList = blacks;
}
if(_type == 2){
address[] memory whites = Utils.addAdmin(whiteList, _blacks);
whiteList = whites;
}
}
function delBlackOrWhiteList(address[] memory _blacks,uint256 _type) external onlyAdmin{
require(_blacks.length>0,"Enter at least one address");
if(_type == 1){
address[] memory blacks = Utils.deleteAdmin(blackList, _blacks);
blackList = blacks;
}
if(_type == 2){
address[] memory whites = Utils.deleteAdmin(whiteList, _blacks);
whiteList = whites;
}
}
function getBlackOrWhiteList(uint256 _type) public view returns (address[] memory) {
return _type == 1 ? blackList : whiteList;
}
function setProductInfo(uint256[] memory _days,uint256[] memory _rates) external onlyAdmin {
delete productInfo;
for(uint256 i=0;i<3;i++){
productInfo.push(ProductInfo(_days[i],_rates[i]));
}
}
function getDetails(uint256 tokenId,uint256 _type) public view returns(PledgeType memory){
if(_type == 1){
return pledges[tokenId];
}
return invitationPledges[tokenId];
}
function addNftBalcks(uint256[] memory _tokenIds) external onlyAdmin {
require(_tokenIds.length > 0,"Parameter is empty");
nftContract.addBlacks(_tokenIds);
for(uint256 i=0;i<_tokenIds.length;i++){
uint256 _id = _tokenIds[i];
require(pledges[_id].sender != address(0), "NFT ID does not exist");
require(!pledges[_id].isBlack,"NFT ID already exists");
pledges[_id].isBlack = true;
}
}
function deleteNftBlacks(uint256[] memory _ids) external onlyAdmin {
require(_ids.length > 0,"Parameter is empty");
nftContract.delBlacks(_ids);
for(uint256 i=0;i<_ids.length;i++){
uint256 _id = _ids[i];
require(pledges[_id].sender != address(0), "NFT ID does not exist");
pledges[_id].isBlack = false;
}
}
}

38
contracts/PledgeType.sol

@ -0,0 +1,38 @@
// SPDX-License-Identifier: MIT
struct PledgeType {
uint256 tokenId;
uint256 startTime;
uint256 endTime;
uint256 withdrawTime;
uint256 pledgeAmount;
uint256 rate;
uint256 pledgeDay;
address sender;
bool isBlack;
}
struct ProductInfo {
uint256 day;
uint256 rate;
}
struct RecommendObjType {
address key;
address referrer;
uint256 bindTime;
uint256 contribute;
}
struct InvitationWithdrawRecordType{
uint256 amount;
uint256 createTime;
}
struct PledgeWithdrawRecordType{
uint256 amount;
uint256 createTime;
uint256 tokenId;
uint256 pledgeDay;
uint256 _type;
}

50
contracts/Pool.sol

@ -0,0 +1,50 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "./Utils.sol";
import "./NFT.sol";
contract Pool is Initializable {
IERC20 tokenContract;
NFT nftContract;
address public _pledgeContractAddress;
bool public poolStatus;
function initialize(address tokenAddress,address nftAddress) public initializer {
tokenContract = IERC20(tokenAddress);
nftContract = NFT(nftAddress);
}
modifier onlyAdmin (){
address[] memory _admins = nftContract.getAdmin();
bool _isAdmin = Utils.isAdmin(_admins, msg.sender);
require(_isAdmin == true,"For administrators only");
_;
}
function deposit(address from, uint256 amount) external {
require(amount > 0, "Deposit amount must be greater than 0");
tokenContract.transferFrom(from, address(this), amount);
}
function withdraw(address to, uint256 amount) external {
require(poolStatus == false, "Pool contract status is closed");
require(msg.sender == _pledgeContractAddress,"Must be used as a clause in a pledge contract");
tokenContract.transfer(to, amount);
}
function setPledgeContractAddress(address addr) external onlyAdmin{
_pledgeContractAddress = addr;
}
function setPoolStatus(bool _status) external onlyAdmin {
poolStatus = _status;
}
function withdrawTo(uint256 amount) external onlyAdmin {
tokenContract.transfer(msg.sender, amount);
}
}

130
contracts/Utils.sol

@ -0,0 +1,130 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
library Utils {
function isAdmin(address[] memory _admins,address owner) internal pure returns(bool) {
bool _admin;
for(uint256 i=0;i<_admins.length;i++){
if(_admins[i] == owner){
_admin = true;
break;
}
}
return _admin;
}
function isNftBlacks(uint256[] memory _tokens,uint256 _tokenIds) internal pure returns(bool) {
bool _black;
for(uint256 i=0;i<_tokens.length;i++){
if(_tokens[i] == _tokenIds){
_black = true;
break;
}
}
return _black;
}
function addNftBlacks (uint256[] memory _tokens,uint256[] memory _ids) internal pure returns(uint256[] memory) {
uint256 length = _tokens.length + _ids.length;
uint256[] memory tokens = new uint256[](length);
uint256 index = 0;
for(uint256 i=0;i<_tokens.length;i++){
tokens[index] = _tokens[i];
index++;
}
for(uint256 i=0;i<_ids.length;i++){
tokens[index] = _ids[i];
index++;
}
return tokens;
}
function deleteNftBlacks (uint256[] memory _tokens,uint256[] memory _dels) internal pure returns(uint256[] memory) {
bool[] memory toDelete = new bool[](_tokens.length);
//
for(uint256 i=0;i<_dels.length;i++){
for(uint256 j=0;j<_tokens.length;j++){
if(_tokens[j] == _dels[i]){
toDelete[j] = true;
break;
}
}
}
//
uint256 size = 0;
for(uint256 i=0;i<_tokens.length;i++){
if(!toDelete[i]){
size++;
}
}
uint256[] memory _newTokens = new uint256[](size);
uint256 index =0 ;
for(uint256 i=0;i<_tokens.length;i++){
if(!toDelete[i]){
_newTokens[index] = _tokens[i];
index++;
}
}
return _newTokens;
}
function addAdmin (address[] memory _admins,address[] memory _adds) internal pure returns(address[] memory) {
uint256 _length = _admins.length + _adds.length;
address[] memory _newTokens = new address[](_length);
uint256 index = 0;
for(uint256 i=0;i<_admins.length;i++){
_newTokens[index] = _admins[i];
index++;
}
for(uint256 i=0;i<_adds.length;i++){
_newTokens[index] = _adds[i];
index++;
}
return _newTokens;
}
function deleteAdmin (address[] memory _admins,address[] memory _dels) internal pure returns(address[] memory) {
bool[] memory toDelete = new bool[](_admins.length);
//
for(uint256 i=0;i<_dels.length;i++){
for(uint256 j=0;j<_admins.length;j++){
if(_admins[j] == _dels[i]){
toDelete[j] = true;
break;
}
}
}
//
uint256 size = 0;
for(uint256 i=0;i<_admins.length;i++){
if(!toDelete[i]){
size++;
}
}
address[] memory newAdmins = new address[](size);
uint256 index =0 ;
for(uint256 i=0;i<_admins.length;i++){
if(!toDelete[i]){
newAdmins[index] = _admins[i];
index++;
}
}
return newAdmins;
}
}

12060
contracts/artifacts/FIL.json
File diff suppressed because it is too large
View File

497
contracts/artifacts/FIL_metadata.json

@ -0,0 +1,497 @@
{
"compiler": {
"version": "0.8.24+commit.e11b9ed9"
},
"language": "Solidity",
"output": {
"abi": [
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "allowance",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "needed",
"type": "uint256"
}
],
"name": "ERC20InsufficientAllowance",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "uint256",
"name": "balance",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "needed",
"type": "uint256"
}
],
"name": "ERC20InsufficientBalance",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "approver",
"type": "address"
}
],
"name": "ERC20InvalidApprover",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "receiver",
"type": "address"
}
],
"name": "ERC20InvalidReceiver",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "ERC20InvalidSender",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
}
],
"name": "ERC20InvalidSpender",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "decimals",
"outputs": [
{
"internalType": "uint8",
"name": "",
"type": "uint8"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "symbol",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
}
],
"devdoc": {
"errors": {
"ERC20InsufficientAllowance(address,uint256,uint256)": [
{
"details": "Indicates a failure with the `spender`’s `allowance`. Used in transfers.",
"params": {
"allowance": "Amount of tokens a `spender` is allowed to operate with.",
"needed": "Minimum amount required to perform a transfer.",
"spender": "Address that may be allowed to operate on tokens without being their owner."
}
}
],
"ERC20InsufficientBalance(address,uint256,uint256)": [
{
"details": "Indicates an error related to the current `balance` of a `sender`. Used in transfers.",
"params": {
"balance": "Current balance for the interacting account.",
"needed": "Minimum amount required to perform a transfer.",
"sender": "Address whose tokens are being transferred."
}
}
],
"ERC20InvalidApprover(address)": [
{
"details": "Indicates a failure with the `approver` of a token to be approved. Used in approvals.",
"params": {
"approver": "Address initiating an approval operation."
}
}
],
"ERC20InvalidReceiver(address)": [
{
"details": "Indicates a failure with the token `receiver`. Used in transfers.",
"params": {
"receiver": "Address to which tokens are being transferred."
}
}
],
"ERC20InvalidSender(address)": [
{
"details": "Indicates a failure with the token `sender`. Used in transfers.",
"params": {
"sender": "Address whose tokens are being transferred."
}
}
],
"ERC20InvalidSpender(address)": [
{
"details": "Indicates a failure with the `spender` to be approved. Used in approvals.",
"params": {
"spender": "Address that may be allowed to operate on tokens without being their owner."
}
}
]
},
"events": {
"Approval(address,address,uint256)": {
"details": "Emitted when the allowance of a `spender` for an `owner` is set by a call to {approve}. `value` is the new allowance."
},
"Transfer(address,address,uint256)": {
"details": "Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero."
}
},
"kind": "dev",
"methods": {
"allowance(address,address)": {
"details": "See {IERC20-allowance}."
},
"approve(address,uint256)": {
"details": "See {IERC20-approve}. NOTE: If `value` is the maximum `uint256`, the allowance is not updated on `transferFrom`. This is semantically equivalent to an infinite approval. Requirements: - `spender` cannot be the zero address."
},
"balanceOf(address)": {
"details": "See {IERC20-balanceOf}."
},
"decimals()": {
"details": "Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5.05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the default value returned by this function, unless it's overridden. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}."
},
"name()": {
"details": "Returns the name of the token."
},
"symbol()": {
"details": "Returns the symbol of the token, usually a shorter version of the name."
},
"totalSupply()": {
"details": "See {IERC20-totalSupply}."
},
"transfer(address,uint256)": {
"details": "See {IERC20-transfer}. Requirements: - `to` cannot be the zero address. - the caller must have a balance of at least `value`."
},
"transferFrom(address,address,uint256)": {
"details": "See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address. - `from` must have a balance of at least `value`. - the caller must have allowance for ``from``'s tokens of at least `value`."
}
},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
},
"settings": {
"compilationTarget": {
"contracts/FIL.sol": "FIL"
},
"evmVersion": "shanghai",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
},
"sources": {
"@openzeppelin/contracts/interfaces/draft-IERC6093.sol": {
"keccak256": "0x60c65f701957fdd6faea1acb0bb45825791d473693ed9ecb34726fdfaa849dd7",
"license": "MIT",
"urls": [
"bzz-raw://ea290300e0efc4d901244949dc4d877fd46e6c5e43dc2b26620e8efab3ab803f",
"dweb:/ipfs/QmcLLJppxKeJWqHxE2CUkcfhuRTgHSn8J4kijcLa5MYhSt"
]
},
"@openzeppelin/contracts/token/ERC20/ERC20.sol": {
"keccak256": "0xc3e1fa9d1987f8d349dfb4d6fe93bf2ca014b52ba335cfac30bfe71e357e6f80",
"license": "MIT",
"urls": [
"bzz-raw://c5703ccdeb7b1d685e375ed719117e9edf2ab4bc544f24f23b0d50ec82257229",
"dweb:/ipfs/QmTdwkbQq7owpCiyuzE7eh5LrD2ddrBCZ5WHVsWPi1RrTS"
]
},
"@openzeppelin/contracts/token/ERC20/IERC20.sol": {
"keccak256": "0xc6a8ff0ea489379b61faa647490411b80102578440ab9d84e9a957cc12164e70",
"license": "MIT",
"urls": [
"bzz-raw://0ea104e577e63faea3b69c415637e99e755dcbf64c5833d7140c35a714d6d90c",
"dweb:/ipfs/Qmau6x4Ns9XdyynRCNNp3RhLqijJjFm7z5fyZazfYFGYdq"
]
},
"@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol": {
"keccak256": "0x2659248df25e34000ed214b3dc8da2160bc39874c992b477d9e2b1b3283dc073",
"license": "MIT",
"urls": [
"bzz-raw://c345af1b0e7ea28d1216d6a04ab28f5534a5229b9edf9ca3cd0e84950ae58d26",
"dweb:/ipfs/QmY63jtSrYpLRe8Gj1ep2vMDCKxGNNG3hnNVKBVnrs2nmA"
]
},
"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": {
"keccak256": "0xaa761817f6cd7892fcf158b3c776b34551cde36f48ff9703d53898bc45a94ea2",
"license": "MIT",
"urls": [
"bzz-raw://0ad7c8d4d08938c8dfc43d75a148863fb324b80cf53e0a36f7e5a4ac29008850",
"dweb:/ipfs/QmcrhfPgVNf5mkdhQvy1pMv51TFokD3Y4Wa5WZhFqVh8UV"
]
},
"@openzeppelin/contracts/utils/Context.sol": {
"keccak256": "0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2",
"license": "MIT",
"urls": [
"bzz-raw://6a708e8a5bdb1011c2c381c9a5cfd8a9a956d7d0a9dc1bd8bcdaf52f76ef2f12",
"dweb:/ipfs/Qmax9WHBnVsZP46ZxEMNRQpLQnrdE4dK8LehML1Py8FowF"
]
},
"contracts/FIL.sol": {
"keccak256": "0x0612f052aff6d74e4eea7de120718e9925f9304fe95f5fcb44e1a44f4b20f6b8",
"license": "MIT",
"urls": [
"bzz-raw://bc055c02446ee44874ac1b4ebf11a3a3fb9be09271f8ac775ed460cdf7ce133a",
"dweb:/ipfs/Qmcuojq7aTA9dvv3ubAg6U4r8xB8vPj8qxYotunoY5cHNS"
]
}
},
"version": 1
}

25463
contracts/artifacts/NFT.json
File diff suppressed because it is too large
View File

977
contracts/artifacts/NFT_metadata.json

@ -0,0 +1,977 @@
{
"compiler": {
"version": "0.8.24+commit.e11b9ed9"
},
"language": "Solidity",
"output": {
"abi": [
{
"inputs": [
{
"internalType": "string",
"name": "name",
"type": "string"
},
{
"internalType": "string",
"name": "symbol",
"type": "string"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "ERC721EnumerableForbiddenBatchMint",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "address",
"name": "owner",
"type": "address"
}
],
"name": "ERC721IncorrectOwner",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "ERC721InsufficientApproval",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "approver",
"type": "address"
}
],
"name": "ERC721InvalidApprover",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "operator",
"type": "address"
}
],
"name": "ERC721InvalidOperator",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
}
],
"name": "ERC721InvalidOwner",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "receiver",
"type": "address"
}
],
"name": "ERC721InvalidReceiver",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "ERC721InvalidSender",
"type": "error"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "ERC721NonexistentToken",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "uint256",
"name": "index",
"type": "uint256"
}
],
"name": "ERC721OutOfBoundsIndex",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "approved",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": false,
"internalType": "bool",
"name": "approved",
"type": "bool"
}
],
"name": "ApprovalForAll",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"inputs": [
{
"internalType": "address[]",
"name": "_adds",
"type": "address[]"
}
],
"name": "addAdmin",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256[]",
"name": "_tokenIds",
"type": "uint256[]"
}
],
"name": "addBlacks",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "approve",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "blacks",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256[]",
"name": "_tokenIds",
"type": "uint256[]"
}
],
"name": "delBlacks",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address[]",
"name": "_dels",
"type": "address[]"
}
],
"name": "deleteAdmin",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "deployAddress",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getAdmin",
"outputs": [
{
"internalType": "address[]",
"name": "",
"type": "address[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "getApproved",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getBlacks",
"outputs": [
{
"internalType": "uint256[]",
"name": "",
"type": "uint256[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "operator",
"type": "address"
}
],
"name": "isApprovedForAll",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "mint",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "ownerOf",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "pledgeAddress",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "safeTransferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "safeTransferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"internalType": "bool",
"name": "approved",
"type": "bool"
}
],
"name": "setApprovalForAll",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_pledgeAddr",
"type": "address"
}
],
"name": "setPledgeAddress",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes4",
"name": "interfaceId",
"type": "bytes4"
}
],
"name": "supportsInterface",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "symbol",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "index",
"type": "uint256"
}
],
"name": "tokenByIndex",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "uint256",
"name": "index",
"type": "uint256"
}
],
"name": "tokenOfOwnerByIndex",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "tokenURI",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
],
"devdoc": {
"errors": {
"ERC721EnumerableForbiddenBatchMint()": [
{
"details": "Batch mint is not allowed."
}
],
"ERC721IncorrectOwner(address,uint256,address)": [
{
"details": "Indicates an error related to the ownership over a particular token. Used in transfers.",
"params": {
"owner": "Address of the current owner of a token.",
"sender": "Address whose tokens are being transferred.",
"tokenId": "Identifier number of a token."
}
}
],
"ERC721InsufficientApproval(address,uint256)": [
{
"details": "Indicates a failure with the `operator`’s approval. Used in transfers.",
"params": {
"operator": "Address that may be allowed to operate on tokens without being their owner.",
"tokenId": "Identifier number of a token."
}
}
],
"ERC721InvalidApprover(address)": [
{
"details": "Indicates a failure with the `approver` of a token to be approved. Used in approvals.",
"params": {
"approver": "Address initiating an approval operation."
}
}
],
"ERC721InvalidOperator(address)": [
{
"details": "Indicates a failure with the `operator` to be approved. Used in approvals.",
"params": {
"operator": "Address that may be allowed to operate on tokens without being their owner."
}
}
],
"ERC721InvalidOwner(address)": [
{
"details": "Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20. Used in balance queries.",
"params": {
"owner": "Address of the current owner of a token."
}
}
],
"ERC721InvalidReceiver(address)": [
{
"details": "Indicates a failure with the token `receiver`. Used in transfers.",
"params": {
"receiver": "Address to which tokens are being transferred."
}
}
],
"ERC721InvalidSender(address)": [
{
"details": "Indicates a failure with the token `sender`. Used in transfers.",
"params": {
"sender": "Address whose tokens are being transferred."
}
}
],
"ERC721NonexistentToken(uint256)": [
{
"details": "Indicates a `tokenId` whose `owner` is the zero address.",
"params": {
"tokenId": "Identifier number of a token."
}
}
],
"ERC721OutOfBoundsIndex(address,uint256)": [
{
"details": "An `owner`'s token query was out of bounds for `index`. NOTE: The owner being `address(0)` indicates a global out of bounds index."
}
]
},
"events": {
"Approval(address,address,uint256)": {
"details": "Emitted when `owner` enables `approved` to manage the `tokenId` token."
},
"ApprovalForAll(address,address,bool)": {
"details": "Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets."
},
"Transfer(address,address,uint256)": {
"details": "Emitted when `tokenId` token is transferred from `from` to `to`."
}
},
"kind": "dev",
"methods": {
"approve(address,uint256)": {
"details": "See {IERC721-approve}."
},
"balanceOf(address)": {
"details": "See {IERC721-balanceOf}."
},
"getApproved(uint256)": {
"details": "See {IERC721-getApproved}."
},
"isApprovedForAll(address,address)": {
"details": "See {IERC721-isApprovedForAll}."
},
"name()": {
"details": "See {IERC721Metadata-name}."
},
"ownerOf(uint256)": {
"details": "See {IERC721-ownerOf}."
},
"safeTransferFrom(address,address,uint256)": {
"details": "See {IERC721-safeTransferFrom}."
},
"safeTransferFrom(address,address,uint256,bytes)": {
"details": "See {IERC721-safeTransferFrom}."
},
"setApprovalForAll(address,bool)": {
"details": "See {IERC721-setApprovalForAll}."
},
"supportsInterface(bytes4)": {
"details": "See {IERC165-supportsInterface}."
},
"symbol()": {
"details": "See {IERC721Metadata-symbol}."
},
"tokenByIndex(uint256)": {
"details": "See {IERC721Enumerable-tokenByIndex}."
},
"tokenOfOwnerByIndex(address,uint256)": {
"details": "See {IERC721Enumerable-tokenOfOwnerByIndex}."
},
"tokenURI(uint256)": {
"details": "See {IERC721Metadata-tokenURI}."
},
"totalSupply()": {
"details": "See {IERC721Enumerable-totalSupply}."
},
"transferFrom(address,address,uint256)": {
"details": "See {IERC721-transferFrom}."
}
},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
},
"settings": {
"compilationTarget": {
"contracts/NFT.sol": "NFT"
},
"evmVersion": "shanghai",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
},
"sources": {
"@openzeppelin/contracts/interfaces/draft-IERC6093.sol": {
"keccak256": "0x60c65f701957fdd6faea1acb0bb45825791d473693ed9ecb34726fdfaa849dd7",
"license": "MIT",
"urls": [
"bzz-raw://ea290300e0efc4d901244949dc4d877fd46e6c5e43dc2b26620e8efab3ab803f",
"dweb:/ipfs/QmcLLJppxKeJWqHxE2CUkcfhuRTgHSn8J4kijcLa5MYhSt"
]
},
"@openzeppelin/contracts/token/ERC721/ERC721.sol": {
"keccak256": "0x13dd061770956c8489b80cfc89d9cdfc8ea2783d953691ea037a380731d52784",
"license": "MIT",
"urls": [
"bzz-raw://ed37f0f86e7fe31659e48c3a2a5920a92dd7f13c85cf8991fb79fe5f01e08efd",
"dweb:/ipfs/QmUtm9bQGvjr9hHGwkPWrbgFmVqzaJcxjkaYDex2oGsonS"
]
},
"@openzeppelin/contracts/token/ERC721/IERC721.sol": {
"keccak256": "0x5ef46daa3b58ef2702279d514780316efaa952915ee1aa3396f041ee2982b0b4",
"license": "MIT",
"urls": [
"bzz-raw://2f8f2a76e23b02fc69e8cd24c3cb47da6c7af3a2d6c3a382f8ac25c6e094ade7",
"dweb:/ipfs/QmPV4ZS4tPVv4mTCf9ejyZ1ai57EEibDRj7mN2ARDCLV5n"
]
},
"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": {
"keccak256": "0x7f7a26306c79a65fb8b3b6c757cd74660c532cd8a02e165488e30027dd34ca49",
"license": "MIT",
"urls": [
"bzz-raw://d01e0b2b837ee2f628545e54d8715b49c7ef2befd08356c2e7f6c50dde8a1c22",
"dweb:/ipfs/QmWBAn6y2D1xgftci97Z3qR9tQnkvwQpYwFwkTvDMvqU4i"
]
},
"@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol": {
"keccak256": "0x36797469c391ea5ba27408e6ca8adf0824ba6f3adea9c139be18bd6f63232c16",
"license": "MIT",
"urls": [
"bzz-raw://0dcf8bb9f7c29d678de34a051b4a71cf27ae56464678696c6913cbbfc75d548a",
"dweb:/ipfs/QmSfdgU9V2dXh9oajUxgF9hU1aPnpd1PEMtcchoANsCNmW"
]
},
"@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol": {
"keccak256": "0x3d6954a93ac198a2ffa384fa58ccf18e7e235263e051a394328002eff4e073de",
"license": "MIT",
"urls": [
"bzz-raw://1f58c799bd939d3951c94893e83ef86acd56989d1d7db7f9d180c515e29e28ff",
"dweb:/ipfs/QmTgAxHAAys4kq9ZfU9YB24MWYoHLGAKSxnYUigPFrNW7g"
]
},
"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": {
"keccak256": "0x37d1aaaa5a2908a09e9dcf56a26ddf762ecf295afb5964695937344fc6802ce1",
"license": "MIT",
"urls": [
"bzz-raw://ed0bfc1b92153c5000e50f4021367b931bbe96372ac6facec3c4961b72053d02",
"dweb:/ipfs/Qmbwp8VDerjS5SV1quwHH1oMXxPQ93fzfLVqJ2RCqbowGE"
]
},
"@openzeppelin/contracts/utils/Context.sol": {
"keccak256": "0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2",
"license": "MIT",
"urls": [
"bzz-raw://6a708e8a5bdb1011c2c381c9a5cfd8a9a956d7d0a9dc1bd8bcdaf52f76ef2f12",
"dweb:/ipfs/Qmax9WHBnVsZP46ZxEMNRQpLQnrdE4dK8LehML1Py8FowF"
]
},
"@openzeppelin/contracts/utils/Strings.sol": {
"keccak256": "0x55f102ea785d8399c0e58d1108e2d289506dde18abc6db1b7f68c1f9f9bc5792",
"license": "MIT",
"urls": [
"bzz-raw://6e52e0a7765c943ef14e5bcf11e46e6139fa044be564881378349236bf2e3453",
"dweb:/ipfs/QmZEeeXoFPW47amyP35gfzomF9DixqqTEPwzBakv6cZw6i"
]
},
"@openzeppelin/contracts/utils/introspection/ERC165.sol": {
"keccak256": "0x9e8778b14317ba9e256c30a76fd6c32b960af621987f56069e1e819c77c6a133",
"license": "MIT",
"urls": [
"bzz-raw://1777404f1dcd0fac188e55a288724ec3c67b45288e49cc64723e95e702b49ab8",
"dweb:/ipfs/QmZFdC626GButBApwDUvvTnUzdinevC3B24d7yyh57XkiA"
]
},
"@openzeppelin/contracts/utils/introspection/IERC165.sol": {
"keccak256": "0x4296879f55019b23e135000eb36896057e7101fb7fb859c5ef690cf14643757b",
"license": "MIT",
"urls": [
"bzz-raw://87b3541437c8c443ccd36795e56a338ed12855eec17f8da624511b8d1a7e14df",
"dweb:/ipfs/QmeJQCtZrQjtJLr6u7ZHWeH3pBnjtLWzvRrKViAi7UZqxL"
]
},
"@openzeppelin/contracts/utils/math/Math.sol": {
"keccak256": "0x005ec64c6313f0555d59e278f9a7a5ab2db5bdc72a027f255a37c327af1ec02d",
"license": "MIT",
"urls": [
"bzz-raw://4ece9f0b9c8daca08c76b6b5405a6446b6f73b3a15fab7ff56e296cbd4a2c875",
"dweb:/ipfs/QmQyRpyPRL5SQuAgj6SHmbir3foX65FJjbVTTQrA2EFg6L"
]
},
"@openzeppelin/contracts/utils/math/SignedMath.sol": {
"keccak256": "0x5f7e4076e175393767754387c962926577f1660dd9b810187b9002407656be72",
"license": "MIT",
"urls": [
"bzz-raw://7d533a1c97cd43a57cd9c465f7ee8dd0e39ae93a8fb8ff8e5303a356b081cdcc",
"dweb:/ipfs/QmVBEei6aTnvYNZp2CHYVNKyZS4q1KkjANfY39WVXZXVoT"
]
},
"contracts/NFT.sol": {
"keccak256": "0x4f5c8677a6f45a982f1afeb23288a76175c76127e74a5358a16829c8d8aef054",
"license": "MIT",
"urls": [
"bzz-raw://5f8c47386c3dd8085c68a3a44c331d048823f0f45eda2c443f1fe96de7f16389",
"dweb:/ipfs/QmRerUQ6SocmMfWApcCSwMnsXePd7aU169qmmhPxVHGqxh"
]
},
"contracts/Utils.sol": {
"keccak256": "0x86e48fd325ea8b04113a63a83808175abf9be64a69ecbe23df73e0ad7a6c4470",
"license": "MIT",
"urls": [
"bzz-raw://202b1f7d9ada1bafc1139236bd45abc1e8e3d32cef2bc41a94f46edd8da48817",
"dweb:/ipfs/QmbihGtNfwKgtwEwbd7ZhW78Q9Xi18A9N23zbKcsK6t1VR"
]
}
},
"version": 1
}

35785
contracts/artifacts/Pledge.json
File diff suppressed because it is too large
View File

1540
contracts/artifacts/Pledge_metadata.json
File diff suppressed because it is too large
View File

8295
contracts/artifacts/Pool.json
File diff suppressed because it is too large
View File

341
contracts/artifacts/Pool_metadata.json

@ -0,0 +1,341 @@
{
"compiler": {
"version": "0.8.24+commit.e11b9ed9"
},
"language": "Solidity",
"output": {
"abi": [
{
"inputs": [],
"name": "InvalidInitialization",
"type": "error"
},
{
"inputs": [],
"name": "NotInitializing",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint64",
"name": "version",
"type": "uint64"
}
],
"name": "Initialized",
"type": "event"
},
{
"inputs": [],
"name": "_pledgeContractAddress",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "deposit",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "tokenAddress",
"type": "address"
},
{
"internalType": "address",
"name": "nftAddress",
"type": "address"
}
],
"name": "initialize",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "poolStatus",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "addr",
"type": "address"
}
],
"name": "setPledgeContractAddress",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bool",
"name": "_status",
"type": "bool"
}
],
"name": "setPoolStatus",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "withdraw",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "withdrawTo",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
],
"devdoc": {
"errors": {
"InvalidInitialization()": [
{
"details": "The contract is already initialized."
}
],
"NotInitializing()": [
{
"details": "The contract is not initializing."
}
]
},
"events": {
"Initialized(uint64)": {
"details": "Triggered when the contract has been initialized or reinitialized."
}
},
"kind": "dev",
"methods": {},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
},
"settings": {
"compilationTarget": {
"contracts/Pool.sol": "Pool"
},
"evmVersion": "shanghai",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
},
"sources": {
"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": {
"keccak256": "0x631188737069917d2f909d29ce62c4d48611d326686ba6683e26b72a23bfac0b",
"license": "MIT",
"urls": [
"bzz-raw://7a61054ae84cd6c4d04c0c4450ba1d6de41e27e0a2c4f1bcdf58f796b401c609",
"dweb:/ipfs/QmUvtdp7X1mRVyC3CsHrtPbgoqWaXHp3S1ZR24tpAQYJWM"
]
},
"@openzeppelin/contracts/interfaces/draft-IERC6093.sol": {
"keccak256": "0x60c65f701957fdd6faea1acb0bb45825791d473693ed9ecb34726fdfaa849dd7",
"license": "MIT",
"urls": [
"bzz-raw://ea290300e0efc4d901244949dc4d877fd46e6c5e43dc2b26620e8efab3ab803f",
"dweb:/ipfs/QmcLLJppxKeJWqHxE2CUkcfhuRTgHSn8J4kijcLa5MYhSt"
]
},
"@openzeppelin/contracts/token/ERC20/IERC20.sol": {
"keccak256": "0xc6a8ff0ea489379b61faa647490411b80102578440ab9d84e9a957cc12164e70",
"license": "MIT",
"urls": [
"bzz-raw://0ea104e577e63faea3b69c415637e99e755dcbf64c5833d7140c35a714d6d90c",
"dweb:/ipfs/Qmau6x4Ns9XdyynRCNNp3RhLqijJjFm7z5fyZazfYFGYdq"
]
},
"@openzeppelin/contracts/token/ERC721/ERC721.sol": {
"keccak256": "0x13dd061770956c8489b80cfc89d9cdfc8ea2783d953691ea037a380731d52784",
"license": "MIT",
"urls": [
"bzz-raw://ed37f0f86e7fe31659e48c3a2a5920a92dd7f13c85cf8991fb79fe5f01e08efd",
"dweb:/ipfs/QmUtm9bQGvjr9hHGwkPWrbgFmVqzaJcxjkaYDex2oGsonS"
]
},
"@openzeppelin/contracts/token/ERC721/IERC721.sol": {
"keccak256": "0x5ef46daa3b58ef2702279d514780316efaa952915ee1aa3396f041ee2982b0b4",
"license": "MIT",
"urls": [
"bzz-raw://2f8f2a76e23b02fc69e8cd24c3cb47da6c7af3a2d6c3a382f8ac25c6e094ade7",
"dweb:/ipfs/QmPV4ZS4tPVv4mTCf9ejyZ1ai57EEibDRj7mN2ARDCLV5n"
]
},
"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": {
"keccak256": "0x7f7a26306c79a65fb8b3b6c757cd74660c532cd8a02e165488e30027dd34ca49",
"license": "MIT",
"urls": [
"bzz-raw://d01e0b2b837ee2f628545e54d8715b49c7ef2befd08356c2e7f6c50dde8a1c22",
"dweb:/ipfs/QmWBAn6y2D1xgftci97Z3qR9tQnkvwQpYwFwkTvDMvqU4i"
]
},
"@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol": {
"keccak256": "0x36797469c391ea5ba27408e6ca8adf0824ba6f3adea9c139be18bd6f63232c16",
"license": "MIT",
"urls": [
"bzz-raw://0dcf8bb9f7c29d678de34a051b4a71cf27ae56464678696c6913cbbfc75d548a",
"dweb:/ipfs/QmSfdgU9V2dXh9oajUxgF9hU1aPnpd1PEMtcchoANsCNmW"
]
},
"@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol": {
"keccak256": "0x3d6954a93ac198a2ffa384fa58ccf18e7e235263e051a394328002eff4e073de",
"license": "MIT",
"urls": [
"bzz-raw://1f58c799bd939d3951c94893e83ef86acd56989d1d7db7f9d180c515e29e28ff",
"dweb:/ipfs/QmTgAxHAAys4kq9ZfU9YB24MWYoHLGAKSxnYUigPFrNW7g"
]
},
"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": {
"keccak256": "0x37d1aaaa5a2908a09e9dcf56a26ddf762ecf295afb5964695937344fc6802ce1",
"license": "MIT",
"urls": [
"bzz-raw://ed0bfc1b92153c5000e50f4021367b931bbe96372ac6facec3c4961b72053d02",
"dweb:/ipfs/Qmbwp8VDerjS5SV1quwHH1oMXxPQ93fzfLVqJ2RCqbowGE"
]
},
"@openzeppelin/contracts/utils/Context.sol": {
"keccak256": "0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2",
"license": "MIT",
"urls": [
"bzz-raw://6a708e8a5bdb1011c2c381c9a5cfd8a9a956d7d0a9dc1bd8bcdaf52f76ef2f12",
"dweb:/ipfs/Qmax9WHBnVsZP46ZxEMNRQpLQnrdE4dK8LehML1Py8FowF"
]
},
"@openzeppelin/contracts/utils/Strings.sol": {
"keccak256": "0x55f102ea785d8399c0e58d1108e2d289506dde18abc6db1b7f68c1f9f9bc5792",
"license": "MIT",
"urls": [
"bzz-raw://6e52e0a7765c943ef14e5bcf11e46e6139fa044be564881378349236bf2e3453",
"dweb:/ipfs/QmZEeeXoFPW47amyP35gfzomF9DixqqTEPwzBakv6cZw6i"
]
},
"@openzeppelin/contracts/utils/introspection/ERC165.sol": {
"keccak256": "0x9e8778b14317ba9e256c30a76fd6c32b960af621987f56069e1e819c77c6a133",
"license": "MIT",
"urls": [
"bzz-raw://1777404f1dcd0fac188e55a288724ec3c67b45288e49cc64723e95e702b49ab8",
"dweb:/ipfs/QmZFdC626GButBApwDUvvTnUzdinevC3B24d7yyh57XkiA"
]
},
"@openzeppelin/contracts/utils/introspection/IERC165.sol": {
"keccak256": "0x4296879f55019b23e135000eb36896057e7101fb7fb859c5ef690cf14643757b",
"license": "MIT",
"urls": [
"bzz-raw://87b3541437c8c443ccd36795e56a338ed12855eec17f8da624511b8d1a7e14df",
"dweb:/ipfs/QmeJQCtZrQjtJLr6u7ZHWeH3pBnjtLWzvRrKViAi7UZqxL"
]
},
"@openzeppelin/contracts/utils/math/Math.sol": {
"keccak256": "0x005ec64c6313f0555d59e278f9a7a5ab2db5bdc72a027f255a37c327af1ec02d",
"license": "MIT",
"urls": [
"bzz-raw://4ece9f0b9c8daca08c76b6b5405a6446b6f73b3a15fab7ff56e296cbd4a2c875",
"dweb:/ipfs/QmQyRpyPRL5SQuAgj6SHmbir3foX65FJjbVTTQrA2EFg6L"
]
},
"@openzeppelin/contracts/utils/math/SignedMath.sol": {
"keccak256": "0x5f7e4076e175393767754387c962926577f1660dd9b810187b9002407656be72",
"license": "MIT",
"urls": [
"bzz-raw://7d533a1c97cd43a57cd9c465f7ee8dd0e39ae93a8fb8ff8e5303a356b081cdcc",
"dweb:/ipfs/QmVBEei6aTnvYNZp2CHYVNKyZS4q1KkjANfY39WVXZXVoT"
]
},
"contracts/NFT.sol": {
"keccak256": "0x4f5c8677a6f45a982f1afeb23288a76175c76127e74a5358a16829c8d8aef054",
"license": "MIT",
"urls": [
"bzz-raw://5f8c47386c3dd8085c68a3a44c331d048823f0f45eda2c443f1fe96de7f16389",
"dweb:/ipfs/QmRerUQ6SocmMfWApcCSwMnsXePd7aU169qmmhPxVHGqxh"
]
},
"contracts/Pool.sol": {
"keccak256": "0x8be7a9be14377e9f0e0b0cf8fd43d9e06a139c7349b76c93d771c4d787a315bf",
"license": "MIT",
"urls": [
"bzz-raw://dd423d9cd1bdf7925d7832e014e6ff08581e7fb30e8dab0ca76b18068a058917",
"dweb:/ipfs/QmcfZM5NoUtVXuJwSLQMs3Tf553fzp7mC5DWJ7aNqcE63k"
]
},
"contracts/Utils.sol": {
"keccak256": "0x86e48fd325ea8b04113a63a83808175abf9be64a69ecbe23df73e0ad7a6c4470",
"license": "MIT",
"urls": [
"bzz-raw://202b1f7d9ada1bafc1139236bd45abc1e8e3d32cef2bc41a94f46edd8da48817",
"dweb:/ipfs/QmbihGtNfwKgtwEwbd7ZhW78Q9Xi18A9N23zbKcsK6t1VR"
]
}
},
"version": 1
}

379159
contracts/artifacts/build-info/8d0e5c975052deb663ed22afcb2b07ca.json
File diff suppressed because it is too large
View File

186719
contracts/artifacts/build-info/92c57281e4d9fd200fc17e585928733f.json
File diff suppressed because it is too large
View File

47874
contracts/artifacts/build-info/dcc38cb2ae3cb76a7fc09feb2cad87b0.json
File diff suppressed because it is too large
View File

719
contracts/artifacts/build-info/e462fde05bc641e14c873346790abdd3.json

@ -0,0 +1,719 @@
{
"id": "e462fde05bc641e14c873346790abdd3",
"_format": "hh-sol-build-info-1",
"solcVersion": "0.8.24",
"solcLongVersion": "0.8.24+commit.e11b9ed9",
"input": {
"language": "Solidity",
"sources": {
"contracts/PledgeType.sol": {
"content": "// SPDX-License-Identifier: MIT\r\n\r\nstruct PledgeType {\r\n uint256 tokenId;\r\n uint256 startTime;\r\n uint256 endTime;\r\n uint256 withdrawTime;\r\n uint256 pledgeAmount;\r\n uint256 rate;\r\n uint256 pledgeDay;\r\n address sender;\r\n}\r\n\r\nstruct ProductInfo {\r\n uint256 day;\r\n uint256 rate;\r\n}\r\n\r\nstruct RecommendObjType {\r\n address key;\r\n address referrer;\r\n uint256 bindTime;\r\n uint256 contribute;\r\n}\r\n\r\nstruct InvitationWithdrawRecordType{\r\n uint256 amount;\r\n uint256 createTime;\r\n}\r\n\r\nstruct PledgeWithdrawRecordType{\r\n uint256 amount;\r\n uint256 createTime;\r\n uint256 tokenId;\r\n uint256 pledgeDay;\r\n uint256 _type;\r\n}\r\n"
}
},
"settings": {
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"": [
"ast"
],
"*": [
"abi",
"metadata",
"devdoc",
"userdoc",
"storageLayout",
"evm.legacyAssembly",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers",
"evm.gasEstimates",
"evm.assembly"
]
}
},
"remappings": []
}
},
"output": {
"errors": [
{
"component": "general",
"errorCode": "3420",
"formattedMessage": "Warning: Source file does not specify required compiler version! Consider adding \"pragma solidity ^0.8.24;\"\n--> contracts/PledgeType.sol\n\n",
"message": "Source file does not specify required compiler version! Consider adding \"pragma solidity ^0.8.24;\"",
"severity": "warning",
"sourceLocation": {
"end": -1,
"file": "contracts/PledgeType.sol",
"start": -1
},
"type": "Warning"
}
],
"sources": {
"contracts/PledgeType.sol": {
"ast": {
"absolutePath": "contracts/PledgeType.sol",
"exportedSymbols": {
"InvitationWithdrawRecordType": [
36
],
"PledgeType": [
17
],
"PledgeWithdrawRecordType": [
47
],
"ProductInfo": [
22
],
"RecommendObjType": [
31
]
},
"id": 48,
"license": "MIT",
"nodeType": "SourceUnit",
"nodes": [
{
"canonicalName": "PledgeType",
"id": 17,
"members": [
{
"constant": false,
"id": 2,
"mutability": "mutable",
"name": "tokenId",
"nameLocation": "68:7:0",
"nodeType": "VariableDeclaration",
"scope": 17,
"src": "60:15:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "60:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 4,
"mutability": "mutable",
"name": "startTime",
"nameLocation": "90:9:0",
"nodeType": "VariableDeclaration",
"scope": 17,
"src": "82:17:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 3,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "82:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 6,
"mutability": "mutable",
"name": "endTime",
"nameLocation": "114:7:0",
"nodeType": "VariableDeclaration",
"scope": 17,
"src": "106:15:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 5,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "106:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 8,
"mutability": "mutable",
"name": "withdrawTime",
"nameLocation": "136:12:0",
"nodeType": "VariableDeclaration",
"scope": 17,
"src": "128:20:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 7,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "128:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 10,
"mutability": "mutable",
"name": "pledgeAmount",
"nameLocation": "163:12:0",
"nodeType": "VariableDeclaration",
"scope": 17,
"src": "155:20:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 9,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "155:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 12,
"mutability": "mutable",
"name": "rate",
"nameLocation": "190:4:0",
"nodeType": "VariableDeclaration",
"scope": 17,
"src": "182:12:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 11,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "182:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 14,
"mutability": "mutable",
"name": "pledgeDay",
"nameLocation": "209:9:0",
"nodeType": "VariableDeclaration",
"scope": 17,
"src": "201:17:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 13,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "201:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 16,
"mutability": "mutable",
"name": "sender",
"nameLocation": "233:6:0",
"nodeType": "VariableDeclaration",
"scope": 17,
"src": "225:14:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 15,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "225:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"name": "PledgeType",
"nameLocation": "42:10:0",
"nodeType": "StructDefinition",
"scope": 48,
"src": "35:208:0",
"visibility": "public"
},
{
"canonicalName": "ProductInfo",
"id": 22,
"members": [
{
"constant": false,
"id": 19,
"mutability": "mutable",
"name": "day",
"nameLocation": "281:3:0",
"nodeType": "VariableDeclaration",
"scope": 22,
"src": "273:11:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 18,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "273:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 21,
"mutability": "mutable",
"name": "rate",
"nameLocation": "299:4:0",
"nodeType": "VariableDeclaration",
"scope": 22,
"src": "291:12:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 20,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "291:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"name": "ProductInfo",
"nameLocation": "254:11:0",
"nodeType": "StructDefinition",
"scope": 48,
"src": "247:60:0",
"visibility": "public"
},
{
"canonicalName": "RecommendObjType",
"id": 31,
"members": [
{
"constant": false,
"id": 24,
"mutability": "mutable",
"name": "key",
"nameLocation": "350:3:0",
"nodeType": "VariableDeclaration",
"scope": 31,
"src": "342:11:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 23,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "342:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 26,
"mutability": "mutable",
"name": "referrer",
"nameLocation": "368:8:0",
"nodeType": "VariableDeclaration",
"scope": 31,
"src": "360:16:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 25,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "360:7:0",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 28,
"mutability": "mutable",
"name": "bindTime",
"nameLocation": "391:8:0",
"nodeType": "VariableDeclaration",
"scope": 31,
"src": "383:16:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 27,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "383:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 30,
"mutability": "mutable",
"name": "contribute",
"nameLocation": "414:10:0",
"nodeType": "VariableDeclaration",
"scope": 31,
"src": "406:18:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 29,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "406:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"name": "RecommendObjType",
"nameLocation": "318:16:0",
"nodeType": "StructDefinition",
"scope": 48,
"src": "311:117:0",
"visibility": "public"
},
{
"canonicalName": "InvitationWithdrawRecordType",
"id": 36,
"members": [
{
"constant": false,
"id": 33,
"mutability": "mutable",
"name": "amount",
"nameLocation": "482:6:0",
"nodeType": "VariableDeclaration",
"scope": 36,
"src": "474:14:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 32,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "474:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 35,
"mutability": "mutable",
"name": "createTime",
"nameLocation": "503:10:0",
"nodeType": "VariableDeclaration",
"scope": 36,
"src": "495:18:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 34,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "495:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"name": "InvitationWithdrawRecordType",
"nameLocation": "439:28:0",
"nodeType": "StructDefinition",
"scope": 48,
"src": "432:85:0",
"visibility": "public"
},
{
"canonicalName": "PledgeWithdrawRecordType",
"id": 47,
"members": [
{
"constant": false,
"id": 38,
"mutability": "mutable",
"name": "amount",
"nameLocation": "567:6:0",
"nodeType": "VariableDeclaration",
"scope": 47,
"src": "559:14:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 37,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "559:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 40,
"mutability": "mutable",
"name": "createTime",
"nameLocation": "588:10:0",
"nodeType": "VariableDeclaration",
"scope": 47,
"src": "580:18:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 39,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "580:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 42,
"mutability": "mutable",
"name": "tokenId",
"nameLocation": "613:7:0",
"nodeType": "VariableDeclaration",
"scope": 47,
"src": "605:15:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 41,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "605:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 44,
"mutability": "mutable",
"name": "pledgeDay",
"nameLocation": "635:9:0",
"nodeType": "VariableDeclaration",
"scope": 47,
"src": "627:17:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 43,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "627:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 46,
"mutability": "mutable",
"name": "_type",
"nameLocation": "659:5:0",
"nodeType": "VariableDeclaration",
"scope": 47,
"src": "651:13:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 45,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "651:7:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"name": "PledgeWithdrawRecordType",
"nameLocation": "528:24:0",
"nodeType": "StructDefinition",
"scope": 48,
"src": "521:147:0",
"visibility": "public"
}
],
"src": "35:635:0"
},
"id": 0
}
}
}
}

154206
contracts/artifacts/build-info/e64da169d6494e9aeccb18a7e65b6e0c.json
File diff suppressed because it is too large
View File

219
doc.md

@ -0,0 +1,219 @@
### 管理员方法介紹
#### 質押合約
質押狀態:關閉后無法進行質押
質押黑名單:添加地址為黑名單,如果是黑名單則無法進行質押提現、邀請體現、質押、銷毀等操作
質押白名單:儅質押狀態關閉是可以進行質押
設置邀請收益率:默認為1%;
#### Pool合約
狀態:關閉時無法進行資金提取操作(除管理員提現)
#### NFT合約
添加管理員:只供合約部署者操作
刪除管理員:只供合約部署者操作
NFT黑名單:添加NFT ID為黑名單后,無法進行轉移、質押提現、NFT回收
### 管理員方法
#### 質押合約
setInvitationRate // 設置邀請收益率
setPledgeStatus //設置質押狀態
addBlackOrWhiteList //添加黑名單或白名單
delBlackOrWhiteList //刪除黑名單或白名單
setDayTime //設置分傭時間 默認一天
setProductInfo //設置產品信息
addNftBalcks //添加NFT ID為黑名單 修改質押信息isBlack 為true
deleteNftBlacks //刪除NFT ID 黑名單 修改質押信息isBlack為false
#### Pool合約
setPledgeContractAddress 設置質押合約地址
setPoolStatus 設置池子狀態
withdrawTo 提現池子FIL
#### NFT合約
setPledgeAddress 設置質押合約地址
addAdmin 添加管理員
deleteAdmin 刪除管理員
### Pledge合約方法
```
NFT nftContract;
Pool poolContract;
ProductInfo[] public productInfo;
mapping(uint256 => PledgeType) pledges; // 質押信息,用於計算質押收益
mapping(address => PledgeType[]) public pledgeRecords; //質押記錄
mapping(uint256 => PledgeType) public invitationPledges; // 被邀請人質押的信息,用於計算邀請收益
mapping(address => RecommendObjType) public recommendObj; // 用戶綁定記錄
mapping(address => uint256[]) public invitationTokens; // 所有下級貢獻收益tokenID
mapping(address => address[]) public invitationAddress; // 所有下級的地址
mapping(address => PledgeWithdrawRecordType[]) public pledgeWithdrawRecord; // 質押收益體現記錄
mapping(address => InvitationWithdrawRecordType[]) public invitationWithdrawRecord; // 邀請收益體現記錄
address[] public blackList; //黑名單
address[] public whiteList; //白名單
mapping(address => PledgeType[]) public pledgeDestoryRecords; // 質押銷毀記錄
uint256 public invitationRate; //邀請收益率
uint256 public nextTokenId;//NFTID
bool public pledgeStatus; //質押開關
uint256 public dayTime;
// 獲取質押記錄
function getPledgeRecords(address _owner) public view returns(PledgeType[] memory)
// 獲取質押提现記錄
function getPledgeWithdrawRecord(address _owner) public view returns(PledgeWithdrawRecordType[] memory)
// 獲取邀請提现記錄
function getInvitationWithdrawRecord(address _owner) public view returns(InvitationWithdrawRecordType[] memory)
// 獲取銷毀記錄
function getPledgeDestoryRecords(address _owner) public view returns(PledgeType[] memory)
// 獲取質押產品信息
function getProductInfo() public view returns (ProductInfo[] memory)
/ 獲取該地址的所有質押信息
function getOwnerAllPledgeInfo( address _ownerAddress ) public view returns (PledgeType[] memory result)
// 綁定推薦人
function bindRecommend(address _referrer) internal
// 設置推薦人的收益
function setInvitationIncomes(PledgeType memory _pledge) internal
// 質押
function pledge(uint256 amount, uint256 index, address _referrer) external onlyBlacks
// 獲取該地址所有NFT的tokenId
function getOwnerAllTokens( address _ownerAddress ) public view returns (uint256[] memory)
// 計算利息 1.計算可領取的質押收益 2.計算可領取的邀請收益
function calculateInterest( PledgeType memory _pledge ) public view returns (uint256)
// 獲取所有可提現的利息
function getWithdrawbleAmount( address _owner ) public view returns (uint256)
// 提取質押所有利息
function withdraAllInterest() external onlyBlacks
// 提取質押單個利息
function withdrawInterest(uint256 tokenId) external onlyBlacks
// 邀請: 獲取該地址所有下級的質押記錄
function getOwnerInvitationPledges( address addr ) public view returns (PledgeType[] memory result)
// 獲取邀請貢獻 當前所有可提取的收益
function getOwnerAllInvitationWithdrawAmout(address owner) public view returns(uint256)
// 提取所有邀請利息
function withdraInvitationAllInterest() external onlyBlacks
// 提取單個邀請利息
function withdrawInvitationInterest(uint256 tokenId) external onlyBlacks
// 獲取所有下級
function getAllInvitationMember( address addr ) public view returns (RecommendObjType[] memory result)
// 獲取當前時間
function getCurrentTime() public view returns (uint256)
// 銷毀NFT 退回本金
function destroyPledge(uint256 tokenId) external onlyBlacks
// 設置邀請收益率
function setInvitationRate(uint256 _rate) external onlyAdmin
// 設置質押和提現狀態
function setPledgeStatus(bool _status) external onlyAdmin
// 添加黑名單 1.黑名单 2.白名单
function addBlackOrWhiteList(address[] memory _blacks,uint256 _type) external onlyAdmin
// 删除黑名單 1.黑名单 2.白名单
function delBlackOrWhiteList(address[] memory _blacks,uint256 _type) external onlyAdmin
// 獲取黑名單 1.黑名单 2.白名单
function getBlackOrWhiteList(uint256 _type) public view returns (address[] memory)
// 設置分傭時間 默認為1天
function setDayTime(uint256 _time) external onlyAdmin
// 設置產品信息
function setProductInfo(uint256[] memory _days,uint256[] memory _rates) external onlyAdmin
// 获取单个质押或邀请信息 1.质押 2.邀请
function getDetails(uint256 tokenId,uint256 _type) public view returns(PledgeType memory)
// 添加NFT ID 為黑名單 并且修改NFT ID對應質押的狀態
function addNftBalcks(uint256[] memory _tokenIds) external onlyAdmin
// 刪除NFT ID 黑名單 并且修改NFT ID對應質押的狀態
function deleteNftBlacks(uint256[] memory _ids) external onlyAdmin
```
### NFT 合約方法
```
address[] admins; 管理員地址
address public deployAddress; 部署人地址
bool first; 是否為第一次初始化
address public pledgeAddress; 質押合約地址
uint256[] public blacks; NFT ID 黑名單
鑄造NFT,只供質押合約條用
function mint(address to, uint256 tokenId) external
設置質押合約地址
function setPledgeAddress(address _pledgeAddr) external onlyAdmin
<!-- 添加管理員,只供部署者使用 -->
function addAdmin(address[] memory _adds) external onlyAdmin
<!-- 刪除管理員 ,只供部署者使用 -->
function deleteAdmin(address[] memory _dels) external onlyAdmin
<!-- 獲取管理員 -->
function getAdmin() public view returns(address[] memory)
<!-- 添加黑名單 管理員只用 -->
function addBlacks(uint256[] memory _tokenIds) external
<!-- 刪除黑名單 -->
function delBlacks(uint256[] memory _tokenIds) external
<!-- 獲取黑名單 -->
function getBlacks() public view returns(uint256[] memory)
<!-- 重寫_update, 轉賬時驗證黑名單進行斷言 -->
function _update(address to, uint256 tokenId, address auth) internal virtual override returns(address)
```
### Pool合約
```
IERC20 tokenContract;
NFT nftContract;
address public _pledgeContractAddress; 質押合約地址
bool public poolStatus; 狀態
// 存款函数,允许用户向池中存入资金
function deposit(address from, uint256 amount) external
// 提款函数,允许用户从池中提取资金 只供質押合約使用
function withdraw(address to, uint256 amount) external
<!-- 設置質押合約地址 只供管理員使用 -->
function setPledgeContractAddress(address addr) external onlyAdmin
<!-- 設置狀態 只供管理員使用 -->
function setPoolStatus(bool _status) external onlyAdmin
<!-- 提取Pool合約的FIL 只供管理員使用 -->
function withdrawTo(uint256 amount) external onlyAdmin
```

3
env-temp

@ -0,0 +1,3 @@
ETHERSCAN_API_KEY=
ACCOUNT_PRIVATE=
FIL_ADDRESS="0x0d8ce2a99bb6e3b7db580ed848240e4a0f9ae153"

43
hardhat.config.ts

@ -0,0 +1,43 @@
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
import 'dotenv/config';
import "@openzeppelin/hardhat-upgrades";
const config: HardhatUserConfig = {
solidity: {
version:"0.8.24",
settings:{
optimizer: {
enabled: true,
runs: 1000,
},
}
},
networks:{
bscTest: {
url: "https://data-seed-prebsc-1-s1.bnbchain.org:8545",
accounts: [
process.env.ACCOUNT_PRIVATE as string,
],
gasPrice:10000000000
},
bscMain: {
url:'https://binance.llamarpc.com',
accounts:[
process.env.ACCOUNT_PRIVATE as string,
]
},
local: {
url: "http://127.0.0.1:8545/",
accounts: ["0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"],
},
},
etherscan:{
apiKey:process.env.ETHERSCAN_API_KEY
}
};
// npx hardhat verify --network bscTest 0x8F7d8242d1A60f177e7389Bad8A7680FA50f2B89
export default config;

14221
package-lock.json
File diff suppressed because it is too large
View File

32
package.json

@ -0,0 +1,32 @@
{
"name": "hardhat-project",
"devDependencies": {
"@nomicfoundation/hardhat-chai-matchers": "^2.0.6",
"@nomicfoundation/hardhat-ethers": "^3.0.5",
"@nomicfoundation/hardhat-network-helpers": "^1.0.10",
"@nomicfoundation/hardhat-toolbox": "^4.0.0",
"@nomicfoundation/hardhat-verify": "^2.0.4",
"@openzeppelin/contracts": "^5.0.2",
"@openzeppelin/contracts-upgradeable": "^5.0.2",
"@openzeppelin/hardhat-upgrades": "^3.0.5",
"@typechain/ethers-v6": "^0.5.1",
"@typechain/hardhat": "^9.1.0",
"@types/chai": "^4.3.14",
"@types/mocha": "^10.0.6",
"chai": "^4.4.1",
"dotenv": "^16.4.5",
"ethers": "^6.11.1",
"hardhat": "^2.22.2",
"hardhat-gas-reporter": "^1.0.10",
"hardhat-upgrades": "^0.0.0",
"solidity-coverage": "^0.8.12",
"ts-node": "^10.9.2",
"typechain": "^8.3.2",
"typescript": "^5.4.4"
},
"scripts": {
"deploy:dev": "npx hardhat run --network bscTest scripts/deployProxy.ts",
"deploy:local": "npx hardhat run --network local scripts/deployProxy.ts",
"deploy:prod": "npx hardhat run --network bscMain scripts/deployProxy.ts"
}
}

74
scripts/deployProxy.ts

@ -0,0 +1,74 @@
import { ethers, upgrades } from "hardhat";
async function main() {
// console.log("開始部署FIL合約");
// const FIL = await ethers.getContractFactory("FIL");
// const fil = await FIL.deploy();
// console.log("FIL合約", fil.target);
const FIL_ADDRESS = process.env.FIL_ADDRESS
// const FIL_ADDRESS = fil.target
console.log('fil地址:',FIL_ADDRESS);
console.log("開始部署NFT合約");
const NFT = await ethers.getContractFactory("NFT");
const nft = await NFT.deploy("MyNFT", "MNFT");
console.log("NFT合約", nft.target);
console.log("開始部署Pool合約");
const Pool = await ethers.getContractFactory("Pool");
const pool = await upgrades.deployProxy(Pool,[FIL_ADDRESS,nft.target],{ initializer: "initialize" });
console.log("Pool合約", pool.target);
console.log("開始部署Pledge合約");
const Pledge = await ethers.getContractFactory("Pledge");
const pledge = await upgrades.deployProxy(
Pledge,
[nft.target,pool.target],
{ initializer: "initialize" }
);
console.log("Pledge合約", pledge.target);
console.log('執行初始化設置合約地址');
const tx = await nft.setPledgeAddress(pledge.target);
await tx.wait()
const tx1 = await pool.setPledgeContractAddress(pledge.target);
await tx1.wait()
// 測試使用
console.log('設置成功');
console.log('NFT的質押合約地址',await nft.pledgeAddress());
console.log('Pool的質押合約地址',await pool._pledgeContractAddress());
console.log('质押时间',await pledge.dayTime());
}
async function mainUpgradeProxy() {
// 3.1173
const poolAddress = "";
const pledgeAddress = "0xD8553004442098415734A9EFE49e13E29919BfF9";
// const Pool = await ethers.getContractFactory("Pool");
// const pool = await upgrades.upgradeProxy(poolAddress, Pool);
console.log('開始升級');
const Pledge = await ethers.getContractFactory("Pledge");
const pledge = await upgrades.upgradeProxy(pledgeAddress, Pledge);
console.log('升級成功');
// console.log("Pool合約", pool.address);
console.log("Pledge合約", pledge.target);
}
// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
// npx hardhat verify --network bscTest 0x8F7d8242d1A60f177e7389Bad8A7680FA50f2B89
// FIL合約 0x8F7d8242d1A60f177e7389Bad8A7680FA50f2B89
// NFT合約 0x8A50bd742312610b446286F43DF0DfB963f5fED5
// Pool合約 0x36821f56980814932530929C12dFC5fE80b50603
// Pledge合約 0x0d8e6b56FECEA32632a1B0fE73a84D4c5A2D44be

1138
sync.block.js
File diff suppressed because it is too large
View File

195
test/Pledge.ts

@ -0,0 +1,195 @@
import { time, loadFixture } from "@nomicfoundation/hardhat-network-helpers";
import { ethers, network, upgrades } from "hardhat";
describe("NFT", function () {
async function deployOneYearLockFixture() {
// Contracts are deployed using the first signer/account by default
const [owner, otherAccount] = await ethers.getSigners();
const FIL = await ethers.getContractFactory("FIL");
const fil = await FIL.deploy();
const NFT = await ethers.getContractFactory("NFT");
const nft = await NFT.deploy("MyNFT", "MNFT");
const Pool = await ethers.getContractFactory("Pool");
const pool = await upgrades.deployProxy(Pool, [fil.target, nft.target]);
const Pledge = await ethers.getContractFactory("Pledge");
const pledge = await await upgrades.deployProxy(Pledge, [
nft.target,
pool.target,
]);
await nft.setPledgeAddress(pledge.target);
await pool.setPledgeContractAddress(pledge.target);
await pledge.setDayTime(ethers.toBigInt(1));
return { nft, owner, otherAccount, pool, pledge, fil };
}
// 控制block.timestamp + 1天
async function setBlockTimestamp() {
// Get current block timestamp
const initialTimestamp = (await ethers.provider.getBlock("latest"))!
.timestamp;
// Set next block timestamp to 1 day later
await network.provider.send("evm_setNextBlockTimestamp", [
initialTimestamp + 86400,
]);
await network.provider.send("evm_mine");
}
// describe("Test deploy", function () {
// it("測試質押合約從Pool提現", async () => {
// const {pool,owner,pledge,fil} = await loadFixture(deployOneYearLockFixture);
// await fil.transfer(pool.target,ethers.parseEther('1000'))
// console.log('賬戶餘額:',ethers.formatEther(await fil.balanceOf(owner.address)));
// console.log('Pool餘額:',ethers.formatEther(await fil.balanceOf(pool.target)));
// await pledge.withdrawPool(ethers.parseEther("1"))
// console.log('賬戶餘額:',ethers.formatEther(await fil.balanceOf(owner.address)));
// console.log('Pool餘額:',ethers.formatEther(await fil.balanceOf(pool.target)));
// });
// });
describe("Test Contract", async function () {
it("测试NFT黑名单", async () => {
const { pledge,fil,pool,otherAccount,owner,nft } = await loadFixture(deployOneYearLockFixture);
await fil.approve(pool.target, ethers.parseEther("1000"));
await pledge.pledge(ethers.parseEther("1000"), "0x2",otherAccount.address);
// console.log(await pledge.getOwnerAllPledgeInfo(owner.address));
await pledge.addNftBalcks(["0x1"])
await nft.setApprovalForAll(pledge.target,true)
await pledge.destroyPledge("0x1")
});
// it("测试质押销毁",async ()=>{
// const {nft,pledge,pool,fil,owner,otherAccount} = await loadFixture(deployOneYearLockFixture)
// await fil.approve(pool.target, ethers.parseEther("1000"));
// const res = await pledge.pledge(ethers.parseEther("1000"), "0x2",otherAccount.address);
// console.log("销毁前账户余额:",ethers.formatEther(await fil.balanceOf(owner.address)));
// console.log("销毁前池子余额:",ethers.formatEther(await fil.balanceOf(pool.target)));
// await nft.setApprovalForAll(pledge.target,true)
// await pledge.destroyPledge("0x1")
// console.log("销毁记录:",await pledge.getPledgeDestoryRecords(owner.address));
// console.log("销毁后账户余额:",ethers.formatEther(await fil.balanceOf(owner.address)));
// console.log("销毁后池子余额:",ethers.formatEther(await fil.balanceOf(pool.target)));
// console.log('质押合约NFT余额:',await nft.balanceOf(pledge.target));
// })
// it("测试修改质押信息",async function(){
// const {pledge} = await loadFixture(deployOneYearLockFixture)
// console.log(await pledge.getProductInfo());
// await pledge.setProductInfo([ethers.toBigInt(179),ethers.toBigInt(279),ethers.toBigInt(359)],[ethers.toBigInt(17),ethers.toBigInt(18),ethers.toBigInt(19)])
// console.log(await pledge.getProductInfo());
// })
// success
// it("質押及提取利息修改提現時間及生成記錄",async()=>{
// const { fil, nft, otherAccount, pledge, owner, pool } = await loadFixture(
// deployOneYearLockFixture
// );
// async function stop (){
// return new Promise((resolve)=>{
// setTimeout(()=>{
// resolve(0)
// },2000)
// })
// }
// //質押及提取利息
// await fil.approve(pool.target, ethers.parseEther("1000"));
// console.log("授權給池子合約的金額:",ethers.formatEther(await fil.allowance(owner.address,pool.target)))
// const res = await pledge.pledge(ethers.parseEther("1000"), "0x2",otherAccount.address);
// console.log('開始時間:',new Date().getSeconds());
// console.log(await pledge.getOwnerAllPledgeInfo(owner.address));
// console.log("池子的FIL餘額:",ethers.formatEther(await fil.balanceOf(pool.target)));
// await stop()
// await stop()
// await stop()
// await pledge.setDayTime(ethers.toBigInt(1));
// console.log('結束時間:',new Date().getSeconds());
// console.log('收益',ethers.formatEther(await pledge.getWithdrawbleAmount(owner.address)));
// console.log(await pledge.getOwnerAllPledgeInfo(owner.address));
// console.log('賬戶餘額',ethers.formatEther(await fil.balanceOf(owner.address)));
// await pledge.withdraAllInterest()
// console.log('結束時間:',new Date().getSeconds());
// console.log('賬戶餘額',ethers.formatEther(await fil.balanceOf(owner.address)));
// console.log(await pledge.getOwnerAllPledgeInfo(owner.address));
// console.log(await pledge.getPledgeWithdrawRecord(owner.address));
// console.log('邀请人的收益:',ethers.formatEther(await pledge.getOwnerAllInvitationWithdrawAmout(otherAccount.address)));
// console.log(await pledge.getOwnerInvitationPledges(otherAccount.address));
// })
// it("Test Mint", async function () {
// // console.log(ethers.utils.formatEther(await fil.balanceOf(owner.address)));
// // await fil.transfer(otherAccount.address,ethers.utils.parseEther("1"))
// // console.log(ethers.utils.formatEther(await fil.balanceOf(otherAccount.address)));
// // console.log(owner.address);
// // console.log(pool.address);
// // await fil.approve(pool.address, ethers.utils.parseEther("2"));
// // console.log(await pool.transfer("0x1"));
// // console.log(await pledge.getProductInfo());
// // 1710317648n
// // 1710317653n
// // 質押體現利息
// // await pledge.withdraAllInterest();
// // console.log(await fil.balanceOf(owner.address));
// // console.log(await fil.balanceOf(otherAccount.address));
// // console.log("池子的FIL餘額:",ethers.utils.formatEther(await fil.balanceOf(pool.address)));
// // 1 000 000 000 000 000 000
// // console.log('池子餘額',await fil.balanceOf(pool.address))
// // 推薦人的收益記錄
// // console.log('當前地址:'+owner.address);
// // console.log('邀請地址:'+otherAccount.address);
// // 獲取所有的邀請成員
// // console.log("所有被邀請成員",await pledge.getAllInvitationMember(otherAccount.address))
// // 獲取綁定信息
// // console.log("綁定信息",await pledge.recommendObj(owner.address))
// // 邀請: 獲取當前所有可提取的收益
// // console.log("獲取當前所有可提取的收益",await pledge.getOwnerAllInvitationWithdrawAmout(otherAccount.address))
// // 邀請: 獲取所有下級質押信息
// // console.log("所有被邀請人的質押信息",await pledge.getOwnerInvitationPledges(otherAccount.address))
// // 获取nft数量
// // console.log("NFT数量:+", await nft.balanceOf(owner.address));
// // 获取所有质押信息
// // console.log(await pledge.getOwnerAllPledgeInfo(owner.address));
// // 获取所有NFT tokenId
// // console.log(await pledge.getOwnerAllTokens(owner.address))
// // 获取所有利息
// // console.log(await pledge.getWithdrawbleAmount(owner.address));
// // await setBlockTimestamp()
// // console.log(await pledge.getWithdrawbleAmount(owner.address));
// // await setBlockTimestamp()
// // console.log(await pledge.getWithdrawbleAmount(owner.address));
// // await setBlockTimestamp()
// // console.log(await pledge.getWithdrawbleAmount(owner.address));
// // await setBlockTimestamp()
// });
// it("Test Admin", async function () {
// const { nft, otherAccount,pledge,owner } = await loadFixture(deployOneYearLockFixture);
// // await nft.connect(otherAccount.address).setPledgeAddress(pledge.address);
// // await nft.connect(otherAccount.address).addAdmin([otherAccount.address]);
// // await nft.setPledgeAddress(pledge.address);
// // await nft.addAdmin([otherAccount.address,nft.address])
// // console.log(await nft.getAdmin());
// // console.log(await nft.pledgeAddress());
// // await nft.deleteAdmin([owner.address])
// // console.log(await nft.getAdmin());
// });
});
});

11
tsconfig.json

@ -0,0 +1,11 @@
{
"compilerOptions": {
"target": "es2020",
"module": "commonjs",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"resolveJsonModule": true
}
}
Loading…
Cancel
Save