Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8e76f2a
Changes related to neutron sdk update
deniszagumennov Jan 20, 2025
c52724c
Contracts are compiled, tests in progress
deniszagumennov Jan 24, 2025
da0e435
Fixes related to new cosmwasm, getting rid of deprecated
deniszagumennov Jan 24, 2025
aa12f62
Fixed core tests
deniszagumennov Jan 28, 2025
3223bd0
Fixed factory tests
deniszagumennov Jan 28, 2025
8deeab8
Fix bond providers and mirror tests
deniszagumennov Jan 29, 2025
761f7a2
Fixes proposals, pump tests
deniszagumennov Jan 29, 2025
5e7be3a
Fixes puppeteer tests
deniszagumennov Jan 29, 2025
b83bd77
Fixed rewards manager, splitter, strategy, token tests
deniszagumennov Jan 30, 2025
743f6cb
Fixed val-ref, validators-set tests
deniszagumennov Jan 30, 2025
c236567
Fix formatting
deniszagumennov Jan 30, 2025
e246c75
Fixing omtimizing
deniszagumennov Jan 30, 2025
cbdd336
New nft contract from github source
deniszagumennov Mar 7, 2025
b8eba07
Update workers
keylogic1 Mar 7, 2025
cea8730
Last voucher types fixes, ts client updated
deniszagumennov Mar 7, 2025
627544f
Update Cargo.lock
deniszagumennov Mar 10, 2025
8086cd0
Post-rebase fixes
deniszagumennov Mar 11, 2025
dd0aa8b
Fix integration tests issues
deniszagumennov Mar 13, 2025
f21e9cc
Update tests.yml
em-xdev Mar 21, 2025
ee5f9a1
Final refactoring
deniszagumennov Mar 21, 2025
16dd086
Merged with dev
deniszagumennov Mar 22, 2025
c2f0eaf
Fixed integration tests
deniszagumennov Mar 22, 2025
6bc9785
fix mirror integration tests
faust403 Mar 24, 2025
8277d56
Little bit refactoring, triggering new build
deniszagumennov Mar 24, 2025
0566748
Merged unbonding mirror
deniszagumennov Mar 24, 2025
05958a4
Merged with dev
deniszagumennov Apr 9, 2025
35d3e5c
Review fixes
deniszagumennov Apr 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,716 changes: 1,245 additions & 471 deletions Cargo.lock

Large diffs are not rendered by default.

29 changes: 11 additions & 18 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
resolver = "2"
members = [
"contracts/unbonding-mirror",
"contracts/astroport-exchange-handler",
"contracts/auto-withdrawer",
"contracts/core",
"contracts/distribution",
Expand Down Expand Up @@ -39,26 +38,21 @@ members = [
]

[workspace.dependencies]
cosmwasm-std = { version = "1.5.9", default-features = false, features = [
"stargate",
"cosmwasm_1_2",
"staking",
] }
neutron-sdk = { package = "neutron-sdk", git = "https://github.com/neutron-org/neutron-sdk", branch = "feat/proposal-votes" }

cosmwasm-std = { version = "2.1.0", default-features = false, features = ["std", "cosmwasm_1_2", "cosmwasm_2_0", "staking"] }
neutron-sdk = { version = "0.11.0" }
neutron-std = { git = "https://github.com/neutron-org/neutron-std", branch = "main" }
cosmos-sdk-proto = { version = "0.20.0", default-features = false }
cw-ownable = { version = "0.5.1", default-features = false }
cw-ownable = { version = "2.0.0", default-features = false }
prost = { version = "0.12.3", default-features = false }
prost-types = { version = "0.12.3", default-features = false }
tendermint-proto = { version = "0.34.0", default-features = false }
tendermint-proto = { version = "0.34.1", default-features = false }
cosmwasm-schema = { version = "2.1.0", default-features = false }
cw-storage-plus = { version = "2.0.0", default-features = false }
cw2 = { version = "2.0.0", default-features = false }
cw721 = { package = "cw721", git = "https://github.com/public-awesome/cw-nfts", branch = "main", default-features = false }
cw-multi-test = { version = "2.1.0", default-features = false }
cw-utils = { version = "2.0.0", default-features = false }
time = "0.3.37"
cosmwasm-schema = { version = "1.5.4", default-features = false }
cw-storage-plus = { version = "1.2.0", default-features = false }
cw2 = { version = "1.1.2", default-features = false }
cw721 = { version = "0.18.0", default-features = false }
cw721-base = { version = "0.18.0", features = ["library"] }
cw-multi-test = { version = "0.20.0", default-features = false }
cw-utils = { version = "1.0.3", default-features = false }
serde = { version = "1.0.195", default-features = false }
serde-json-wasm = { version = "1.0.0", default-features = false }
sha2 = { version = "0.10.8", default-features = false }
Expand All @@ -67,7 +61,6 @@ bech32 = { version = "0.11.0", default-features = false, features = ["alloc"] }
thiserror = { version = "1.0.56", default-features = false }
optfield = { version = "0.3.0", default-features = false }
schemars = { version = "0.8.16", default-features = false }
astroport = { version = "3.6.1", default-features = false }
semver = { version = "1.0.22", default-features = false }
hex = { version = "0.4.3", default-features = false }
once_cell = { version = "1.20.2" }
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ compile_arm64:

check_contracts:
@cargo install cosmwasm-check --locked
@cosmwasm-check --available-capabilities iterator,staking,stargate,neutron,cosmwasm_1_1,cosmwasm_1_2 artifacts/*.wasm
@cosmwasm-check --available-capabilities iterator,staking,stargate,neutron,cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,cosmwasm_1_4,cosmwasm_2_0 artifacts/*.wasm

build_arm64: schema clippy test fmt doc compile_arm64 check_contracts

Expand Down
2 changes: 0 additions & 2 deletions contracts/astroport-exchange-handler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ exclude = [
crate-type = ["cdylib", "rlib"]

[features]
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
# use library feature to disable all instantiate/execute/query exports
library = []

Expand Down
1 change: 0 additions & 1 deletion contracts/auto-withdrawer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ version = "1.0.0"
crate-type = ["cdylib", "rlib"]

[features]
backtraces = ["cosmwasm-std/backtraces"]
library = []

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion contracts/auto-withdrawer/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ mod bondings {
}
}

pub fn map<'a>() -> IndexedMap<'a, &'a str, BondingRecord, BondingRecordIndexes<'a>> {
pub fn map() -> IndexedMap<&'static str, BondingRecord, BondingRecordIndexes<'static>> {
IndexedMap::new(
"bondings",
BondingRecordIndexes {
Expand Down
43 changes: 23 additions & 20 deletions contracts/auto-withdrawer/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,39 @@ use crate::{
};
use cosmwasm_std::{
attr, coin,
testing::{mock_env, mock_info},
Event,
testing::{message_info, mock_env},
Addr, Event,
};
use drop_helpers::testing::{mock_dependencies, mock_state_query};

#[test]
fn instantiate() {
let mut deps = mock_dependencies(&[]);
let factory_contract_address_msg = deps.api.addr_make("factory_contract").to_string();
let response = contract::instantiate(
deps.as_mut(),
mock_env(),
mock_info("admin", &[]),
message_info(&Addr::unchecked("admin"), &[]),
InstantiateMsg {
factory_contract: "factory_contract".to_string(),
factory_contract: factory_contract_address_msg.clone(),
ld_token: "ld_token".to_string(),
},
)
.unwrap();

let factory_contract = FACTORY_CONTRACT.load(deps.as_ref().storage).unwrap();
assert_eq!(factory_contract, "factory_contract");
let factory_contract_address_storage = FACTORY_CONTRACT.load(deps.as_ref().storage).unwrap();
assert_eq!(
factory_contract_address_storage.as_str(),
factory_contract_address_msg.as_str()
);
let ld_token = LD_TOKEN.load(deps.as_ref().storage).unwrap();
assert_eq!(ld_token, "ld_token");
assert_eq!(response.messages.len(), 0);
assert_eq!(
response.events,
vec![
Event::new("drop-auto-withdrawer-instantiate").add_attributes([
attr("factory_contract", "factory_contract"),
attr("factory_contract", factory_contract_address_msg),
attr("ld_token", "ld_token")
])
]
Expand All @@ -45,20 +49,22 @@ fn instantiate() {
#[test]
fn bond_missing_ld_assets() {
let mut deps = mock_dependencies(&[]);
let api = deps.api;

mock_state_query(&mut deps);
FACTORY_CONTRACT
.save(
deps.as_mut().storage,
&cosmwasm_std::Addr::unchecked("factory_contract".to_string()),
)
.save(deps.as_mut().storage, &api.addr_make("factory_contract"))
.unwrap();
LD_TOKEN
.save(deps.as_mut().storage, &"ld_token".into())
.unwrap();
let err = contract::execute(
deps.as_mut(),
mock_env(),
mock_info("sender", &[coin(10, "uatom"), coin(20, "untrn")]),
message_info(
&api.addr_make("sender"),
&[coin(10, "uatom"), coin(20, "untrn")],
),
ExecuteMsg::Bond(BondMsg::WithLdAssets {}),
)
.unwrap_err();
Expand Down Expand Up @@ -86,27 +92,24 @@ fn test_migrate_wrong_contract() {
}

mod bond_missing_deposit {
use drop_helpers::testing::{mock_dependencies, mock_state_query};

use super::*;

#[test]
fn with_ld_assets() {
let mut deps = mock_dependencies(&[]);
let api = deps.api;

mock_state_query(&mut deps);
FACTORY_CONTRACT
.save(
deps.as_mut().storage,
&cosmwasm_std::Addr::unchecked("factory_contract".to_string()),
)
.save(deps.as_mut().storage, &api.addr_make("factory_contract"))
.unwrap();
LD_TOKEN
.save(deps.as_mut().storage, &"ld_token".into())
.unwrap();
let err = contract::execute(
deps.as_mut(),
mock_env(),
mock_info("sender", &[coin(10, "ld_token")]),
message_info(&api.addr_make("sender"), &[coin(10, "ld_token")]),
ExecuteMsg::Bond(BondMsg::WithLdAssets {}),
)
.unwrap_err();
Expand All @@ -120,7 +123,7 @@ mod bond_missing_deposit {
let err = contract::execute(
deps.as_mut(),
mock_env(),
mock_info("sender", &[]),
message_info(&Addr::unchecked("sender"), &[]),
ExecuteMsg::Bond(BondMsg::WithNFT {
token_id: "token_id".into(),
}),
Expand Down
2 changes: 0 additions & 2 deletions contracts/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ exclude = [
crate-type = ["cdylib", "rlib"]

[features]
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
# use library feature to disable all instantiate/execute/query exports
library = []

Expand Down
12 changes: 7 additions & 5 deletions contracts/core/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use drop_staking_base::{
UNBOND_BATCH_ID,
},
validatorset::ValidatorInfo,
withdrawal_voucher::{Metadata, Trait},
withdrawal_voucher::{NftExtensionMsg, Trait},
},
};
use neutron_sdk::bindings::{msg::NeutronMsg, query::NeutronQuery};
Expand Down Expand Up @@ -188,6 +188,7 @@ fn query_exchange_rate(deps: Deps<NeutronQuery>, config: &Config) -> ContractRes
let mut batch_id = UNBOND_BATCH_ID.load(deps.storage)?;
let mut unprocessed_dasset_to_unbond = Uint128::zero();
let batch = unbond_batches_map().load(deps.storage, batch_id)?;

if batch.status == UnbondBatchStatus::New {
unprocessed_dasset_to_unbond += batch.total_dasset_amount_to_withdraw;
}
Expand Down Expand Up @@ -458,7 +459,7 @@ fn execute_update_withdrawn_amount(
let config = CONFIG.load(deps.storage)?;
let addrs =
drop_helpers::get_contracts!(deps, config.factory_contract, withdrawal_manager_contract);
if info.sender != addrs.withdrawal_manager_contract {
if info.sender.as_str() != addrs.withdrawal_manager_contract {
return Err(ContractError::Unauthorized {});
}

Expand Down Expand Up @@ -1142,7 +1143,7 @@ fn execute_unbond(
unbond_batch.total_dasset_amount_to_withdraw += dasset_amount;
unbond_batches_map().save(deps.storage, unbond_batch_id, &unbond_batch)?;

let extension = Some(Metadata {
let extension = Some(NftExtensionMsg {
description: Some("Withdrawal voucher".into()),
name: "LDV voucher".to_string(),
batch_id: unbond_batch_id.to_string(),
Expand Down Expand Up @@ -1261,8 +1262,9 @@ fn get_unbonding_msg<T>(
{
let current_exchange_rate = query_exchange_rate(deps.as_ref(), config)?;
attrs.push(attr("exchange_rate", current_exchange_rate.to_string()));
let expected_native_asset_amount =
unbond.total_dasset_amount_to_withdraw * current_exchange_rate;
let expected_native_asset_amount = unbond
.total_dasset_amount_to_withdraw
.mul_floor(current_exchange_rate);

let calc_withdraw_query_result: Result<Vec<(String, Uint128)>, StdError> =
deps.querier.query_wasm_smart(
Expand Down
Loading
Loading