Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
dnnaji authored Aug 28, 2023
2 parents e66947e + 7adb52c commit ea1736e
Show file tree
Hide file tree
Showing 161 changed files with 8,136 additions and 3,750 deletions.
68 changes: 16 additions & 52 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,22 @@
name: Builds and tests
name: CI

on:
push:
branches:
- master
branches:
- main
pull_request:
branches: [ main ]

permissions:
checks: write
pull-requests: write

jobs:
wasm_test:
name: Wasm tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
default: true
toolchain: nightly
- name: Install erdpy and arwentools
run : |
source .github/workflows/env
pip3 install erdpy
mkdir $HOME/elrondsdk
erdpy config set dependencies.arwentools.tag v1.3.3
erdpy deps install arwentools
- name: Build the wasm contracts
run: |
source .github/workflows/env
./build-wasm.sh
- name: Run Arwen tests
run: |
source .github/workflows/env
cargo test --features elrond-wasm-debug/arwen-tests
rust_test:
name: Rust tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
default: true
toolchain: nightly
- name: Run rust tests
run: cargo test
clippy_check:
name: Clippy linter check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: clippy
default: true
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args:
contracts:
name: Contracts
uses: multiversx/mx-sc-actions/.github/workflows/[email protected]
with:
rust-toolchain: nightly-2023-04-24
vmtools-version: v1.4.60
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export PATH=$HOME/.local/bin:$HOME/elrondsdk/arwentools:$PATH
export PATH=$HOME/.local/bin:$HOME/elrondsdk/vmtools:$PATH
16 changes: 16 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: On release, build contracts

on:
release:
types: [published]

permissions:
contents: write

jobs:
build:
uses: multiversx/mx-sc-actions/.github/workflows/[email protected]
with:
image_tag: v4.1.4
attach_to_existing_release: true
skip_preliminary_checks: true
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

!**/wasm*/Cargo.lock
# These are backup files generated by rustfmt
**/*.rs.bk

# Local testnet files
**/deploy-testnet.interaction.json
**/erdpy.data-storage.json
**/mxpy.data-storage.json
**/testnet/
**/deploy-child-sc-spam.json
12 changes: 0 additions & 12 deletions .vscode/launch.json

This file was deleted.

21 changes: 0 additions & 21 deletions .vscode/settings.json

This file was deleted.

14 changes: 0 additions & 14 deletions .vscode/tasks.json

This file was deleted.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[workspace]
members = [
"egld-esdt-swap",
"egld-esdt-swap/abi",
"esdt-safe",
"esdt-safe/abi",
"esdt-safe/meta",
"multi-transfer-esdt",
"multi-transfer-esdt/abi",
"multi-transfer-esdt/meta",
"multisig",
"multisig/abi"
"multisig/meta",
"bridged-tokens-wrapper",
"bridged-tokens-wrapper/meta"
]
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ As said above, we're going to use ESDT to implement wrapped tokens, but how is t

One important thing to note is you can never unwrap your WrappedETH while on the MultiversX blockchain, as that is not a native MultiversX token. You will only be able to unwrap them by transferring them to one of your Ethereum accounts and then unwrapping them there.


## MultiversX -> Ethereum transaction

To be able to send eGLD to an Ethereum account, we first have to wrap the tokens through the `EgldEsdtSwap` contract.
To be able to send EGLD to an Ethereum account, we first have to wrap the tokens through the `EgldEsdtSwap` contract.

Then you can create a transaction by making a smart contract call to the `EsdtSafe` SC with the tokens you want to transfer and the receiver's address. The tokens will be locked in the contract until the transaction is processed. If the transaction is successful, the tokens on the MultiversX side will be burned. If the transaction fails for whatever reason, you will get your tokens back.

Expand All @@ -34,3 +35,4 @@ To be able to transfer your tokens back, you will likely have to use an ERC20 co
## Conclusion

And that sums up the MultiversX-Ethereum bridge. It's open source, so if you're interested in the details, you can always check out the implementation. In the future, it will likely be implemented in xPortal, so it will be very straightforward to move your tokens around :)

7 changes: 7 additions & 0 deletions bridged-tokens-wrapper/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Generated by Cargo
# will have compiled files and executables
/target/
*/target/

# The mxpy output
output*
19 changes: 19 additions & 0 deletions bridged-tokens-wrapper/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "bridged-tokens-wrapper"
version = "0.0.0"
authors = ["Alin Cruceat <[email protected]>"]
edition = "2018"
publish = false

[lib]
path = "src/lib.rs"
[dependencies.transaction]
path = "../common/transaction"

[dependencies.multiversx-sc]
version = "0.41.3"

[dependencies.multiversx-sc-modules]
version = "0.41.3"
[dev-dependencies.multiversx-sc-scenario]
version = "0.41.3"
131 changes: 131 additions & 0 deletions bridged-tokens-wrapper/mandos/add_wrapped_token.scen.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
{
"name": "add wrapped token",
"gasSchedule": "v4",
"steps": [
{
"step": "setState",
"accounts": {
"address:owner": {
"nonce": "0",
"balance": "0",
"storage": {}
},
"address:user": {
"nonce": "0",
"esdt": {
"str:USDC-aaaaaa": {
"balance": "500000000000000"
},
"str:USDC-bbbbbb": {
"balance": "500000000000000"
},
"str:USDC-cccccc": {
"balance": "500000000000000"
},
"str:WUSDC-abcdef": {
"balance": "500"
}
},
"storage": {}
},
"sc:bridged_tokens_wrapper": {
"nonce": "0",
"esdt": {
"str:WUSDC-abcdef": {
"balance": "1",
"roles": [
"ESDTRoleLocalMint",
"ESDTRoleLocalBurn"
]
},
"str:WUSDC-uvwxyz": {
"balance": "1",
"roles": [
"ESDTRoleLocalMint",
"ESDTRoleLocalBurn"
]
}
},
"code": "file:../output/bridged-tokens-wrapper.wasm",
"owner": "address:owner"
}
}
},
{
"step": "scCall",
"txId": "add-wrapped-token",
"tx": {
"from": "address:owner",
"to": "sc:bridged_tokens_wrapper",
"function": "addWrappedToken",
"arguments": [
"str:WUSDC-abcdef",
"u32:6"
],
"gasLimit": "5,000,000",
"gasPrice": "0"
},
"expect": {
"status": "0",
"message": "",
"gas": "*",
"refund": "*"
}
},
{
"step": "checkState",
"accounts": {
"address:owner": {
"nonce": "1",
"balance": "0",
"storage": {}
},
"address:user": {
"nonce": "0",
"esdt": {
"str:USDC-aaaaaa": {
"balance": "500000000000000"
},
"str:USDC-bbbbbb": {
"balance": "500000000000000"
},
"str:USDC-cccccc": {
"balance": "500000000000000"
},
"str:WUSDC-abcdef": {
"balance": "500"
}
},
"storage": {}
},
"sc:bridged_tokens_wrapper": {
"nonce": "0",
"esdt": {
"str:WUSDC-abcdef": {
"balance": "1",
"roles": [
"ESDTRoleLocalMint",
"ESDTRoleLocalBurn"
]
},
"str:WUSDC-uvwxyz": {
"balance": "1",
"roles": [
"ESDTRoleLocalMint",
"ESDTRoleLocalBurn"
]
}
},
"storage": {
"str:universalBridgedTokenIds.len": "1",
"str:universalBridgedTokenIds.index|nested:str:WUSDC-abcdef": "1",
"str:universalBridgedTokenIds.item|u32:1": "str:WUSDC-abcdef",
"str:token_decimals_num|nested:str:WUSDC-abcdef": "6"
},
"code": "file:../output/bridged-tokens-wrapper.wasm",
"owner": "address:owner"
}
}
}
]
}
Loading

0 comments on commit ea1736e

Please sign in to comment.