function addBank (address bankAddress,
string memory bankName,
uint256 pincode,
string memory country,
string memory state,
string memory ifscCode,
string memory region) public{
require(msg.sender==admin,“Error:: only owner of the smart contract can Add BANK”);
if(admin==msg.sender){
bank memory b;
if(bankMap[bankAddress].exist){
revert("ERROR::Bank Already exist!!!");
}
b.bankAddress=bankAddress;
b.bankName=bankName;
b.pincode=pincode;
b.state=state;
b.region=region;
b.ifscCode=ifscCode;
b.exist=true;
b.kyc_count=0;
b.upvotes=0;
bankMap[bankAddress]=b;
bankLength++;
emit bankCreated(
b.bankAddress,
b.bankName,
b.pincode,
b.country,
b.state,
b.ifscCode,
b.region,
b.role,
b.kyc_count,
b.upvotes
);
}
else{
revert("ERROR:: you cannot add bank!!!");
}
}
event bankCreated(
address bankAddress,
string bankName,
uint256 pincode,
string country,
string state,
string ifscCode,
string region,
uint role,
uint256 kyc_count,
uint256 upvotes
);
i have created an event called bankcreated and i am emitting this event when i am calling function callled Addbank from my react frontend;
but i can’t see the results of it in my frontend…how can i use moralis useWeb3ExecuteFunction() for doing it…i want data direclty from smart contract to my frontend ,i don’t want to save it in moralis database