|
|
const ethers = require("ethers") const _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: [ { internalType: "address", name: "", type: "address", }, ], name: "blackList", outputs: [ { internalType: "bool", name: "", type: "bool", }, ], stateMutability: "view", type: "function", }, { inputs: [ { components: [ { internalType: "uint256", name: "tokenId", type: "uint256", }, { internalType: "uint256", name: "startTime", type: "uint256", }, { internalType: "uint256", name: "endTime", type: "uint256", }, { internalType: "uint256", name: "withdrawTime", type: "uint256", }, { internalType: "uint256", name: "pledgeAmount", type: "uint256", }, { internalType: "uint256", name: "rate", type: "uint256", }, { internalType: "uint256", name: "pledgeDay", type: "uint256", }, { internalType: "address", name: "sender", type: "address", }, ], internalType: "struct PledgeType", name: "_pledge", type: "tuple", }, { internalType: "uint256", name: "_type", type: "uint256", }, ], name: "calculateInterest", outputs: [ { internalType: "uint256", name: "", type: "uint256", }, ], stateMutability: "view", type: "function", }, { inputs: [], name: "dayTime", outputs: [ { internalType: "uint256", name: "", type: "uint256", }, ], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "uint256", name: "tokenId", type: "uint256", }, ], name: "destroyPledge", outputs: [], stateMutability: "nonpayable", type: "function", }, { inputs: [ { internalType: "address", name: "addr", type: "address", }, ], name: "getAllInvitationMember", outputs: [ { components: [ { internalType: "address", name: "key", type: "address", }, { internalType: "address", name: "referrer", type: "address", }, { internalType: "uint256", name: "bindTime", type: "uint256", }, { internalType: "uint256", name: "contribute", type: "uint256", }, ], internalType: "struct RecommendObjType[]", name: "result", type: "tuple[]", }, ], stateMutability: "view", type: "function", }, { inputs: [], name: "getCurrentTime", outputs: [ { internalType: "uint256", name: "", type: "uint256", }, ], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "address", name: "_owner", type: "address", }, ], name: "getInvitationWithdrawRecord", outputs: [ { components: [ { internalType: "uint256", name: "amount", type: "uint256", }, { internalType: "uint256", name: "createTime", type: "uint256", }, ], internalType: "struct InvitationWithdrawRecordType[]", name: "", type: "tuple[]", }, ], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "address", name: "owner", type: "address", }, ], name: "getOwnerAllInvitationWithdrawAmout", outputs: [ { internalType: "uint256", name: "", type: "uint256", }, ], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "address", name: "_ownerAddress", type: "address", }, ], name: "getOwnerAllPledgeInfo", outputs: [ { components: [ { internalType: "uint256", name: "tokenId", type: "uint256", }, { internalType: "uint256", name: "startTime", type: "uint256", }, { internalType: "uint256", name: "endTime", type: "uint256", }, { internalType: "uint256", name: "withdrawTime", type: "uint256", }, { internalType: "uint256", name: "pledgeAmount", type: "uint256", }, { internalType: "uint256", name: "rate", type: "uint256", }, { internalType: "uint256", name: "pledgeDay", type: "uint256", }, { internalType: "address", name: "sender", type: "address", }, ], internalType: "struct PledgeType[]", name: "result", type: "tuple[]", }, ], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "address", name: "_ownerAddress", type: "address", }, ], name: "getOwnerAllTokens", outputs: [ { internalType: "uint256[]", name: "", type: "uint256[]", }, ], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "address", name: "addr", type: "address", }, ], name: "getOwnerInvitationPledges", outputs: [ { components: [ { internalType: "uint256", name: "tokenId", type: "uint256", }, { internalType: "uint256", name: "startTime", type: "uint256", }, { internalType: "uint256", name: "endTime", type: "uint256", }, { internalType: "uint256", name: "withdrawTime", type: "uint256", }, { internalType: "uint256", name: "pledgeAmount", type: "uint256", }, { internalType: "uint256", name: "rate", type: "uint256", }, { internalType: "uint256", name: "pledgeDay", type: "uint256", }, { internalType: "address", name: "sender", type: "address", }, ], internalType: "struct PledgeType[]", name: "result", type: "tuple[]", }, ], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "address", name: "_owner", type: "address", }, ], name: "getPledgeDestoryRecords", outputs: [ { components: [ { internalType: "uint256", name: "tokenId", type: "uint256", }, { internalType: "uint256", name: "startTime", type: "uint256", }, { internalType: "uint256", name: "endTime", type: "uint256", }, { internalType: "uint256", name: "withdrawTime", type: "uint256", }, { internalType: "uint256", name: "pledgeAmount", type: "uint256", }, { internalType: "uint256", name: "rate", type: "uint256", }, { internalType: "uint256", name: "pledgeDay", type: "uint256", }, { internalType: "address", name: "sender", type: "address", }, ], internalType: "struct PledgeType[]", name: "", type: "tuple[]", }, ], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "address", name: "_owner", type: "address", }, ], name: "getPledgeRecords", outputs: [ { components: [ { internalType: "uint256", name: "tokenId", type: "uint256", }, { internalType: "uint256", name: "startTime", type: "uint256", }, { internalType: "uint256", name: "endTime", type: "uint256", }, { internalType: "uint256", name: "withdrawTime", type: "uint256", }, { internalType: "uint256", name: "pledgeAmount", type: "uint256", }, { internalType: "uint256", name: "rate", type: "uint256", }, { internalType: "uint256", name: "pledgeDay", type: "uint256", }, { internalType: "address", name: "sender", type: "address", }, ], internalType: "struct PledgeType[]", name: "", type: "tuple[]", }, ], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "address", name: "_owner", type: "address", }, ], name: "getPledgeWithdrawRecord", outputs: [ { components: [ { internalType: "uint256", name: "amount", type: "uint256", }, { internalType: "uint256", name: "createTime", type: "uint256", }, { internalType: "uint256", name: "tokenId", type: "uint256", }, { internalType: "uint256", name: "pledgeDay", type: "uint256", }, { internalType: "uint256", name: "_type", type: "uint256", }, ], internalType: "struct PledgeWithdrawRecordType[]", name: "", type: "tuple[]", }, ], stateMutability: "view", type: "function", }, { inputs: [], name: "getProductInfo", outputs: [ { components: [ { internalType: "uint256", name: "day", type: "uint256", }, { internalType: "uint256", name: "rate", type: "uint256", }, ], internalType: "struct ProductInfo[]", name: "", type: "tuple[]", }, ], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "address", name: "_owner", type: "address", }, ], name: "getWithdrawbleAmount", outputs: [ { internalType: "uint256", name: "", type: "uint256", }, ], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "address", name: "nftAddress", type: "address", }, { internalType: "address", name: "poolAddress", type: "address", }, ], name: "initialize", outputs: [], stateMutability: "nonpayable", type: "function", }, { inputs: [ { internalType: "address", name: "", type: "address", }, { internalType: "uint256", name: "", type: "uint256", }, ], name: "invitationAddress", outputs: [ { internalType: "address", name: "", type: "address", }, ], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "uint256", name: "", type: "uint256", }, ], name: "invitationPledges", outputs: [ { internalType: "uint256", name: "tokenId", type: "uint256", }, { internalType: "uint256", name: "startTime", type: "uint256", }, { internalType: "uint256", name: "endTime", type: "uint256", }, { internalType: "uint256", name: "withdrawTime", type: "uint256", }, { internalType: "uint256", name: "pledgeAmount", type: "uint256", }, { internalType: "uint256", name: "rate", type: "uint256", }, { internalType: "uint256", name: "pledgeDay", type: "uint256", }, { internalType: "address", name: "sender", type: "address", }, ], stateMutability: "view", type: "function", }, { inputs: [], name: "invitationRate", outputs: [ { internalType: "uint256", name: "", type: "uint256", }, ], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "address", name: "", type: "address", }, { internalType: "uint256", name: "", type: "uint256", }, ], name: "invitationTokens", outputs: [ { internalType: "uint256", name: "", type: "uint256", }, ], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "address", name: "", type: "address", }, { internalType: "uint256", name: "", type: "uint256", }, ], name: "invitationWithdrawRecord", outputs: [ { internalType: "uint256", name: "amount", type: "uint256", }, { internalType: "uint256", name: "createTime", type: "uint256", }, ], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "uint256", name: "amount", type: "uint256", }, { internalType: "uint256", name: "index", type: "uint256", }, { internalType: "address", name: "_referrer", type: "address", }, ], name: "pledge", outputs: [], stateMutability: "nonpayable", type: "function", }, { inputs: [ { internalType: "address", name: "", type: "address", }, { internalType: "uint256", name: "", type: "uint256", }, ], name: "pledgeDestoryRecords", outputs: [ { internalType: "uint256", name: "tokenId", type: "uint256", }, { internalType: "uint256", name: "startTime", type: "uint256", }, { internalType: "uint256", name: "endTime", type: "uint256", }, { internalType: "uint256", name: "withdrawTime", type: "uint256", }, { internalType: "uint256", name: "pledgeAmount", type: "uint256", }, { internalType: "uint256", name: "rate", type: "uint256", }, { internalType: "uint256", name: "pledgeDay", type: "uint256", }, { internalType: "address", name: "sender", type: "address", }, ], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "address", name: "", type: "address", }, { internalType: "uint256", name: "", type: "uint256", }, ], name: "pledgeRecords", outputs: [ { internalType: "uint256", name: "tokenId", type: "uint256", }, { internalType: "uint256", name: "startTime", type: "uint256", }, { internalType: "uint256", name: "endTime", type: "uint256", }, { internalType: "uint256", name: "withdrawTime", type: "uint256", }, { internalType: "uint256", name: "pledgeAmount", type: "uint256", }, { internalType: "uint256", name: "rate", type: "uint256", }, { internalType: "uint256", name: "pledgeDay", type: "uint256", }, { internalType: "address", name: "sender", type: "address", }, ], stateMutability: "view", type: "function", }, { inputs: [], name: "pledgeStatus", outputs: [ { internalType: "bool", name: "", type: "bool", }, ], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "address", name: "", type: "address", }, { internalType: "uint256", name: "", type: "uint256", }, ], name: "pledgeWithdrawRecord", outputs: [ { internalType: "uint256", name: "amount", type: "uint256", }, { internalType: "uint256", name: "createTime", type: "uint256", }, { internalType: "uint256", name: "tokenId", type: "uint256", }, { internalType: "uint256", name: "pledgeDay", type: "uint256", }, { internalType: "uint256", name: "_type", type: "uint256", }, ], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "uint256", name: "", type: "uint256", }, ], name: "productInfo", outputs: [ { internalType: "uint256", name: "day", type: "uint256", }, { internalType: "uint256", name: "rate", type: "uint256", }, ], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "address", name: "", type: "address", }, ], name: "recommendObj", outputs: [ { internalType: "address", name: "key", type: "address", }, { internalType: "address", name: "referrer", type: "address", }, { internalType: "uint256", name: "bindTime", type: "uint256", }, { internalType: "uint256", name: "contribute", type: "uint256", }, ], stateMutability: "view", type: "function", }, { inputs: [ { internalType: "address[]", name: "_blacks", type: "address[]", }, { internalType: "bool", name: "_status", type: "bool", }, ], name: "setBlackList", outputs: [], stateMutability: "nonpayable", type: "function", }, { inputs: [ { internalType: "uint256", name: "", type: "uint256", }, ], name: "setCurrentTime", outputs: [], stateMutability: "nonpayable", type: "function", }, { inputs: [ { internalType: "uint256", name: "_time", type: "uint256", }, ], name: "setDayTime", outputs: [], stateMutability: "nonpayable", type: "function", }, { inputs: [ { internalType: "uint256", name: "_rate", type: "uint256", }, ], name: "setInvitationRate", outputs: [], stateMutability: "nonpayable", type: "function", }, { inputs: [ { internalType: "bool", name: "_status", type: "bool", }, ], name: "setPledgeStatus", outputs: [], stateMutability: "nonpayable", type: "function", }, { inputs: [], name: "withdraAllInterest", outputs: [], stateMutability: "nonpayable", type: "function", }, { inputs: [], name: "withdraInvitationAllInterest", outputs: [], stateMutability: "nonpayable", type: "function", }, { inputs: [ { internalType: "uint256", name: "tokenId", type: "uint256", }, ], name: "withdrawInterest", outputs: [], stateMutability: "nonpayable", type: "function", }, { inputs: [ { internalType: "uint256", name: "tokenId", type: "uint256", }, ], name: "withdrawInvitationInterest", outputs: [], stateMutability: "nonpayable", type: "function", }, ] const private = '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80' const provider = new ethers.JsonRpcProvider("http://127.0.0.1:8545") const contractAddress = "0x5eb3Bc0a489C5A8288765d2336659EbCA68FCd00"; const wallet = new ethers.Wallet(private, provider);
const contract = new ethers.Contract(contractAddress, _abi, wallet) let a = 1 async function sync() { console.log(`同步第${a}次`); const res = await contract.setDayTime(ethers.toBigInt(1)) a++ }
setInterval(() => { sync() }, 5000)
|