Skip to content

Commit

Permalink
Merge branch 'develop' into feature/add-nullification-to-receipts
Browse files Browse the repository at this point in the history
  • Loading branch information
dhedey committed Oct 28, 2024
2 parents aeb648f + b6a5167 commit bcd2abc
Show file tree
Hide file tree
Showing 45 changed files with 1,733 additions and 787 deletions.
36 changes: 36 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,22 @@ Release workflow:
```
more details: [sccache - Shared Compilation Cache](https://github.com/mozilla/sccache)
8. (Optional) Enable LFS to pull assets under `assets-lfs`
1. Install `git-lfs`:
- MacOS
```
brew install git-lfs
```
- Ubuntu
```
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get install git-lfs
```
2. Pull
```
git lfs install
git lfs pull
```
Bash scripts that might be of help:
* `format.sh` - Formats the entire repo
Expand All @@ -96,6 +112,26 @@ Bash scripts that might be of help:
* `test_extra.sh` - Runs the additional tests
* `assets/update-assets.sh` - Updates `Account`/`Faucet` scrypto packages (needed when your change would affect the output WASM)
## Project Layout
- `radix-blueprint-schema-init`: Blueprint schema initialization structures, used by Radix Package Definition (RPD).
- `radix-clis`: Various CLI tools, like `resim`, `scrypto`, `rtmc` and `rtmd`.
- `radix-common-derive`: Macros for defining `Decimal` and `PreciseDecimal`.
- `radix-common`: Common libraries used by Radix Engine and Scrypto.
- `radix-engine`: The Radix Engine implementation.
- `radix-native-sdk`: Library to assist native blueprint development.
- `radix-sbor-derives`: Macros for encoding and decoding Scrypto SBOR and Manifest SBOR data.
- `radix-substate-store-impls`: Various substate store implementations.
- `radix-substate-store-interface`: The interface of any substate store.
- `radix-substate-store-queries`: Interprets data in substate data by injecting high-level knowledge.
- `radix-transaction-scenarios`: Defines various transaction scenarios, for testing.
- `radix-transactions`: Radix transaction manifest compiler, transaction models, signing and validating logic.
- `sbor-derive`: Macros for encoding and decoding SBOR data.
- `sbor`: A generic binary data format, upon which Scrypto SBOR and Manifest SBOR are built.
- `scrypto-derive`: Macros for defining blueprints.
- `scrypto-test`: Library for testing Scrypto blueprints.
- `scrypto`: Scrypto language abstraction.
## Branching strategy
### Branches
Expand Down
199 changes: 10 additions & 189 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,195 +6,16 @@ Language for building DeFi apps on Radix.

Documentation: https://docs.radixdlt.com/docs/scrypto-1


## Installation

1. Install Rust - we recommend to use Rust 1.81.0
- Install Rust (if Rust is installed you can skip this step)
- Windows:
- Download and install [`rustup-init.exe`](https://win.rustup.rs/x86_64)
- Install "Desktop development with C++" with [Build Tools for Visual Studio 2019](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16)
- Install [LLVM 13.0.1](https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.1/LLVM-13.0.1-win64.exe) (make sure you tick the option that adds LLVM to the system PATH)
- Enable git long path support:
```bash
git config --system core.longpaths true
```
- macOS:
- Make sure you have the `xcode` command line tools: `xcode-select --install`.
- Install cmake: `brew install cmake llvm`<br>
Add LLVM to the system path by adding below line to the:
- `~/.profile` if `bash` is the default shell
- `~/.zshrc` if `zsh` is the default shell
- respective config file in case of other shell
```
PATH="$(brew --prefix llvm)/bin:$PATH"
```

You can check, which shell is the default one by inspecting `$SHELL` variable:
```bash
echo $SHELL
```

- Install the Rust compiler:
```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```
- Linux:
- Make sure a C++ compiler, LLVM, cmake and clang is installed:
```bash
sudo apt install build-essential llvm cmake clang
```
- Install the Rust compiler:
```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```
- Set Rust version
```bash
rustup update
rustup default 1.81.0
```

2. Enable `cargo` in the current shell:
- Windows:
- Start a new PowerShell
- Linux and macOS:
```bash
source $HOME/.cargo/env
```
3. Add WebAssembly target
```bash
rustup target add wasm32-unknown-unknown
```
4. Install Radix CLIs
```bash
cargo install radix-clis
```

## Getting Started

If you want a quick walkthrough of how to deploy and run some code, please see the [Run Your First Project](https://docs-babylon.radixdlt.com/main/getting-started-developers/first-component/run-first-project.html) tutorial. If you prefer to soldier through on your own, keep reading below.

### Writing Scrypto Code

1. Start by creating a new package:

```bash
scrypto new-package <package_name>
cd <package_name>
```

2. Check out the files under your current directory:

- Source code is within `src/lib.rs`;
- Test code is within `tests/lib.rs`.

3. Build your package:

```bash
scrypto build
```

4. Run tests:

```bash
scrypto test
```

### Playing with Radix Engine

| Action | Command |
| ---------------------------------- | -------------------------------------------------------------------------- |
| Create an account | `resim new-account` |
| Change the default account | `resim set-default-account <account_address> <account_public_key>` |
| Create a token with fixed supply | `resim new-token-fixed <amount>` |
| Create a token with mutable supply | `resim new-token-mutable <minter_resource_address>` |
| Create a badge with fixed supply | `resim new-badge-fixed <amount>` |
| Create a badge with mutable supply | `resim new-badge-mutable <minter_resource_address>` |
| Mint resource | `resim mint <amount> <resource_address> <minter_resource_address>` |
| Transfer resource | `resim transfer <amount> <resource_address> <recipient_component_address>` |
| Publish a package | `resim publish <path_to_package_dir>` |
| Call a function | `resim call-function <package_address> <blueprint_name> <function> <args>` |
| Call a method | `resim call-method <component_address> <method> <args>` |
| Export the definition of a package | `resim export-package-definition <package_address> <output>` |
| Show info about an entity | `resim show <id>` |
| Show info about default account | `resim show` |
| List all entities | `resim show-ledger ` |
| Reset ledger state | `resim reset` |

**Note:** The commands use the default account as transaction sender.

## Compile blueprints with dockerized `radix-clis`

Follow this guide to build reproducible WASM and RDP files for your Scrypto blueprints.

### Using local docker image

The Dockerfile in the root of the repo should be work to build a docker image which will contain all the dependencies needed to be able build a blueprint using scrypto.

Build the docker image like. From the repo root

```bash
docker build -t radixdlt/radix-clis .
```

Then build your package by just running

```bash
docker run -v <path-to-your-scrypto-crate>:/src radixdlt/radix-clis
```

### Using published docker image

If you would like to avoid building the docker image, you can skip the build step and do the second step directly, docker will automatically download the docker image we publish

Build your blueprints directly with

```bash
docker run -v <path-to-your-scrypto-crate>:/src radixdlt/radix-clis
```

## Project Layout

- `radix-blueprint-schema-init`: Blueprint schema initialization structures, used by Radix Package Definition (RPD).
- `radix-clis`: Various CLI tools, like `resim`, `scrypto`, `rtmc` and `rtmd`.
- `radix-common-derive`: Macros for defining `Decimal` and `PreciseDecimal`.
- `radix-common`: Common libraries used by Radix Engine and Scrypto.
- `radix-engine`: The Radix Engine implementation.
- `radix-native-sdk`: Library to assist native blueprint development.
- `radix-sbor-derives`: Macros for encoding and decoding Scrypto SBOR and Manifest SBOR data.
- `radix-substate-store-impls`: Various substate store implementations.
- `radix-substate-store-interface`: The interface of any substate store.
- `radix-substate-store-queries`: Interprets data in substate data by injecting high-level knowledge.
- `radix-transaction-scenarios`: Defines various transaction scenarios, for testing.
- `radix-transactions`: Radix transaction manifest compiler, transaction models, signing and validating logic.
- `sbor-derive`: Macros for encoding and decoding SBOR data.
- `sbor`: A generic binary data format, upon which Scrypto SBOR and Manifest SBOR are built.
- `scrypto-derive`: Macros for defining blueprints.
- `scrypto-test`: Library for testing Scrypto blueprints.
- `scrypto`: Scrypto language abstraction.

## LFS

Assets under `assets-lfs` are stored in Git LFS.

To fetch files from LFS, install `git-lfs` first:

- MacOS
```
brew install git-lfs
```
- Ubuntu
```
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get install git-lfs
```

and then:

```
git lfs install
git lfs pull
```
## Scrypto Development

- Setup
- [Install rust and the scrypto toolchain](https://docs.radixdlt.com/docs/getting-rust-scrypto)
- [Choose an IDE and install the extensions](https://docs.radixdlt.com/docs/choosing-an-ide)
- Learning
- The [learning step-by-step](https://docs.radixdlt.com/docs/learning-step-by-step) guide is our recommended path to start your journey learning scrypto.
- CLI references
- [`scrypto`](https://docs.radixdlt.com/docs/scrypto-cli-tool)
- [`resim`](https://docs.radixdlt.com/docs/resim-radix-engine-simulator)

## Contribute

Expand Down
3 changes: 0 additions & 3 deletions radix-common/src/constants/transaction_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,3 @@ pub const USD_PRICE_IN_XRD: &str = "16.666666666666666666";

/// The maximum that a package or component owner is allowed to set their method royalty to. 10 USD
pub const MAX_PER_FUNCTION_ROYALTY_IN_XRD: &str = "166.666666666666666666";

/// The maximum number of "live" buffers maintained by Scrypto runtime.
pub const MAX_NUMBER_OF_BUFFERS: usize = 32;
Loading

0 comments on commit bcd2abc

Please sign in to comment.