Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(gear-programs): bridging-payment for vara supply #130

Merged
merged 29 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a2c80bf
vft-treasury implementation
playX18 Sep 16, 2024
b07f90d
add eth<->vara mappings
playX18 Sep 17, 2024
c0e96f9
refactor treasury
playX18 Sep 18, 2024
e4418ae
unmapping vara to eth addresses
playX18 Sep 18, 2024
236e9b6
resolve suggestions: more tests, docs, reactor functions
playX18 Sep 20, 2024
3294529
resolve comments
playX18 Sep 20, 2024
69f4817
remove unused errors; remove bridge builtin address usage
playX18 Sep 23, 2024
a0f3a56
gclient test for treasury
playX18 Sep 23, 2024
5f02134
add vara to eth map to treasury in gclient test
playX18 Sep 23, 2024
17d4349
bridging-payment-vara-supply impl
ByteNacked Sep 15, 2024
e5f7ef2
Update impl
ByteNacked Sep 22, 2024
3befc2b
Update tests
ByteNacked Sep 23, 2024
2f7fa7d
Update refund logic
ByteNacked Sep 23, 2024
da86292
Fix claim fee
ByteNacked Sep 23, 2024
5910837
working gclient test for treasury
playX18 Sep 24, 2024
db5116f
remove setup_for_test macro
playX18 Sep 24, 2024
451f7e8
remove unused import
playX18 Sep 24, 2024
7e689c4
fix clippy lints
playX18 Sep 24, 2024
4ca0615
include gstd errors in vft treasury Error type
playX18 Sep 24, 2024
874be57
remove impl_api macro, use functions instead
playX18 Sep 24, 2024
63cbd9c
clippy
playX18 Sep 24, 2024
1a0f2ca
Review fixes
ByteNacked Sep 24, 2024
1f70550
Review fixes 2
ByteNacked Sep 24, 2024
b82dd13
Review fixes 3
ByteNacked Sep 24, 2024
501580c
Merge remote-tracking branch 'origin/ap/vft-treasury' into rmasl-cont…
ByteNacked Sep 24, 2024
0cb9fea
Merge remote-tracking branch 'origin/main' into rmasl-contract-bridge…
ByteNacked Sep 24, 2024
cf11962
Review fixes 4
ByteNacked Sep 24, 2024
60003a6
Merge remote-tracking branch 'origin/main' into rmasl-contract-bridge…
ByteNacked Sep 24, 2024
a8f460e
Fix build
ByteNacked Sep 24, 2024
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
32 changes: 32 additions & 0 deletions Cargo.lock

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

8 changes: 7 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ members = [
"ethereum-common",
"gear-programs/bridging-payment",
"gear-programs/bridging-payment/src/wasm",
"gear-programs/bridging-payment-vara-supply",
"gear-programs/bridging-payment-vara-supply/src/wasm",
"gear-programs/vft-gateway",
"gear-programs/vft-gateway/src/wasm",
"gear-programs/vft-treasury",
Expand Down Expand Up @@ -37,6 +39,8 @@ ethereum-common = { path = "ethereum-common", default-features = false }

bridging_payment = { path = "gear-programs/bridging-payment" }
bridging_payment_wasm = { path = "gear-programs/bridging_payment/src/wasm" }
bridging_payment_vara_supply = { path = "gear-programs/bridging-payment-vara-supply" }
bridging_payment_vara_supply_wasm = { path = "gear-programs/bridging-payment-vara-supply/src/wasm" }
vft-gateway-app = { path = "gear-programs/vft-gateway" }
vft_gateway_wasm = { path = "gear-programs/vft-gateway/src/wasm" }
vft-treasury-app = { path = "gear-programs/vft-treasury" }
Expand All @@ -46,6 +50,9 @@ checkpoint_light_client-io = { path = "gear-programs/checkpoint-light-client/io"
utils-prometheus = { path = "utils-prometheus" }
checkpoint_light_client = { path = "gear-programs/checkpoint-light-client", default-features = false }

# Contracts' deps
extended_vft_wasm = { git = "https://github.com/gear-foundation/standards/", branch = "gstd-pinned-v1.5.0"}

plonky2 = { git = "https://github.com/gear-tech/plonky2.git", rev = "4a620f4d79efe9233d0e7682df5a2fc625b5420e" }
plonky2_field = { git = "https://github.com/gear-tech/plonky2.git", rev = "4a620f4d79efe9233d0e7682df5a2fc625b5420e" }
plonky2_util = { git = "https://github.com/gear-tech/plonky2.git", rev = "4a620f4d79efe9233d0e7682df5a2fc625b5420e" }
Expand Down Expand Up @@ -78,7 +85,6 @@ ethereum-types = { version = "0.14.1", default-features = false, features = [
"codec",
"rlp",
] }
extended_vft_wasm = { git = "https://github.com/gear-foundation/standards/", branch = "gstd-pinned-v1.5.0" }
ff = { version = "0.13.0", features = ["derive"] }
futures = { version = "0.3.30", features = ["executor"] }
futures-util = "0.3.28"
Expand Down
15 changes: 15 additions & 0 deletions gear-programs/bridging-payment-vara-supply/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "bridging_payment_vara_supply"
version.workspace = true
edition.workspace = true

[dependencies]
sails-rs.workspace = true
parity-scale-codec.workspace = true
scale-info.workspace = true
gstd.workspace = true

[build-dependencies]
git-download.workspace = true
sails-client-gen.workspace = true

14 changes: 14 additions & 0 deletions gear-programs/bridging-payment-vara-supply/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use sails_client_gen::ClientGenerator;
use std::{env, path::PathBuf};

fn main() {
let out_dir_path = PathBuf::from(env::var("OUT_DIR").unwrap());

let idl_file_path = PathBuf::from("../vft-treasury/src/wasm/vft-treasury.idl");

let client_rs_file_path = out_dir_path.join("vft-treasury.rs");

ClientGenerator::from_idl_path(&idl_file_path)
.generate_to(client_rs_file_path)
.unwrap();
}
19 changes: 19 additions & 0 deletions gear-programs/bridging-payment-vara-supply/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#![no_std]

use sails_rs::{gstd::GStdExecContext, program};
pub mod services;
use services::{BridgingPayment, InitConfig};
#[derive(Default)]
pub struct Program;

#[program]
impl Program {
pub fn new(init_config: InitConfig) -> Self {
BridgingPayment::<GStdExecContext>::seed(init_config);
Self
}

pub fn bridging_payment(&self) -> BridgingPayment<GStdExecContext> {
BridgingPayment::new(GStdExecContext::new())
}
}
22 changes: 22 additions & 0 deletions gear-programs/bridging-payment-vara-supply/src/services/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
use sails_rs::prelude::*;

use super::vft_treasury::Error as VftTreasuryError;

#[derive(Debug, Encode, Decode, TypeInfo)]
pub enum Error {
SendFailure,
ReplyFailure,
RequestToTreasuryDecode,
ReplyTimeout,
ReplyHook,
TreasuryMessageProcessingFailed,
InvalidMessageStatus,
MessageNotFound,
Treasury(VftTreasuryError),
}

impl From<VftTreasuryError> for Error {
fn from(e: VftTreasuryError) -> Self {
Self::Treasury(e)
}
}
Loading
Loading