Explorar o código

terra: migrations for lower bridge fee

Change-Id: Ic83b321d42c9148f3915a365d195298ff052eda2
Reisen %!s(int64=4) %!d(string=hai) anos
pai
achega
ddf43b85d7

+ 1 - 1
terra/contracts/token-bridge/src/contract.rs

@@ -317,7 +317,7 @@ fn handle_attest_meta(
     } else {
         wrapped_asset(deps.storage).save(&asset_id, &HumanAddr::from(WRAPPED_ASSET_UPDATING))?;
         CosmosMsg::Wasm(WasmMsg::Instantiate {
-            admin: Some(env.contract.address.to_string()),
+            admin: Some(env.contract.address.clone().into_string()),
             code_id: cfg.wrapped_asset_code_id,
             msg: to_binary(&WrappedInit {
                 name: get_string_from_32(&meta.name)?,

+ 5 - 2
terra/contracts/wormhole/src/contract.rs

@@ -82,7 +82,10 @@ const FEE_AMOUNT: u128 = 10000;
 pub const FEE_DENOMINATION: &str = "uluna";
 
 #[cfg_attr(not(feature = "library"), entry_point)]
-pub fn migrate(_deps: DepsMut, _env: Env, _msg: MigrateMsg) -> StdResult<Response> {
+pub fn migrate(deps: DepsMut, _env: Env, _msg: MigrateMsg) -> StdResult<Response> {
+    let mut state = config_read(deps.storage).load()?;
+    state.fee = Coin::new(0, FEE_DENOMINATION);
+    config(deps.storage).save(&state)?;
     Ok(Response::default())
 }
 
@@ -329,7 +332,7 @@ fn handle_post_message(
     let fee = state.fee;
 
     // Check fee
-    if !has_coins(info.funds.as_ref(), &fee) {
+    if fee.amount.u128() > 0 && !has_coins(info.funds.as_ref(), &fee) {
         return ContractError::FeeTooLow.std_err();
     }