From 30dd7a5e9e07e7746d1c19310007814a7f42d082 Mon Sep 17 00:00:00 2001 From: Jake Hartnell Date: Fri, 17 Nov 2023 14:36:50 +0100 Subject: [PATCH] Clean up, add notes for future work --- contracts/external/cw-abc/src/abc.rs | 16 +--------------- contracts/external/cw-abc/src/msg.rs | 9 +++++++++ .../cw-abc/src/test_tube/integration_tests.rs | 3 +-- .../external/cw-abc/src/test_tube/test_env.rs | 1 - contracts/external/cw-abc/src/testing.rs | 1 - 5 files changed, 11 insertions(+), 19 deletions(-) diff --git a/contracts/external/cw-abc/src/abc.rs b/contracts/external/cw-abc/src/abc.rs index aa5a3c713..8b6263784 100644 --- a/contracts/external/cw-abc/src/abc.rs +++ b/contracts/external/cw-abc/src/abc.rs @@ -40,10 +40,6 @@ pub struct HatchConfig { pub contribution_limits: MinMax, /// The initial raise range (min, max) in the reserve token pub initial_raise: MinMax, - /// The initial price (p0) per reserve token - /// TODO: initial price is not implemented yet - /// TODO: do we need this or is it just calculated? - pub initial_price: Uint128, /// The initial allocation (θ), percentage of the initial raise allocated to the Funding Pool pub initial_allocation_ratio: StdDecimal, /// Exit tax for the hatch phase @@ -68,16 +64,6 @@ impl HatchConfig { ) ); - ensure!( - !self.initial_price.is_zero(), - ContractError::HatchPhaseConfigError( - "Initial price must be greater than zero.".to_string() - ) - ); - - // TODO: define better values - // Q: is zero valid for initial allocation value? Isn't the whole point of the - // hatch phase to initialize the DAO treasury? ensure!( self.initial_allocation_ratio <= StdDecimal::percent(100u64), ContractError::HatchPhaseConfigError( @@ -204,6 +190,7 @@ impl CommonsPhaseConfig { pub type CurveFn = Box Box>; +// TODO Curve type validation? // TODO add S-curve and taylor series #[cw_serde] pub enum CurveType { @@ -256,7 +243,6 @@ mod unit_tests { min: Uint128::one(), max: Uint128::from(1000000u128), }, - initial_price: Uint128::one(), initial_allocation_ratio: StdDecimal::percent(10u64), exit_tax: StdDecimal::percent(10u64), }, diff --git a/contracts/external/cw-abc/src/msg.rs b/contracts/external/cw-abc/src/msg.rs index 2e346ce8f..d6f29d213 100644 --- a/contracts/external/cw-abc/src/msg.rs +++ b/contracts/external/cw-abc/src/msg.rs @@ -42,6 +42,7 @@ pub enum UpdatePhaseConfigMsg { exit_tax: Option, allocation_percentage: Option, }, + /// TODO include curve type so we know what happens when a DAO dies? /// Update the closed phase configuration Closed {}, } @@ -64,8 +65,16 @@ pub enum ExecuteMsg { /// Update the hatch phase configuration /// This can only be called by the admin and only during the hatch phase UpdatePhaseConfig(UpdatePhaseConfigMsg), + // TODO Close the bonding curve + // Closing the bonding curve means no more buys are enabled and exit tax is set + // to zero. This could be used in the event of a project shutting down for example. + // + // Q: do we allow updating of the curve type? Is it passed in here? + // Close {}, } +// TODO Price queries: +// - Price to buy a certain amount? #[cw_ownable::cw_ownable_query] #[cw_serde] #[derive(QueryResponses)] diff --git a/contracts/external/cw-abc/src/test_tube/integration_tests.rs b/contracts/external/cw-abc/src/test_tube/integration_tests.rs index 25482180a..f7c401e5e 100644 --- a/contracts/external/cw-abc/src/test_tube/integration_tests.rs +++ b/contracts/external/cw-abc/src/test_tube/integration_tests.rs @@ -98,7 +98,6 @@ fn test_happy_path() { min: Uint128::one(), max: Uint128::from(1000000u128), }, - initial_price: Uint128::one(), initial_allocation_ratio: Decimal::percent(10u64), exit_tax: Decimal::percent(10u64), }, @@ -232,7 +231,7 @@ fn test_max_supply_enforced() { let err = abc .execute( &ExecuteMsg::Buy {}, - &coins(1000000000, RESERVE), + &coins(1000000000000000000000000, RESERVE), &accounts[0], ) .unwrap_err(); diff --git a/contracts/external/cw-abc/src/test_tube/test_env.rs b/contracts/external/cw-abc/src/test_tube/test_env.rs index 069a8c2dc..b265225ef 100644 --- a/contracts/external/cw-abc/src/test_tube/test_env.rs +++ b/contracts/external/cw-abc/src/test_tube/test_env.rs @@ -126,7 +126,6 @@ impl TestEnvBuilder { min: Uint128::from(10u128), max: Uint128::from(1000000u128), }, - initial_price: Uint128::one(), initial_allocation_ratio: Decimal::percent(10u64), exit_tax: Decimal::percent(10u64), }, diff --git a/contracts/external/cw-abc/src/testing.rs b/contracts/external/cw-abc/src/testing.rs index 247c99c27..a99861e3f 100644 --- a/contracts/external/cw-abc/src/testing.rs +++ b/contracts/external/cw-abc/src/testing.rs @@ -67,7 +67,6 @@ pub fn default_instantiate_msg( min: Uint128::one(), max: Uint128::from(1000000u128), }, - initial_price: Uint128::one(), initial_allocation_ratio: Decimal::percent(10u64), exit_tax: Decimal::zero(), },