diff --git a/README.md b/README.md index f69882f8..06626bef 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,46 @@ # Axelar CGP Sui -An implementation of the Axelar gateway for the Sui blockchain. +An implementation of the Axelar cross-chain contracts in Move for the Sui blockchain. ## Installation -Install Sui and run a local Sui network: https://docs.sui.io/build/sui-local-network. -The copy `.env.exaple` to `.env` and add a valid private key for sui. If you want to deploy to testnet you shoukd have its address be funded. +Install Sui as shown [here](https://docs.sui.io/guides/developer/getting-started/sui-install) -## Deployment +Install node.js 18+ + +Build all Move packages + +```sh +npm ci -To deploy to testnet run `node scripts/publish-package axelar testnet` +npm run build +``` ## Testing -run `npm run test` to run move tests on all the move packages. +Run tests for all Move packages + +```sh +npm run test +``` + +### Development + +If using VS Code, install `move-analyzer` via `cargo`, + +```sh +cargo install --git https://github.com/move-language/move move-analyzer --features "address20" +``` + +Next, install the `move-analyzer` extension in VS Code. + +## Deployment + +Copy `.env.example` to `.env` and add a valid private key for sui. If you want to deploy to testnet the corresponding address should be funded. + +Run a [local](https://docs.sui.io/build/sui-local-network) Sui network for local testing, or use testnet. + +To deploy to testnet run `node scripts/publish-package axelar testnet` ## Scripts @@ -23,10 +50,37 @@ First run `node scripts/publish-package` and then any of `node scripts/`. +- The module that defined the shared object type has to implement a function called `get_call_info`, which has no types, and takes the incoming call `payload` as the first argument, followed by a number of shared objects whose ids are specified by the `get_call_info_object_ids` mentioned above. This function has to return a `std::ascii::String` which is the JSON encoded call data to fullfill the contract call. +- This calldata has the following 3 fields: + - `target`: the target method, in the form of `packag_iId::module_name::function_name`. + - `arguments`: an array of arguments that can be: + - `contractCall`: the `ApprovedCall` object (see below). + - `pure:${info}`: a pure argument specified by `$info`. + - `obj:${objectId}`: a shared object with the specified `id`. + - `typeArguments`: a list of types to be passed to the function called + ## ITS spec The ITS on sui is supposed to be able to receive 3 messages: -- Register Coin: The payload will be abi encoded data that looks like this: + +- Register Coin: The payload will be abi encoded data that looks like this: `4`: `uint256`, fixed, `tokenId`: `bytes32`, fixed, `name`: `string`, variable, @@ -62,6 +116,7 @@ ITS also needs to be able to send 2 calls, the call to receive coin and the call This module and the object it creates (`CoinManagement`) will tell if a coin is registered as a mint/burn or lock unlock token. To create a `CoinManagement` object one has to call + - `mint_burn`, passing in a `TreasuryCap`. - `lock_unlock`. - `lock_unlock_funded` passing in some initial `Coin` to lock.