0.0.2 • Published 3 years ago

@truverse/contracts v0.0.2

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 years ago

Truebit Contracts

Truebit contract interfaces and ABI.

Interfaces in Solidity

Install this package

npm install @truverse/contracts

Use it in your contract

import "@truverse/contracts/Truebit.sol";

You can also import individual interfaces

import "@truverse/contracts/truebit/TRU.sol";
import "@truverse/contracts/truebit/Purchase.sol";

ABI and adresses in JSON

ABI and addresses

const truebit = require('@truverse/contracts').mainnet

const fs = new web3.eth.Contract(truebit.filesystem.abi, truebit.filesystem.address)
const tru = new web3.eth.Contract(truebit.tru.abi, truebit.tru.address)

ABI

const abi = require('@truverse/contracts/abi')

const fs = new web3.eth.Contract(abi.filesystem)
const tru = new web3.eth.Contract(abi.tru)

Addresses

const abi = require('@truverse/contracts/abi')
const chain = require('@truverse/contracts/chains/mainnet')

const fs = new web3.eth.Contract(abi.filesystem, chain.filesystem)
const tru = new web3.eth.Contract(abi.tru, chain.tru)

Contents

Truebit.sol is a single hand-crafted file that contains the following interfaces

  • Truebit (incentive layer)
  • FileSystem
  • TRU
  • Purchase

There are also automatically generated interfaces in individual files under truebit/

  • Incentive.sol
  • FileSystem.sol
  • TRU.sol
  • Purchase.sol
  • Interactive.sol
  • Judge.sol
  • IPFS.sol

Contract names

Truebit.soltruebit/X.solabi.jsontruebit-eth
TruebitIncentiveincentiveincentiveLayer
FileSystemFileSystemfilesystemfileSystem
TRUTRUtrutru
PurchasePurchasepurchasepurchase
n/aInteractiveinteractiveinteractive
n/aJudgejudgejudge
n/aIPFSipfsIPFSnodeManager

Chains

ChainIDAliases
Ethereum11, mainnet, main
Goerli55, goerli, görli

Generation

Install abi-to-sol which is already in devDependencies

npm install

Generate Solidity interface files

VERSION="=0.5.0"
LICENSE="Apache-2.0"
jq .incentive   abi.json | npx abi-to-sol -V $VERSION -L $LICENSE Incentive   > truebit/Incentive.sol
jq .tru         abi.json | npx abi-to-sol -V $VERSION -L $LICENSE TRU         > truebit/TRU.sol
jq .purchase    abi.json | npx abi-to-sol -V $VERSION -L $LICENSE Purchase    > truebit/Purchase.sol
jq .filesystem  abi.json | npx abi-to-sol -V $VERSION -L $LICENSE FileSystem  > truebit/FileSystem.sol
jq .interactive abi.json | npx abi-to-sol -V $VERSION -L $LICENSE Interactive > truebit/Interactive.sol
jq .judge       abi.json | npx abi-to-sol -V $VERSION -L $LICENSE Judge       > truebit/Judge.sol
jq .ipfs        abi.json | npx abi-to-sol -V $VERSION -L $LICENSE IPFS        > truebit/IPFS.sol

# some bug in abi-to-sol that does not like >=0.5.0
sed -i '' -e 's/=0.5.0/>=0.5.0/g' $(find ./truebit -type f -name '*.sol')

License

Truebit is not open source but their previous codebase was released under Apache 2.0.

The generated interface files in this repository are licensed under Apache 2.0.

0.0.2

3 years ago

0.0.1

3 years ago