Skip to content

Filemarket-xyz/hack-fevm

Repository files navigation

Mark3d Hack-FEVM submission

FVM developers important notes

For better developer experience with FVM such tips might be useful:

  1. Working version of FVM exists at commit 1a06485a8c0463ea6a7a0604d0ad421bdcc2c953 in experimental/fvm-m2 branch of lotus repository
  2. While using local network with default parameters there is huge delay between status Active and deal creation. This can be solved with proper miner config - reference config. However, this config should be used after deal creation, because if it is used from start, deal creation will fail(
  3. To reduce deal publish time lotus command lotus-miner storage-deals pending-publish --publish-now can be used
  4. Great entrypoint for native FVM actors which can be used to kickstart development

Native actor examples

Actor code is placed in simple-actor directory

To build it nightly mode is required:

rustup override set nightly

Build:

cargo build

File to deploy will be located at path - simple-actor/target/debug/wbuild/simple_actor/simple_actor.compact.wasm

Deploy can be done with following instructions:

lotus chain install-actor ${path}
lotus chain create-actor ${cid obtained from previous step} ${constructor params}

Constructor or invoke params are base64 encoded raw bytes(fvm encoding). They can obtained with serialization helper package.

Interaction backend

There is a backend for showing FVM abilities to work with files.

This backend calls lotus binary under the hood and implements two methods:

  1. Create actor (with installed actor)
  2. Invoke actor matches count method

Deploy contracts

Requirements

First, you need to place your private key in file sol-contracts/.wallaby-key in hex format without 0x prefix.

Factory deploy functions are now returning same address for every contract, so contract addresses should be obtained from explorer. It can be done with following instructions:

  1. Go to deployer account/address page
  2. Open deploy transaction page
  3. Tap "Click to see more"
  4. Scroll down to "Return" section
  5. Decode eth address from base64 to hex (for example, with this tool - https://base64.guru/converter/decode/hex)

Steps

All steps commands must be executed in sol-contracts directory

  1. Deploy collection instance for future cloning
yarn hardhat --network wallaby run scripts/deploy-collection.ts
  1. Deploy fraud decider
yarn hardhat --network wallaby run scripts/deploy-fraud-decider.ts
  1. Deploy access token
HARDHAT_NETWORK=wallaby ts-node scripts/deploy-access-token.ts --collection {address from first step} --decider {address from second step}
  1. Deploy exchange
yarn hardhat --network wallaby run scripts/deploy-exchange.ts
  1. Create(clone) collection
HARDHAT_NETWORK=wallaby ts-node scripts/create-collection.ts --instance {address from third step}

Example instances in Wallaby

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •