Skip to content

Commit

Permalink
feat: add support for paying with ERC20 or AssetId for services (#845)
Browse files Browse the repository at this point in the history
* chore: update flakes

* feat: add payment assets

* feat: ERC20 and AssetId support

* chore: update onRequestHook

* feat: add Mock ERC20 for testing

* feat: test using other assets

* feat: using ERC20 and Assets works on Both EVM and Substrate

* feat: add custom error messages for the precompile
  • Loading branch information
shekohex authored Dec 6, 2024
1 parent 82c865d commit 1edc6b7
Show file tree
Hide file tree
Showing 20 changed files with 1,126 additions and 201 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = tab
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[.github/workflows/*.{yaml,yml}]
indent_size = 2
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 15 additions & 16 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
# Rust
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
nixpkgs.follows = "nixpkgs";
};
inputs = { nixpkgs.follows = "nixpkgs"; };
};
# EVM dev tools
foundry = {
Expand All @@ -24,13 +22,10 @@
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) foundry.overlay ];
pkgs = import nixpkgs {
inherit system overlays;
};
pkgs = import nixpkgs { inherit system overlays; };
lib = pkgs.lib;
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
in
{
in {
devShells.default = pkgs.mkShell {
name = "tangle";
nativeBuildInputs = [
Expand All @@ -44,8 +39,10 @@
pkgs.rustPlatform.bindgenHook
# Mold Linker for faster builds (only on Linux)
(lib.optionals pkgs.stdenv.isLinux pkgs.mold)
(lib.optionals pkgs.stdenv.isDarwin pkgs.darwin.apple_sdk.frameworks.Security)
(lib.optionals pkgs.stdenv.isDarwin pkgs.darwin.apple_sdk.frameworks.SystemConfiguration)
(lib.optionals pkgs.stdenv.isDarwin
pkgs.darwin.apple_sdk.frameworks.Security)
(lib.optionals pkgs.stdenv.isDarwin
pkgs.darwin.apple_sdk.frameworks.SystemConfiguration)
];
buildInputs = [
# Nodejs for test suite
Expand All @@ -56,15 +53,17 @@
toolchain
pkgs.foundry-bin
];
packages = [
pkgs.taplo
pkgs.cargo-nextest
pkgs.cargo-tarpaulin
];
packages =
[ pkgs.taplo pkgs.harper pkgs.cargo-nextest pkgs.cargo-tarpaulin ];
# Environment variables
RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
# Needed for running DKG Node.
LD_LIBRARY_PATH = lib.makeLibraryPath [ pkgs.gmp pkgs.openssl pkgs.libclang pkgs.stdenv.cc.cc ];
LD_LIBRARY_PATH = lib.makeLibraryPath [
pkgs.gmp
pkgs.openssl
pkgs.libclang
pkgs.stdenv.cc.cc
];
};
});
}
2 changes: 2 additions & 0 deletions pallets/services/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ hex = { workspace = true }
num_enum = { workspace = true }
hex-literal = { workspace = true }
libsecp256k1 = { workspace = true }
pallet-assets = { workspace = true }
pallet-balances = { workspace = true }
pallet-timestamp = { workspace = true }
serde = { workspace = true }
Expand Down Expand Up @@ -103,6 +104,7 @@ std = [
"pallet-ethereum/std",
"pallet-evm/std",
"pallet-evm-chain-id/std",
"pallet-assets/std",

"pallet-evm-precompile-modexp/std",
"pallet-evm-precompile-sha3fips/std",
Expand Down
Loading

0 comments on commit 1edc6b7

Please sign in to comment.