Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions sui/docs/operators.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Operators Contract on Sui

This document provides a step-by-step guide to deploy and use the Operators contract on the Sui network.

## Setup

### Prerequisites

1. Fork and clone the [Axelar Contract Deployments](https://github.com/axelarnetwork/axelar-contract-deployments) repository

2. Install dependencies and build the project

```bash
cd axelar-contract-deployments
npm ci && npm run build
```

3. Install [ts-node](https://www.npmjs.com/package/ts-node) globally

```bash
npm install -g ts-node
```
Comment on lines +7 to +22
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: use consistent numbering with 1. for all steps per custom instruction a4714931 to avoid manual renumbering

Suggested change
### Prerequisites
1. Fork and clone the [Axelar Contract Deployments](https://github.com/axelarnetwork/axelar-contract-deployments) repository
2. Install dependencies and build the project
```bash
cd axelar-contract-deployments
npm ci && npm run build
```
3. Install [ts-node](https://www.npmjs.com/package/ts-node) globally
```bash
npm install -g ts-node
```
### Prerequisites
1. Fork and clone the [Axelar Contract Deployments](https://github.com/axelarnetwork/axelar-contract-deployments) repository
1. Install dependencies and build the project
\`\`\`bash
cd axelar-contract-deployments
npm ci && npm run build
\`\`\`
1. Install [ts-node](https://www.npmjs.com/package/ts-node) globally
\`\`\`bash
npm install -g ts-node
\`\`\`

Context Used: Rule from dashboard - In documentation files, use consistent numbering (e.g., 1. for all steps) with tab indentation for... (source)


### Environment Configuration

1. Create an environment file and add your contract admin key information there

```bash
touch .env
```

2. Add the following environment variables to the `.env` file:
Comment on lines +26 to +32
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: use consistent numbering with 1. for all steps per custom instruction a4714931

Suggested change
1. Create an environment file and add your contract admin key information there
```bash
touch .env
```
2. Add the following environment variables to the `.env` file:
1. Create an environment file and add your contract admin key information there
\`\`\`bash
touch .env
\`\`\`
1. Add the following environment variables to the \`.env\` file:

Context Used: Rule from dashboard - In documentation files, use consistent numbering (e.g., 1. for all steps) with tab indentation for... (source)


```bash
# Setup ENV
ENV="testnet"

# Your Sui private key
PRIVATE_KEY="suiprivkey1..."

# Signature scheme
SIGNATURE_SCHEME="secp256k1"
```

### Synchronize Contracts

Synchronize the various contract deployments by executing the Sui contracts sync command:

```bash
ts-node sui/deploy-contract sync
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: deploy-contract command uses positional argument format, not subcommand. Remove "sync" subcommand

Suggested change
ts-node sui/deploy-contract sync
ts-node sui/deploy-contract sync

```

## Deployment

Deploy the Operators contract using the following command:

```bash
ts-node sui/deploy-contract Operators
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: deploy-contract command uses positional argument "deploy" before contract name

Suggested change
ts-node sui/deploy-contract Operators
ts-node sui/deploy-contract deploy Operators

```

## Usage

### Add Operators

Add operators to your contract using the following command:

```bash
ts-node sui/operators add <sui address>
```

### Store Treasury Cap

Store the `TreasuryCap` using the following command:

```bash
ts-node sui/operators storeCap --cap-id <treasury cap id>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: The actual storeCap command uses --capId not --cap-id, and works with OperatorCap not TreasuryCap

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: parameter should be --capId (camelCase) not --cap-id (kebab-case) per sui/operators.js:239

Suggested change
ts-node sui/operators storeCap --cap-id <treasury cap id>
ts-node sui/operators storeCap --capId <treasury cap id>

```

## TODO

Write a script to perform your desired operation / move calls, ensuring that the move call is executed within the same transaction between `loanCap` and `restoreCap`.
Comment on lines +79 to +81
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: TODO section violates custom instruction ee7dd967. Remove TODO comments and create a ticket instead

Suggested change
## TODO
Write a script to perform your desired operation / move calls, ensuring that the move call is executed within the same transaction between `loanCap` and `restoreCap`.

Context Used: Rule from dashboard - Remove TODO comments from code and create tickets for the work instead of leaving TODOs in the codeb... (source)

Comment on lines +61 to +81
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: documentation is incomplete. Missing operations: collectGas, refund, removeCap, and remove (operator). Check sui/operators.js:205-264 for all available commands