Skip to content

Commit

Permalink
cosmwasm: Rename accounting -> accountant
Browse files Browse the repository at this point in the history
Also change wormchain -> global.
  • Loading branch information
jynnantonix authored and evan-gray committed Jan 23, 2023
1 parent 1f939ea commit dd95954
Show file tree
Hide file tree
Showing 27 changed files with 78 additions and 78 deletions.
54 changes: 27 additions & 27 deletions cosmwasm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions cosmwasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ members = [
"contracts/token-bridge",
"contracts/shutdown-token-bridge",
"contracts/mock-bridge-integration",
"packages/accounting",
"contracts/wormchain-accounting",
"packages/accountant",
"contracts/global-accountant",
"packages/wormhole-bindings",
"packages/cw_transcode",
]
Expand All @@ -28,12 +28,12 @@ incremental = false
overflow-checks = true

[patch.crates-io]
accounting = { path = "packages/accounting" }
accountant = { path = "packages/accountant" }
cw_transcode = { path = "packages/cw_transcode" }
cw20-wrapped-2 = { path = "contracts/cw20-wrapped" }
serde_wormhole = { path = "../sdk/rust/serde_wormhole" }
token-bridge-terra-2 = { path = "contracts/token-bridge" }
wormchain-accounting = { path = "contracts/wormchain-accounting" }
global-accountant = { path = "contracts/global-accountant" }
wormhole-bindings = { path = "packages/wormhole-bindings" }
wormhole-bridge-terra-2 = { path = "contracts/wormhole" }
wormhole-core = { path = "../sdk/rust/core" }
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "wormchain-accounting"
name = "global-accountant"
version = "0.1.0"
authors = ["Wormhole Project Contributors"]
edition = "2021"
Expand All @@ -13,7 +13,7 @@ backtraces = ["cosmwasm-std/backtraces"]
library = []

[dependencies]
accounting = "0.1.0"
accountant = "0.1.0"
anyhow = "1"
base64 = "0.13"
cosmwasm-schema = "1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use cosmwasm_schema::write_api;

use cosmwasm_std::Empty;
use wormchain_accounting::msg::{ExecuteMsg, QueryMsg};
use global_accountant::msg::{ExecuteMsg, QueryMsg};

fn main() {
write_api! {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"contract_name": "wormchain-accounting",
"contract_name": "global-accountant",
"contract_version": "0.1.0",
"idl_version": "1.0.0",
"instantiate": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::marker::PhantomData;

use accounting::{
use accountant::{
query_balance, query_modification,
state::{account, transfer, Modification, TokenAddress, Transfer},
validate_transfer,
Expand Down Expand Up @@ -37,7 +37,7 @@ use crate::{
};

// version info for migration info
const CONTRACT_NAME: &str = "crates.io:wormchain-accounting";
const CONTRACT_NAME: &str = "crates.io:global-accountant";
const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");

#[cfg_attr(not(feature = "library"), entry_point)]
Expand Down Expand Up @@ -241,7 +241,7 @@ fn handle_observation(
"unknown emitter address"
);

accounting::commit_transfer(
accountant::commit_transfer(
deps.branch(),
Transfer {
key: tx_key,
Expand Down Expand Up @@ -287,7 +287,7 @@ fn modify_balance(
let msg: Modification = from_binary(&modification).context("failed to parse `Modification`")?;

let event =
accounting::modify_balance(deps, msg).context("failed to modify account balance")?;
accountant::modify_balance(deps, msg).context("failed to modify account balance")?;

Ok(Response::new()
.add_attribute("action", "modify_balance")
Expand Down Expand Up @@ -471,7 +471,7 @@ fn handle_tokenbridge_vaa(
key: key.clone(),
data,
};
let evt = accounting::commit_transfer(deps.branch(), tx)
let evt = accountant::commit_transfer(deps.branch(), tx)
.with_context(|| format!("failed to commit transfer for key {key}"))?;

PENDING_TRANSFERS.remove(deps.storage, key);
Expand Down Expand Up @@ -532,12 +532,12 @@ fn query_all_accounts(
let l = lim
.try_into()
.map_err(|_| ConversionOverflowError::new("u32", "usize", lim.to_string()))?;
accounting::query_all_accounts(deps, start_after)
accountant::query_all_accounts(deps, start_after)
.take(l)
.collect::<StdResult<Vec<_>>>()
.map(|accounts| AllAccountsResponse { accounts })
} else {
accounting::query_all_accounts(deps, start_after)
accountant::query_all_accounts(deps, start_after)
.collect::<StdResult<Vec<_>>>()
.map(|accounts| AllAccountsResponse { accounts })
}
Expand All @@ -552,7 +552,7 @@ fn query_all_transfers(
let l = lim
.try_into()
.map_err(|_| ConversionOverflowError::new("u32", "usize", lim.to_string()))?;
accounting::query_all_transfers(deps, start_after)
accountant::query_all_transfers(deps, start_after)
.map(|res| {
res.and_then(|t| {
let digest = DIGESTS.load(
Expand All @@ -571,7 +571,7 @@ fn query_all_transfers(
.collect::<StdResult<Vec<_>>>()
.map(|transfers| AllTransfersResponse { transfers })
} else {
accounting::query_all_transfers(deps, start_after)
accountant::query_all_transfers(deps, start_after)
.map(|res| {
res.and_then(|t| {
let digest = DIGESTS.load(
Expand Down Expand Up @@ -637,12 +637,12 @@ fn query_all_modifications(
let l = lim
.try_into()
.map_err(|_| ConversionOverflowError::new("u32", "usize", lim.to_string()))?;
accounting::query_all_modifications(deps, start_after)
accountant::query_all_modifications(deps, start_after)
.take(l)
.collect::<StdResult<Vec<_>>>()
.map(|modifications| AllModificationsResponse { modifications })
} else {
accounting::query_all_modifications(deps, start_after)
accountant::query_all_modifications(deps, start_after)
.collect::<StdResult<Vec<_>>>()
.map(|modifications| AllModificationsResponse { modifications })
}
Expand Down Expand Up @@ -690,7 +690,7 @@ fn query_transfer_status(
key.sequence(),
),
)? {
let data = accounting::query_transfer(deps, key.clone())?;
let data = accountant::query_transfer(deps, key.clone())?;
Ok(TransferStatus::Committed { data, digest })
} else if let Some(data) = PENDING_TRANSFERS.may_load(deps.storage, key.clone())? {
Ok(TransferStatus::Pending(tinyvec_to_vec(data)))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use accounting::state::{account, transfer, Account, Modification, Transfer};
use accountant::state::{account, transfer, Account, Modification, Transfer};
use cosmwasm_schema::{cw_serde, QueryResponses};
use cosmwasm_std::Binary;
use serde_wormhole::RawMessage;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use accounting::state::transfer;
use accountant::state::transfer;
use cosmwasm_schema::cw_serde;
use cosmwasm_std::Binary;
use cw_storage_plus::Map;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
mod helpers;

use cosmwasm_std::{to_binary, Event};
use global_accountant::msg::ChainRegistrationResponse;
use helpers::*;
use wormchain_accounting::msg::ChainRegistrationResponse;
use wormhole::{
token::{Action, GovernancePacket},
vaa::Body,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(dead_code)]

use accounting::state::{account, transfer, Modification};
use accountant::state::{account, transfer, Modification};
use cosmwasm_schema::cw_serde;
use cosmwasm_std::{
testing::{MockApi, MockStorage},
Expand All @@ -9,15 +9,15 @@ use cosmwasm_std::{
use cw_multi_test::{
App, AppBuilder, AppResponse, BankKeeper, ContractWrapper, Executor, WasmKeeper,
};
use serde::Serialize;
use wormchain_accounting::{
use global_accountant::{
msg::{
AllAccountsResponse, AllModificationsResponse, AllPendingTransfersResponse,
AllTransfersResponse, BatchTransferStatusResponse, ChainRegistrationResponse, ExecuteMsg,
MissingObservationsResponse, QueryMsg, TransferStatus,
},
state,
};
use serde::Serialize;
use wormhole::{
token::{Action, GovernancePacket},
vaa::{Body, Header, Signature},
Expand Down Expand Up @@ -253,10 +253,10 @@ pub fn proper_instantiate() -> (fake::WormholeKeeper, Contract) {
let wh = fake::WormholeKeeper::new();
let mut app = fake_app(wh.clone());

let accounting_id = app.store_code(Box::new(ContractWrapper::new(
wormchain_accounting::contract::execute,
wormchain_accounting::contract::instantiate,
wormchain_accounting::contract::query,
let accountant_id = app.store_code(Box::new(ContractWrapper::new(
global_accountant::contract::execute,
global_accountant::contract::instantiate,
global_accountant::contract::query,
)));

// We want the contract to be able to upgrade itself, which means we have to set the contract
Expand All @@ -278,11 +278,11 @@ pub fn proper_instantiate() -> (fake::WormholeKeeper, Contract) {
// can't use it here. Maybe something to bring up with upstream.
let addr = app
.instantiate_contract(
accounting_id,
accountant_id,
Addr::unchecked(ADMIN),
&Empty {},
&[],
"accounting",
"accountant",
Some("contract0".into()),
)
.unwrap();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
mod helpers;

use accounting::state::transfer;
use accountant::state::transfer;
use cosmwasm_std::{to_binary, Uint256};
use global_accountant::msg::Observation;
use helpers::*;
use wormchain_accounting::msg::Observation;
use wormhole::{token::Message, Address, Amount, Chain};

fn create_observation() -> Observation {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod helpers;

use accounting::state::{account, Kind, Modification};
use accountant::state::{account, Kind, Modification};
use cosmwasm_std::{to_binary, Event, Uint256};
use helpers::*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ mod helpers;

use std::collections::BTreeMap;

use accounting::state::{
use accountant::state::{
account::{self, Balance},
transfer, Kind, Modification, Transfer,
};
use cosmwasm_std::{to_binary, Uint256};
use global_accountant::msg::TransferStatus;
use helpers::*;
use wormchain_accounting::msg::TransferStatus;
use wormhole::{token::Message, vaa::Body, Address, Amount};
use wormhole_bindings::fake;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ mod helpers;

use std::collections::BTreeMap;

use accounting::state::{account, transfer, Kind, Modification, TokenAddress};
use accountant::state::{account, transfer, Kind, Modification, TokenAddress};
use cosmwasm_std::{from_binary, to_binary, Binary, Event, Uint256};
use cw_multi_test::AppResponse;
use global_accountant::msg::{Observation, ObservationStatus, SubmitObservationResponse};
use helpers::*;
use wormchain_accounting::msg::{Observation, ObservationStatus, SubmitObservationResponse};
use wormhole::{
token::Message,
vaa::{Body, Header},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
mod helpers;

use accounting::state::{transfer, TokenAddress};
use accountant::state::{transfer, TokenAddress};
use cosmwasm_std::{from_binary, to_binary, Binary, Event, Uint256};
use global_accountant::msg::{Observation, ObservationStatus, SubmitObservationResponse};
use helpers::*;
use serde_wormhole::RawMessage;
use wormchain_accounting::msg::{Observation, ObservationStatus, SubmitObservationResponse};
use wormhole::{
token::Message,
vaa::{Body, Header, Vaa},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use cosmwasm_std::{
to_binary, Binary, Deps, DepsMut, Empty, Env, Event, MessageInfo, Response, StdResult,
};
use cw_multi_test::ContractWrapper;
use global_accountant::msg::Upgrade;
use helpers::*;
use wormchain_accounting::msg::Upgrade;
use wormhole_bindings::WormholeQuery;

pub fn instantiate(
Expand Down
2 changes: 1 addition & 1 deletion cosmwasm/deployment/terra2/tools/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const artifacts = [
"mock_bridge_integration_2.wasm",
"shutdown_core_bridge_cosmwasm.wasm",
"shutdown_token_bridge_cosmwasm.wasm",
"wormchain_accounting.wasm",
"global_accountant.wasm",
];

/* Check that the artifact folder contains all the wasm files we expect and nothing else */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "accounting"
name = "accountant"
version = "0.1.0"
authors = ["Wormhole Project Contributors"]
edition = "2021"
Expand Down
Loading

0 comments on commit dd95954

Please sign in to comment.