Repository: public-awesome/launchpad
Pull request #413 (2022-09-21 15:48:16)

rename trading offset param


Patch:
diff --git a/contracts/base-factory/schema/instantiate_msg.json b/contracts/base-factory/schema/instantiate_msg.json
index 23d6205b..567cd33f 100644
--- a/contracts/base-factory/schema/instantiate_msg.json
+++ b/contracts/base-factory/schema/instantiate_msg.json
@@ -36,7 +36,7 @@
       "required": [
         "code_id",
         "creation_fee",
-        "default_trading_offset_secs",
+        "max_trading_offset_secs",
         "min_mint_price",
         "mint_fee_bps"
       ],
@@ -50,11 +50,6 @@
         "creation_fee": {
           "$ref": "#/definitions/Coin"
         },
-        "default_trading_offset_secs": {
-          "type": "integer",
-          "format": "uint64",
-          "minimum": 0.0
-        },
         "extension": {
           "anyOf": [
             {
@@ -65,6 +60,11 @@
             }
           ]
         },
+        "max_trading_offset_secs": {
+          "type": "integer",
+          "format": "uint64",
+          "minimum": 0.0
+        },
         "min_mint_price": {
           "$ref": "#/definitions/Coin"
         },
diff --git a/contracts/base-factory/src/contract.rs b/contracts/base-factory/src/contract.rs
index 81c17001..db7b0037 100644
--- a/contracts/base-factory/src/contract.rs
+++ b/contracts/base-factory/src/contract.rs
@@ -128,9 +128,9 @@ pub fn update_params<T, C>(
 
     params.mint_fee_bps = param_msg.mint_fee_bps.unwrap_or(params.mint_fee_bps);
 
-    params.default_trading_offset_secs = param_msg
-        .default_trading_offset_secs
-        .unwrap_or(params.default_trading_offset_secs);
+    params.max_trading_offset_secs = param_msg
+        .max_trading_offset_secs
+        .unwrap_or(params.max_trading_offset_secs);
 
     Ok(())
 }
diff --git a/contracts/base-minter/schema/instantiate_msg.json b/contracts/base-minter/schema/instantiate_msg.json
index d565196b..680933b6 100644
--- a/contracts/base-minter/schema/instantiate_msg.json
+++ b/contracts/base-minter/schema/instantiate_msg.json
@@ -136,7 +136,7 @@
       "required": [
         "code_id",
         "creation_fee",
-        "default_trading_offset_secs",
+        "max_trading_offset_secs",
         "min_mint_price",
         "mint_fee_bps"
       ],
@@ -150,11 +150,6 @@
         "creation_fee": {
           "$ref": "#/definitions/Coin"
         },
-        "default_trading_offset_secs": {
-          "type": "integer",
-          "format": "uint64",
-          "minimum": 0.0
-        },
         "extension": {
           "anyOf": [
             {
@@ -165,6 +160,11 @@
             }
           ]
         },
+        "max_trading_offset_secs": {
+          "type": "integer",
+          "format": "uint64",
+          "minimum": 0.0
+        },
         "min_mint_price": {
           "$ref": "#/definitions/Coin"
         },
diff --git a/contracts/base-minter/src/contract.rs b/contracts/base-minter/src/contract.rs
index 5c06b6b5..92045efd 100644
--- a/contracts/base-minter/src/contract.rs
+++ b/contracts/base-minter/src/contract.rs
@@ -59,7 +59,7 @@ pub fn instantiate(
 
     // Use default start trading time if not provided
     let mut collection_info = msg.collection_params.info.clone();
-    let offset = factory_params.params.default_trading_offset_secs;
+    let offset = factory_params.params.max_trading_offset_secs;
     let trading_start_time = msg
         .collection_params
         .info
diff --git a/contracts/vending-factory/schema/instantiate_msg.json b/contracts/vending-factory/schema/instantiate_msg.json
index 5f409c9b..0d7a822e 100644
--- a/contracts/vending-factory/schema/instantiate_msg.json
+++ b/contracts/vending-factory/schema/instantiate_msg.json
@@ -32,8 +32,8 @@
       "required": [
         "code_id",
         "creation_fee",
-        "default_trading_offset_secs",
         "extension",
+        "max_trading_offset_secs",
         "min_mint_price",
         "mint_fee_bps"
       ],
@@ -47,14 +47,14 @@
         "creation_fee": {
           "$ref": "#/definitions/Coin"
         },
-        "default_trading_offset_secs": {
+        "extension": {
+          "$ref": "#/definitions/ParamsExtension"
+        },
+        "max_trading_offset_secs": {
           "type": "integer",
           "format": "uint64",
           "minimum": 0.0
         },
-        "extension": {
-          "$ref": "#/definitions/ParamsExtension"
-        },
         "min_mint_price": {
           "$ref": "#/definitions/Coin"
         },
diff --git a/contracts/vending-minter/schema/instantiate_msg.json b/contracts/vending-minter/schema/instantiate_msg.json
index 0335f5a7..27dc4d25 100644
--- a/contracts/vending-minter/schema/instantiate_msg.json
+++ b/contracts/vending-minter/schema/instantiate_msg.json
@@ -126,8 +126,8 @@
       "required": [
         "code_id",
         "creation_fee",
-        "default_trading_offset_secs",
         "extension",
+        "max_trading_offset_secs",
         "min_mint_price",
         "mint_fee_bps"
       ],
@@ -141,14 +141,14 @@
         "creation_fee": {
           "$ref": "#/definitions/Coin"
         },
-        "default_trading_offset_secs": {
+        "extension": {
+          "$ref": "#/definitions/ParamsExtension"
+        },
+        "max_trading_offset_secs": {
           "type": "integer",
           "format": "uint64",
           "minimum": 0.0
         },
-        "extension": {
-          "$ref": "#/definitions/ParamsExtension"
-        },
         "min_mint_price": {
           "$ref": "#/definitions/Coin"
         },
diff --git a/contracts/vending-minter/src/contract.rs b/contracts/vending-minter/src/contract.rs
index 283368bc..f6e5e499 100644
--- a/contracts/vending-minter/src/contract.rs
+++ b/contracts/vending-minter/src/contract.rs
@@ -110,7 +110,7 @@ pub fn instantiate(
 
     // Use default start trading time if not provided
     let mut collection_info = msg.collection_params.info.clone();
-    let offset = factory_params.default_trading_offset_secs;
+    let offset = factory_params.max_trading_offset_secs;
     let start_time = msg.init_msg.start_time;
     let trading_start_time = msg
         .collection_params
@@ -714,7 +714,7 @@ pub fn execute_update_trading_start_time(
     let default_start_time_with_offset = config
         .extension
         .start_time
-        .plus_seconds(factory_params.params.default_trading_offset_secs);
+        .plus_seconds(factory_params.params.max_trading_offset_secs);
 
     if let Some(start_time) = start_time {
         if env.block.time > start_time {
diff --git a/packages/sg2/src/lib.rs b/packages/sg2/src/lib.rs
index 8b746bfe..a0fa91d1 100644
--- a/packages/sg2/src/lib.rs
+++ b/packages/sg2/src/lib.rs
@@ -14,6 +14,6 @@ pub struct MinterParams<T> {
     pub creation_fee: Coin,
     pub min_mint_price: Coin,
     pub mint_fee_bps: u64,
-    pub default_trading_offset_secs: u64,
+    pub max_trading_offset_secs: u64,
     pub extension: T,
 }
diff --git a/packages/sg2/src/msg.rs b/packages/sg2/src/msg.rs
index 8cd6af8b..09107133 100644
--- a/packages/sg2/src/msg.rs
+++ b/packages/sg2/src/msg.rs
@@ -27,7 +27,7 @@ pub struct UpdateMinterParamsMsg<T> {
     pub creation_fee: Option<Coin>,
     pub min_mint_price: Option<Coin>,
     pub mint_fee_bps: Option<u64>,
-    pub default_trading_offset_secs: Option<u64>,
+    pub max_trading_offset_secs: Option<u64>,
     pub extension: T,
 }
 


Test patch:
diff --git a/contracts/base-factory/src/integration_tests.rs b/contracts/base-factory/src/integration_tests.rs
index 6cf41b23..6d64eba7 100644
--- a/contracts/base-factory/src/integration_tests.rs
+++ b/contracts/base-factory/src/integration_tests.rs
@@ -34,7 +34,7 @@ mod tests {
             creation_fee: coin(CREATION_FEE, NATIVE_DENOM),
             min_mint_price: coin(MIN_MINT_PRICE, NATIVE_DENOM),
             mint_fee_bps: MINT_FEE_BPS,
-            default_trading_offset_secs: 60 * 60 * 24,
+            max_trading_offset_secs: 60 * 60 * 24,
             extension: None,
         }
     }
diff --git a/contracts/base-minter/src/integration_tests.rs b/contracts/base-minter/src/integration_tests.rs
index 87f2f93e..c9189748 100644
--- a/contracts/base-minter/src/integration_tests.rs
+++ b/contracts/base-minter/src/integration_tests.rs
@@ -65,7 +65,7 @@ pub fn mock_params() -> BaseMinterParams {
         creation_fee: coin(CREATION_FEE, NATIVE_DENOM),
         min_mint_price: coin(MIN_MINT_PRICE, NATIVE_DENOM),
         mint_fee_bps: MINT_FEE_BPS,
-        default_trading_offset_secs: 60 * 60 * 24 * 7,
+        max_trading_offset_secs: 60 * 60 * 24 * 7,
         extension: None,
     }
 }
@@ -265,7 +265,7 @@ fn update_trading_start_time() {
     let current_block_time = router.block_info().time;
     let (minter_addr, config) = setup_minter_contract(&mut router, &creator, false);
     let default_trading_start_time =
-        current_block_time.plus_seconds(mock_params().default_trading_offset_secs + 1);
+        current_block_time.plus_seconds(mock_params().max_trading_offset_secs + 1);
 
     // unauthorized
     let res = router.execute_contract(
diff --git a/contracts/sg721-base/src/integration_tests.rs b/contracts/sg721-base/src/integration_tests.rs
index 653c15da..3d14896e 100644
--- a/contracts/sg721-base/src/integration_tests.rs
+++ b/contracts/sg721-base/src/integration_tests.rs
@@ -78,7 +78,7 @@ mod tests {
             creation_fee: coin(CREATION_FEE, NATIVE_DENOM),
             min_mint_price: coin(MIN_MINT_PRICE, NATIVE_DENOM),
             mint_fee_bps: MINT_FEE_BPS,
-            default_trading_offset_secs: 60 * 60 * 24 * 7,
+            max_trading_offset_secs: 60 * 60 * 24 * 7,
             extension: ParamsExtension {
                 max_token_limit: MAX_TOKEN_LIMIT,
                 max_per_address_limit: MAX_PER_ADDRESS_LIMIT,
@@ -220,7 +220,7 @@ mod tests {
                 .unwrap();
             let default_start_time = mock_init_extension()
                 .start_time
-                .plus_seconds(mock_params().default_trading_offset_secs);
+                .plus_seconds(mock_params().max_trading_offset_secs);
             assert_eq!(res.trading_start_time, Some(default_start_time));
 
             // update collection info
diff --git a/contracts/vending-factory/src/integration_tests.rs b/contracts/vending-factory/src/integration_tests.rs
index 9205564a..4e025630 100644
--- a/contracts/vending-factory/src/integration_tests.rs
+++ b/contracts/vending-factory/src/integration_tests.rs
@@ -40,7 +40,7 @@ mod tests {
             creation_fee: coin(CREATION_FEE, NATIVE_DENOM),
             min_mint_price: coin(MIN_MINT_PRICE, NATIVE_DENOM),
             mint_fee_bps: MINT_FEE_BPS,
-            default_trading_offset_secs: 60 * 60 * 24 * 7,
+            max_trading_offset_secs: 60 * 60 * 24 * 7,
             extension: ParamsExtension {
                 max_token_limit: MAX_TOKEN_LIMIT,
                 max_per_address_limit: MAX_PER_ADDRESS_LIMIT,
diff --git a/contracts/vending-minter/src/integration_tests.rs b/contracts/vending-minter/src/integration_tests.rs
index 720dbe0f..a2b57589 100644
--- a/contracts/vending-minter/src/integration_tests.rs
+++ b/contracts/vending-minter/src/integration_tests.rs
@@ -127,7 +127,7 @@ pub fn mock_params() -> VendingMinterParams {
         creation_fee: coin(CREATION_FEE, NATIVE_DENOM),
         min_mint_price: coin(MIN_MINT_PRICE, NATIVE_DENOM),
         mint_fee_bps: MINT_FEE_BPS,
-        default_trading_offset_secs: 60 * 60 * 24 * 7,
+        max_trading_offset_secs: 60 * 60 * 24 * 7,
         extension: ParamsExtension {
             max_token_limit: MAX_TOKEN_LIMIT,
             max_per_address_limit: MAX_PER_ADDRESS_LIMIT,
@@ -1556,7 +1556,7 @@ fn update_trading_start_time() {
         Addr::unchecked(minter_addr),
         &ExecuteMsg::UpdateTradingStartTime(Some(
             Timestamp::from_nanos(GENESIS_MINT_START_TIME)
-                .plus_seconds(params.default_trading_offset_secs),
+                .plus_seconds(params.max_trading_offset_secs),
         )),
         &[],
     );
@@ -1571,7 +1571,7 @@ fn update_trading_start_time() {
         res.trading_start_time,
         Some(
             Timestamp::from_nanos(GENESIS_MINT_START_TIME)
-                .plus_seconds(params.default_trading_offset_secs)
+                .plus_seconds(params.max_trading_offset_secs)
         )
     );
 }