Contract-Debugging

得到一個“ReferenceError: artificats is not defined”——執行一個簡單的“approver”測試時出錯

  • March 28, 2020

(學習 Lynda Ethereum 課程)

執行下面的測試程式碼我得到以下錯誤:

truffle tests
Warning: Both truffle-config.js and truffle.js were found. Using truffle-config.js.
Using network 'test'.


Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.

/home/iii/Digital Ledger/contracts/migrations/2_depoly_contracts.js:1
var ApprovalContract = artificats.require("ApprovalContract");
                       ^

ReferenceError: artificats is not defined
    at /home/iii/Digital Ledger/contracts/migrations/2_depoly_contracts.js:1:24
    at Script.runInContext (vm.js:107:20)
    at Script.runInNewContext (vm.js:113:17)
    at Object.file (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:354543:12)
    at Migration._load (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:462577:24)
    at process._tickCallback (internal/process/next_tick.js:68:7)
Truffle v5.1.15 (core: 5.1.15)
Node v10.15.2

這也是契約:

pragma solidity ^0.5.16;

contract ApprovalContract {

 address payable public sender;
 address payable public receiver;
 address constant public approver = 0xd268143B6FBD9BC6533F778052710C962eaAa68C;


 function deposit(address payable _receiver) external payable {
   require(msg.value > 0);
   sender = msg.sender;
   receiver = _receiver;
 }

   function viewApprover() external pure returns(address) {
   return(approver);
 }

  function approve() external {
   require(msg.sender == approver);
   receiver.transfer(address(this).balance);
 }

}

更改artificatsartifacts

引用自:https://ethereum.stackexchange.com/questions/81962