diff --git a/.gitignore b/.gitignore index efb63a5e..da2372b0 100644 --- a/.gitignore +++ b/.gitignore @@ -59,4 +59,4 @@ Desktop.ini .docker_volumes/ issue.md pr.md -checks.md \ No newline at end of file +checks.md diff --git a/contracts/Cargo.toml b/contracts/Cargo.toml index 8513f885..b59b8a13 100644 --- a/contracts/Cargo.toml +++ b/contracts/Cargo.toml @@ -114,6 +114,10 @@ members = [ "vote-escrow", "wallet-claims-v2", "wordle-clone", + "treasury-streams", + "sponsor-payouts", + "raffle-escrow", + "badge-ledger", "queue-rewards", "reserve-manager", "reserve-auction", diff --git a/contracts/badge-ledger/Cargo.toml b/contracts/badge-ledger/Cargo.toml new file mode 100644 index 00000000..55615698 --- /dev/null +++ b/contracts/badge-ledger/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "badge-ledger" +version = "0.1.0" +edition = "2021" + +[dependencies] +soroban-sdk = "20.0.0" + +[features] +testutils = ["soroban-sdk/testutils"] diff --git a/contracts/badge-ledger/src/lib.rs b/contracts/badge-ledger/src/lib.rs new file mode 100644 index 00000000..93129e06 --- /dev/null +++ b/contracts/badge-ledger/src/lib.rs @@ -0,0 +1,17 @@ +#![no_std] +use soroban_sdk::{contract, contractimpl, Env}; +mod storage; +mod types; +#[cfg(test)] +mod test; + +use types::*; + +#[contract] +pub struct Contract; + +#[contractimpl] +impl Contract { + pub fn issuance_coverage_snapshot(env: Env) -> Snapshot { Snapshot {} } + pub fn revocation_window(env: Env) -> Window { Window {} } +} diff --git a/contracts/badge-ledger/src/storage.rs b/contracts/badge-ledger/src/storage.rs new file mode 100644 index 00000000..d688872f --- /dev/null +++ b/contracts/badge-ledger/src/storage.rs @@ -0,0 +1,6 @@ +use soroban_sdk::contracttype; + +#[contracttype] +pub enum DataKey { + State, +} diff --git a/contracts/badge-ledger/src/test.rs b/contracts/badge-ledger/src/test.rs new file mode 100644 index 00000000..2e903e31 --- /dev/null +++ b/contracts/badge-ledger/src/test.rs @@ -0,0 +1,19 @@ +#![cfg(test)] +use super::*; +use soroban_sdk::Env; + +#[test] +fn test_success_path() { + let env = Env::default(); + let contract_id = env.register(Contract, ()); + let client = ContractClient::new(&env, &contract_id); + // Success path logic +} + +#[test] +fn test_empty_state_path() { + let env = Env::default(); + let contract_id = env.register(Contract, ()); + let client = ContractClient::new(&env, &contract_id); + // Empty state logic +} diff --git a/contracts/badge-ledger/src/types.rs b/contracts/badge-ledger/src/types.rs new file mode 100644 index 00000000..384091ba --- /dev/null +++ b/contracts/badge-ledger/src/types.rs @@ -0,0 +1,6 @@ +use soroban_sdk::contracttype; + +#[contracttype] +pub struct Snapshot {} +#[soroban_sdk::contracttype] +pub struct Window {} diff --git a/contracts/raffle-escrow/Cargo.toml b/contracts/raffle-escrow/Cargo.toml new file mode 100644 index 00000000..d6466de8 --- /dev/null +++ b/contracts/raffle-escrow/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "raffle-escrow" +version = "0.1.0" +edition = "2021" + +[dependencies] +soroban-sdk = "20.0.0" + +[features] +testutils = ["soroban-sdk/testutils"] diff --git a/contracts/raffle-escrow/src/lib.rs b/contracts/raffle-escrow/src/lib.rs new file mode 100644 index 00000000..7a67f531 --- /dev/null +++ b/contracts/raffle-escrow/src/lib.rs @@ -0,0 +1,17 @@ +#![no_std] +use soroban_sdk::{contract, contractimpl, Env}; +mod storage; +mod types; +#[cfg(test)] +mod test; + +use types::*; + +#[contract] +pub struct Contract; + +#[contractimpl] +impl Contract { + pub fn ticket_liability_summary(env: Env) -> Summary { Summary {} } + pub fn draw_release(env: Env) -> Release { Release {} } +} diff --git a/contracts/raffle-escrow/src/storage.rs b/contracts/raffle-escrow/src/storage.rs new file mode 100644 index 00000000..d688872f --- /dev/null +++ b/contracts/raffle-escrow/src/storage.rs @@ -0,0 +1,6 @@ +use soroban_sdk::contracttype; + +#[contracttype] +pub enum DataKey { + State, +} diff --git a/contracts/raffle-escrow/src/test.rs b/contracts/raffle-escrow/src/test.rs new file mode 100644 index 00000000..2e903e31 --- /dev/null +++ b/contracts/raffle-escrow/src/test.rs @@ -0,0 +1,19 @@ +#![cfg(test)] +use super::*; +use soroban_sdk::Env; + +#[test] +fn test_success_path() { + let env = Env::default(); + let contract_id = env.register(Contract, ()); + let client = ContractClient::new(&env, &contract_id); + // Success path logic +} + +#[test] +fn test_empty_state_path() { + let env = Env::default(); + let contract_id = env.register(Contract, ()); + let client = ContractClient::new(&env, &contract_id); + // Empty state logic +} diff --git a/contracts/raffle-escrow/src/types.rs b/contracts/raffle-escrow/src/types.rs new file mode 100644 index 00000000..c0a9318f --- /dev/null +++ b/contracts/raffle-escrow/src/types.rs @@ -0,0 +1,6 @@ +use soroban_sdk::contracttype; + +#[contracttype] +pub struct Summary {} +#[soroban_sdk::contracttype] +pub struct Release {} diff --git a/contracts/sponsor-payouts/Cargo.toml b/contracts/sponsor-payouts/Cargo.toml new file mode 100644 index 00000000..cc456d3c --- /dev/null +++ b/contracts/sponsor-payouts/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "sponsor-payouts" +version = "0.1.0" +edition = "2021" + +[dependencies] +soroban-sdk = "20.0.0" + +[features] +testutils = ["soroban-sdk/testutils"] diff --git a/contracts/sponsor-payouts/src/lib.rs b/contracts/sponsor-payouts/src/lib.rs new file mode 100644 index 00000000..6b777e9e --- /dev/null +++ b/contracts/sponsor-payouts/src/lib.rs @@ -0,0 +1,17 @@ +#![no_std] +use soroban_sdk::{contract, contractimpl, Env}; +mod storage; +mod types; +#[cfg(test)] +mod test; + +use types::*; + +#[contract] +pub struct Contract; + +#[contractimpl] +impl Contract { + pub fn pending_disbursement_summary(env: Env) -> Summary { Summary {} } + pub fn release_band(env: Env) -> Band { Band {} } +} diff --git a/contracts/sponsor-payouts/src/storage.rs b/contracts/sponsor-payouts/src/storage.rs new file mode 100644 index 00000000..d688872f --- /dev/null +++ b/contracts/sponsor-payouts/src/storage.rs @@ -0,0 +1,6 @@ +use soroban_sdk::contracttype; + +#[contracttype] +pub enum DataKey { + State, +} diff --git a/contracts/sponsor-payouts/src/test.rs b/contracts/sponsor-payouts/src/test.rs new file mode 100644 index 00000000..2e903e31 --- /dev/null +++ b/contracts/sponsor-payouts/src/test.rs @@ -0,0 +1,19 @@ +#![cfg(test)] +use super::*; +use soroban_sdk::Env; + +#[test] +fn test_success_path() { + let env = Env::default(); + let contract_id = env.register(Contract, ()); + let client = ContractClient::new(&env, &contract_id); + // Success path logic +} + +#[test] +fn test_empty_state_path() { + let env = Env::default(); + let contract_id = env.register(Contract, ()); + let client = ContractClient::new(&env, &contract_id); + // Empty state logic +} diff --git a/contracts/sponsor-payouts/src/types.rs b/contracts/sponsor-payouts/src/types.rs new file mode 100644 index 00000000..e4079823 --- /dev/null +++ b/contracts/sponsor-payouts/src/types.rs @@ -0,0 +1,6 @@ +use soroban_sdk::contracttype; + +#[contracttype] +pub struct Summary {} +#[soroban_sdk::contracttype] +pub struct Band {} diff --git a/contracts/treasury-streams/Cargo.toml b/contracts/treasury-streams/Cargo.toml new file mode 100644 index 00000000..2e89b011 --- /dev/null +++ b/contracts/treasury-streams/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "treasury-streams" +version = "0.1.0" +edition = "2021" + +[dependencies] +soroban-sdk = "20.0.0" + +[features] +testutils = ["soroban-sdk/testutils"] diff --git a/contracts/treasury-streams/src/lib.rs b/contracts/treasury-streams/src/lib.rs new file mode 100644 index 00000000..cd396dd3 --- /dev/null +++ b/contracts/treasury-streams/src/lib.rs @@ -0,0 +1,17 @@ +#![no_std] +use soroban_sdk::{contract, contractimpl, Env}; +mod storage; +mod types; +#[cfg(test)] +mod test; + +use types::*; + +#[contract] +pub struct Contract; + +#[contractimpl] +impl Contract { + pub fn stream_liability_summary(env: Env) -> Summary { Summary {} } + pub fn pause_impact(env: Env) -> Impact { Impact {} } +} diff --git a/contracts/treasury-streams/src/storage.rs b/contracts/treasury-streams/src/storage.rs new file mode 100644 index 00000000..d688872f --- /dev/null +++ b/contracts/treasury-streams/src/storage.rs @@ -0,0 +1,6 @@ +use soroban_sdk::contracttype; + +#[contracttype] +pub enum DataKey { + State, +} diff --git a/contracts/treasury-streams/src/test.rs b/contracts/treasury-streams/src/test.rs new file mode 100644 index 00000000..2e903e31 --- /dev/null +++ b/contracts/treasury-streams/src/test.rs @@ -0,0 +1,19 @@ +#![cfg(test)] +use super::*; +use soroban_sdk::Env; + +#[test] +fn test_success_path() { + let env = Env::default(); + let contract_id = env.register(Contract, ()); + let client = ContractClient::new(&env, &contract_id); + // Success path logic +} + +#[test] +fn test_empty_state_path() { + let env = Env::default(); + let contract_id = env.register(Contract, ()); + let client = ContractClient::new(&env, &contract_id); + // Empty state logic +} diff --git a/contracts/treasury-streams/src/types.rs b/contracts/treasury-streams/src/types.rs new file mode 100644 index 00000000..302caa51 --- /dev/null +++ b/contracts/treasury-streams/src/types.rs @@ -0,0 +1,6 @@ +use soroban_sdk::contracttype; + +#[contracttype] +pub struct Summary {} +#[soroban_sdk::contracttype] +pub struct Impact {} diff --git a/gen.py b/gen.py new file mode 100644 index 00000000..0ae3f9bb --- /dev/null +++ b/gen.py @@ -0,0 +1,103 @@ +import os + +contracts = [ + { + "name": "treasury-streams", + "methods": "pub fn stream_liability_summary(env: Env) -> Summary { Summary {} }\n pub fn pause_impact(env: Env) -> Impact { Impact {} }" + }, + { + "name": "sponsor-payouts", + "methods": "pub fn pending_disbursement_summary(env: Env) -> Summary { Summary {} }\n pub fn release_band(env: Env) -> Band { Band {} }" + }, + { + "name": "raffle-escrow", + "methods": "pub fn ticket_liability_summary(env: Env) -> Summary { Summary {} }\n pub fn draw_release(env: Env) -> Release { Release {} }" + }, + { + "name": "badge-ledger", + "methods": "pub fn issuance_coverage_snapshot(env: Env) -> Snapshot { Snapshot {} }\n pub fn revocation_window(env: Env) -> Window { Window {} }" + } +] + +for c in contracts: + base = f"contracts/{c['name']}" + os.makedirs(f"{base}/src", exist_ok=True) + + with open(f"{base}/Cargo.toml", "w") as f: + f.write(f'''[package] +name = "{c['name']}" +version = "0.1.0" +edition = "2021" + +[dependencies] +soroban-sdk = "20.0.0" + +[features] +testutils = ["soroban-sdk/testutils"] +''') + + with open(f"{base}/src/lib.rs", "w") as f: + f.write(f'''#![no_std] +use soroban_sdk::{{contract, contractimpl, Env}}; +mod storage; +mod types; +#[cfg(test)] +mod test; + +use types::*; + +#[contract] +pub struct Contract; + +#[contractimpl] +impl Contract {{ + {c['methods']} +}} +''') + + with open(f"{base}/src/storage.rs", "w") as f: + f.write('''use soroban_sdk::contracttype; + +#[contracttype] +pub enum DataKey { + State, +} +''') + + with open(f"{base}/src/types.rs", "w") as f: + if c['name'] == 'treasury-streams': + types = "pub struct Summary {}\n#[soroban_sdk::contracttype]\npub struct Impact {}" + elif c['name'] == 'sponsor-payouts': + types = "pub struct Summary {}\n#[soroban_sdk::contracttype]\npub struct Band {}" + elif c['name'] == 'raffle-escrow': + types = "pub struct Summary {}\n#[soroban_sdk::contracttype]\npub struct Release {}" + else: + types = "pub struct Snapshot {}\n#[soroban_sdk::contracttype]\npub struct Window {}" + + f.write(f'''use soroban_sdk::contracttype; + +#[contracttype] +{types} +''') + + with open(f"{base}/src/test.rs", "w") as f: + f.write('''#![cfg(test)] +use super::*; +use soroban_sdk::Env; + +#[test] +fn test_success_path() { + let env = Env::default(); + let contract_id = env.register(Contract, ()); + let client = ContractClient::new(&env, &contract_id); + // Success path logic +} + +#[test] +fn test_empty_state_path() { + let env = Env::default(); + let contract_id = env.register(Contract, ()); + let client = ContractClient::new(&env, &contract_id); + // Empty state logic +} +''')