Skip to content

Conversation

@jayantk
Copy link
Contributor

@jayantk jayantk commented Dec 29, 2022

Clean up a few miscellaneous issues from earlier PRs. Main changes are:

  • Use PythDataSource consistently across initialization messages and configs
  • Use Coin in the config and initialization message instead of separate fee/denom parameters

I suggest reading msg.rs and state.rs first to get the main changes before looking at contract.rs (which is mostly mechanical)..

governance_sequence_number: msg.governance_sequence_number,
valid_time_period: Duration::from_secs(msg.valid_time_period_secs as u64),
fee: msg.fee,
fee_denom: msg.fee_denom,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fee is a Coin now so it has the denom already

env: Env,
info: MessageInfo,
data: &Binary,
data: &[Binary],
Copy link
Contributor Author

@jayantk jayantk Dec 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pass in an array of price updates to update_price_feeds for consistency with the EVM implementation.

}
_ => Err(PythContractError::InvalidGovernancePayload)?,
}
transfer_governance(&mut updated_config, &state, &parsed_claim_vaa)?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to helper function (per previous PR comment)

emitter: vaa.emitter_address.clone().into(),
pyth_emitter_chain: vaa.emitter_chain,
emitter: vaa.emitter_address.clone().into(),
chain_id: vaa.emitter_chain,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I renamed this field in data source)

SetValidPeriod,
},
state::PythDataSource,
},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix same file imports (per previous PR)

QueryMsg::GetValidTimePeriod => to_binary(&get_valid_time_period(deps)?),
QueryMsg::PriceFeed { id } => to_binary(&query_price_feed(&deps, env, id.as_ref())?),
QueryMsg::GetUpdateFee { vaas } => to_binary(&get_update_fee(&deps, &vaas)?),
QueryMsg::GetValidTimePeriod => to_binary(&get_valid_time_period(&deps)?),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed signature to borrow (for consistency with the rest of the functions)

Copy link
Collaborator

@ali-behjati ali-behjati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

@jayantk jayantk merged commit 695b096 into main Dec 29, 2022
@jayantk jayantk deleted the cw_cleanup2 branch December 29, 2022 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants