Solidity

松露工件與 ABI 有何不同?

  • July 9, 2019

松露工件與 ABI 有何不同?Truffle 工件是否包含與使用 remix 生成的 ABI 不同的欄位?

Truffle 工件是一個 JSON 包,其中包含許多與合約相關的有用資訊,例如 ABI、合約字節碼、部署細節、編譯器版本等……

例子:

{
 "contractName": "Migrations",
 "abi": [],
 "bytecode": "0x...",
 "sourceMap": "",
 "deployedSourceMap": "",
 "sourcePath": "/project/contracts/Migrations.sol",
 "ast": {},
 "legacyAST": {},
 "compiler": {
   "name": "solc",
   "version": "0.5.0+commit.1d4f565a.Emscripten.clang"
 },
 "networks": {
   "17": {
     "events": {},
     "links": {},
     "address": "0x42a8d8ba55faAA734Ee07eD3179047169be5419e",
     "transactionHash": "0x4e5fc578b9ea44401047fc010dd1ee20cd899b8091fe4304ce0f955dc1d4db5b"
   }
 },
 "schemaVersion": "3.0.0",
 "updatedAt": "2018-12-19T17:59:54.615Z",
 "devdoc": {},
 "userdoc": {}
}

Remix 生成的 ABI 和 Truffle (field abi) 生成的 ABI 應該是完全一樣的。

為了添加到 Greg 的答案,本文件提供了有關 Truffle 工件的背景:https ://trufflesuite.github.io/artifact-updates/background.html#what-are-artifacts

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