-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MP-3498. Configurable arithmetic and geometric twap for LSD (#347)
* LSD price source with configured Arithmetic or Geometric TWAP. * Update schema. * Add migrate for oracle. * Simplify tests. * Update schema after changing migration.
- Loading branch information
Showing
18 changed files
with
475 additions
and
213 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
pub mod v2_0_0; | ||
pub mod v2_0_1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use cosmwasm_std::{DepsMut, Response}; | ||
use cw2::{assert_contract_version, set_contract_version}; | ||
use mars_oracle_base::ContractError; | ||
|
||
use crate::contract::{CONTRACT_NAME, CONTRACT_VERSION}; | ||
|
||
const FROM_VERSION: &str = "2.0.0"; | ||
|
||
pub fn migrate(deps: DepsMut) -> Result<Response, ContractError> { | ||
// make sure we're migrating the correct contract and from the correct version | ||
assert_contract_version(deps.storage, &format!("crates.io:{CONTRACT_NAME}"), FROM_VERSION)?; | ||
|
||
set_contract_version(deps.storage, format!("crates.io:{CONTRACT_NAME}"), CONTRACT_VERSION)?; | ||
|
||
Ok(Response::new() | ||
.add_attribute("action", "migrate") | ||
.add_attribute("from_version", FROM_VERSION) | ||
.add_attribute("to_version", CONTRACT_VERSION)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.