你好,我为人群资金写了一份聪明的合同,实际上我有两份合同,一份是创建捐赠基金的活动,另一份是为人群资金创建的摄像头,并在用户创建活动时将所有的活动地址存储在一个地方。现在,当我试图将存储的活动地址作为getStaticPaths.To过滤器中的params中的端点传递给下一个js中的数据时,Error: network does not support ENS (operation=“ENS”, network=“maticmum”, code=UNSUPPORTED_OPERATION,
version=providers/5.5.3网络不支持这个错误,谁能告诉我为什么会出现这个错误吗?
这是我的智能合同代码
contract campaignFactory{
Here is my address stored
address [] public deployedCampaigns;
event createdCampaign(
address indexed owner,
string indexed category,
uint indexed timestamp,
string title,
string storyUrI,
uint requireAmount,
string imageUrI,
address campaignAddress
);
function createCampaign(
string memory title,
string memory storyUrI,
uint requireAmount,
string memory category,
string memory imageUrI
)public{
Campaign newCampaign=new Campaign(title,storyUrI,requireAmount,msg.sender,imageUrI);
deployedCampaigns.push(address(newCampaign));
emit createdCampaign(msg.sender, category, block.timestamp, title, storyUrI, requireAmount, imageUrI,address(newCampaign));
}
this is my other smart contract to creat campaigns and donate function to send amount to owner who deployed campaigns.
contract Campaign{
event donated(address indexed owner,uint indexed amount,uint indexed timestamp);
string public campaignTitle;
string public story;
uint public requireAmount;
uint public receivedAmount;
address payable public campaignOwner;
string public image;
constructor(
string memory _campaignTitle,
string memory _story,
uint _requireAmount,
address _owner,
string memory _image
){
campaignTitle=_campaignTitle;
story=_story;
requireAmount=_requireAmount;
campaignOwner=payable(_owner);
image=_image;
}
function donate()payable public{
require(requireAmount>receivedAmount,"Require Amount is fullfilled");
campaignOwner.transfer(msg.value);
receivedAmount+=msg.value;
emit donated(msg.sender, msg.value, block.timestamp);
}
}
这是我的下一个Js代码
export async function getStaticPaths(){
const provider=new ethers.providers.JsonRpcProvider(
AlchemyProvider
);
const contract=new ethers.Contract(
contractAddress,
CampaignFactory.abi,
provider
)
const getAllCampaigns=contract.filters.createdCampaign();
const allCampaigns=await contract.queryFilter(getAllCampaigns);
return{
paths:allCampaigns.map((e)=>({
params:{```
**The Problem is coming here**
**address:e.args.campaignAddress.toString()**
}
})),
fallback:true
}
};
发布于 2023-05-09 11:01:15
您遇到的错误消息表明您提供的地址无效。如果地址中包含非预期字符(如空格或数字),则可能发生这种情况。在您的情况下,您使用的智能契约地址似乎无效。
参考这篇文章:https://github.com/NomicFoundation/hardhat/issues/1289
https://ethereum.stackexchange.com/questions/150005
复制相似问题