首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >solidity parser error请问怎么解决?

solidity parser error请问怎么解决?

提问于 2022-04-21 10:41:30
回答 0关注 0查看 123
代码语言:js
复制
pragma solidity ^0.4.24;

import "./AM.sol"; 
/** 
  * @title payment management contract 
  * @dev payment management 
  * @dev contract 
  */ 
 
contract PAYMENT { 
     
     // transaction 
     struct payment{ 
         uint256 txId; 
         address fromAddr; 
         uint64 fromCurrencyId; 
         uint256 fromAmount; 
         address toAddr; 
         uint64 toCurrencyId; 
         uint256 toAmount; 
         address delegator; 
         uint64   ratio; 
     } 
 
     // admin of the contract 
     address public admin; 
     // tx id 
     uint256 public txId = 0; 
     // account contract address 
     mapping(address => address) public accountContractOf_; 
     // store payments 
     mapping(uint256 => payment) public paymentOf_; 
 
     
     /** 
      * Constructor function 
      * 
      */ 
     constructor() public { 
         admin = msg.sender;                 // set the creator as admin } 
 
     /** 
      * registerContract 
      * by bank 
      * 
      * @param _accountContract The address of the account contract 
      */ 
    function registerContract(address _accountContract) public returns (bool success) { 
       accountContractOf_[msg.sender] = _accountContract; 
       return true; 
     } 

     /** 
      * transfer 
      * by bank 
      *  
      * @param _from the from address of payment 
      * @param _fromCurrencyId the from currencency id  
      * @param _to the to address of payment 
      * @param _toCurrencyId the to currencency id  
      * @param _toAmount the amount to send 
      */ 
     function transfer(address _from, uint64 _fromCurrencyId, address _to, uint64 _toCurrencyId, 
uint256 _toAmount) public returns (bool success) { 
       if (msg.sender != _from) { 
           return false; 
       } 
       payment storage pay = paymentOf_[txId]; 
       pay.txId = txId; 
       pay.fromAddr = _from; 
       pay.fromCurrencyId = _fromCurrencyId; 
       pay.toAddr = _to; 
       pay.toCurrencyId = _toCurrencyId; 
       pay.toAmount = _toAmount; 
 
       paymentOf_[txId] = pay; 
       return true; 
     } 
     
     /** 
      * delegateTransfer 
      * by market maker *  
      * fromAmount = _toAmount/ratio 
      *  
      * @param _txId the id of transaction 
      * @param _ratio the exchange rate 
      */ 
     function delegateTransfer(uint256 _txId, uint64 _ratio) public returns (bool success) { 
     
       uint256 fromAmount = paymentOf_[_txId].toAmount/_ratio; 
 
       paymentOf_[_txId].fromAmount = fromAmount; 
       paymentOf_[_txId].delegator = msg.sender; 
       paymentOf_[_txId].ratio = _ratio; 
         
       return true; 
     } 
     
     /** 
      * confirmTransfer 
      * by bank 
      *  
      * @param _txId the id of transaction 
      */ 
     function confirmTransfer(uint256 _txId) public returns (bool success) { 
       if (msg.sender != paymentOf_[_txId].toAddr) { 
           return false; 
       } 
       
       payment storage pay = paymentOf_[_txId]; 
       
       address fromAddr; 
       address toAddr; 
       address fromContract; 
       address toContract; 
 
       fromAddr = paymentOf_[_txId].fromAddr; 
       to Addr = paymentOf_[_txId].toAddr;  
       fromContract = accountContractOf_[fromAddr]; 
       to Contract = accountContractOf_[toAddr]; 
       
       AM fromAccountManager = AM(fromContract); 
       AM toAccountManager = AM(toContract); 
 
       if  (fromAccountManager.getAccount(pay.delegator,  pay.fromCurrencyId)  <  pay.fromAmount)  { 
           return false; 
       } 
       
       if (toAccountManager.getAccount(pay.delegator, pay.toCurrencyId) < pay.toAmount) { 
           return false; 
       } 
       
       fromAccountManager.increaseAccount(pay.delegator,  pay.fromCurrencyId,  pay.fromAm
ount); 
       to AccountManager.decreaseAccount(pay.delegator, pay.toCurrencyId, pay.toAmount); 
 
       return true; 
     } 
} 

显示如下错误

回答

和开发者交流更多问题细节吧,去 写回答
相关文章

相似问题

相关问答用户
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档