Skip to content

ashishnair-zil/multisig-wallet-generator

 
 

Repository files navigation

Zilliqa Multi-Sig Wallet Generator

Generates a multi-sig wallet contract for your use case

Prerequisites

Installation

npm i

Installs the dependencies.

Usage

Step 1. Annotate your transitions: (* @multi-sig *)

e.g.

foo.scilla

(* @multi-sig *)
(* Pauses the contract. Use this when things are going wrong ('circuit breaker'). *)
transition Pause()
  RequireNotPaused;
  RequireContractOwner;

  is_paused := true;
  e = {
    _eventname: "Pause";
    is_paused: true
  };
  event e
end

Step 2. Put your contracts in input/

e.g.

input/foo.scilla
input/bar.scilla
input/baz.scilla

Step 3. Run npm run gen

Generates your multi-sig wallet contract: output/msw.scilla by default.

During the contract generation, it makes API calls to https://scilla-server.zilliqa.com/contract/check.

To avoid this behavior, run npm run gen:docker. It uses Isolated Server container instead.

Environment Variables

Name Description Default Value
INPUT_DIR A folder for the input contract with (* @multi-sig *) annotations. input/
OUTPUT_DIR A folder for the generated multi-sig wallet contract. output/
PORT The port of Isolated Server container. 5555
CONTAINER The name of Isolated Server container.
CHECKER_URL The URL of Scilla Checker API.

Contract Testing

npm test

Runs contract tests using Isolated Server container, Jest, and Scilla JSON Utils

Constructing the parameters of SubmitCustomTransaction

MultiSigTransition ADT

type MultiSigTransition =
  | Allow of (List (ByStr20))
  | Disallow of (List (ByStr20))

Example parameters

[
  {
    "type": "ByStr20",
    "value": "0x0c4769cddb5e54683126c33b116c5ff9765c2ac3",
    "vname": "contract_address"
  },
  {
    "type": "0xf6241e9d6b033847e814e6cc7022fa1360fe4fe3.MultiSigTransition",
    "value": {
      "argtypes": [],
      "arguments": [
        [
          "0x268fb34ad21aa21b02ff9ad77f29d2f08dabeb93",
          "0xa3755a10dba7bbe77770c620041b442c624be0a1"
        ]
      ],
      "constructor": "0xf6241e9d6b033847e814e6cc7022fa1360fe4fe3.Allow"
    },
    "vname": "transaction"
  }
]

Consider using Scilla JSON Utils to construct the above JSON values.

License

This project is open source software licensed as GPL-3.0.

About

Zilliqa Multisig Wallet Generator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 96.1%
  • Shell 3.9%