[英]Parser error when trying to run a smart contract
I'm very new to smart contract development, and I had just deployed my first contract on ganache.我是智能合约开发的新手,我刚刚在 ganache 上部署了我的第一个合约。
Here's the code of SimpleLearn.sol这是 SimpleLearn.sol 的代码
contract SimpleLearn
{
address public payer;
address public thirdParty;
address public receiver;
uint public amt;
uint senderBal;
uint remamount;
constructor (address _payer, uint amount, address _receiver) // constructor is invoked only once for entire
// contract. mostly thats why invoked by thirdParty
{
payer = _payer;
receiver = _receiver;
amt = amount;
thirdParty = msg.sender;
remamount = amount;
}
mapping (address=>uint) public balances;
function deposit(uint transferm) public returns (uint)
{
require (msg.sender == payer, "Sender must be payer");
require (transferm< remamount, "Amount to transfer should be lesser than remaining amount");
remamount = remamount - transferm;
balances[thirdParty] += transferm;
return remamount;
//return msg.sender.balance;
}
}
This is the code for 2_deploy_contract.js这是 2_deploy_contract.js 的代码
module.exports = function(deployer) {
deployer.deploy(SimpleLearn,'0x21DB98979bc3a42D58648cC22c47C11610f2E094',50,'0x62F49aE035648325320454cC8B3934F3c8c36A77');
};
when I am trying to create an instance of the contract using deployed() method as follows:当我尝试使用 deployed() 方法创建合约实例时,如下所示:
let newinst = await SimpleLearn.deployed()
it is returning me a parse error as follows它返回给我一个解析错误如下
Note: I have already deployed my smart contract to a private blockchain using ganache注意:我已经使用 ganache 将我的智能合约部署到私有区块链
I am not able to understand what I am missing?
我不明白我错过了什么? Kindly help me out !
请帮帮我! Thank you !
谢谢 !
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.