Skip to content

Commit

Permalink
Clean up, add notes for future work
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeHartnell authored and Jake Hartnell committed Mar 26, 2024
1 parent 9f39048 commit 30dd7a5
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 19 deletions.
16 changes: 1 addition & 15 deletions contracts/external/cw-abc/src/abc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(
Expand Down Expand Up @@ -204,6 +190,7 @@ impl CommonsPhaseConfig {

pub type CurveFn = Box<dyn Fn(DecimalPlaces) -> Box<dyn Curve>>;

// TODO Curve type validation?
// TODO add S-curve and taylor series
#[cw_serde]
pub enum CurveType {
Expand Down Expand Up @@ -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),
},
Expand Down
9 changes: 9 additions & 0 deletions contracts/external/cw-abc/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pub enum UpdatePhaseConfigMsg {
exit_tax: Option<StdDecimal>,
allocation_percentage: Option<StdDecimal>,
},
/// TODO include curve type so we know what happens when a DAO dies?
/// Update the closed phase configuration
Closed {},
}
Expand All @@ -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)]
Expand Down
3 changes: 1 addition & 2 deletions contracts/external/cw-abc/src/test_tube/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
},
Expand Down Expand Up @@ -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();
Expand Down
1 change: 0 additions & 1 deletion contracts/external/cw-abc/src/test_tube/test_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
},
Expand Down
1 change: 0 additions & 1 deletion contracts/external/cw-abc/src/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
},
Expand Down

0 comments on commit 30dd7a5

Please sign in to comment.