Skip to content

Commit

Permalink
fix: nid data type removed
Browse files Browse the repository at this point in the history
  • Loading branch information
Itshyphen committed Nov 13, 2024
1 parent b1baed5 commit d6bbcb7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
15 changes: 11 additions & 4 deletions contracts/balanced_doller/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
//! interface.
use crate::allowance::{read_allowance, spend_allowance, write_allowance};
use crate::balance::{read_balance, receive_balance, spend_balance};
use crate::balanced_dollar;
use crate::{balanced_dollar, storage_types};
use crate::errors::ContractError;
use crate::metadata::{read_decimal, read_name, read_symbol, write_metadata};
use crate::states::{has_administrator, read_administrator, write_administrator};
use crate::storage_types::{get_upgrade_authority, set_icon_bnusd, set_nid, set_upgrade_authority, set_xcall, set_xcall_manager, INSTANCE_BUMP_AMOUNT, INSTANCE_LIFETIME_THRESHOLD
use crate::storage_types::{get_upgrade_authority, set_icon_bnusd, set_upgrade_authority, set_xcall, set_xcall_manager, INSTANCE_BUMP_AMOUNT, INSTANCE_LIFETIME_THRESHOLD
};
use soroban_sdk::{
contract, contractimpl, panic_with_error, Address, Bytes, BytesN, Env, String, Vec,
Expand All @@ -24,7 +24,7 @@ pub struct BalancedDollar;

#[contractimpl]
impl BalancedDollar {
pub fn initialize(e: Env, admin: Address, xcall: Address, xcall_manager: Address, nid: String, icon_bnusd: String, upgrade_auth: Address) {
pub fn initialize(e: Env, admin: Address, xcall: Address, xcall_manager: Address, icon_bnusd: String, upgrade_auth: Address) {
if has_administrator(&e) {
panic_with_error!(e, ContractError::ContractAlreadyInitialized)
}
Expand All @@ -49,7 +49,6 @@ impl BalancedDollar {
);
set_xcall(&e, xcall);
set_icon_bnusd(&e, icon_bnusd);
set_nid(&e, nid);
set_xcall_manager(&e, xcall_manager);
set_upgrade_authority(&e, upgrade_auth);
}
Expand Down Expand Up @@ -159,4 +158,12 @@ impl BalancedDollar {
pub fn symbol(e: Env) -> String {
read_symbol(&e)
}

pub fn xcall_manager(e: Env) -> Address {
storage_types::get_xcall_manager(&e).unwrap()
}

pub fn xcall(e: Env) -> Address {
storage_types::get_xcall(&e).unwrap()
}
}
12 changes: 0 additions & 12 deletions contracts/balanced_doller/src/storage_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ pub enum DataKey {
Admin,
XcallManager,
XCall,
Nid,
IconBnusd,
UpgradeAuthority
}
Expand All @@ -43,10 +42,6 @@ pub fn set_xcall(e: &Env, value: Address) {
e.storage().instance().set(&DataKey::XCall, &value);
}

pub fn set_nid(e: &Env, value: String) {
e.storage().instance().set(&DataKey::Nid, &value);
}

pub fn set_icon_bnusd(e: &Env, value: String) {
e.storage().instance().set(&DataKey::IconBnusd, &value);
}
Expand All @@ -69,13 +64,6 @@ pub fn get_xcall(e: &Env) -> Result<Address, ContractError> {
.get(&key)
.ok_or(ContractError::Uninitialized)}

pub fn get_nid(e: &Env) -> Result<String, ContractError> {
let key = DataKey::Nid;
e.storage()
.instance()
.get(&key)
.ok_or(ContractError::Uninitialized)}

pub fn get_icon_bnusd(e: &Env) -> Result<String, ContractError> {
let key = DataKey::IconBnusd;
e.storage()
Expand Down
3 changes: 1 addition & 2 deletions contracts/balanced_doller/src/tests/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ pub struct TestContext {
pub xcall_manager: Address,
pub icon_bn_usd: String,
pub icon_governance: String,
pub token: Address,
pub centralized_connection: Address,
pub nid: String,
pub native_token: Address,
Expand Down Expand Up @@ -95,7 +94,7 @@ impl TestContext {
icon_bn_usd: self.icon_bn_usd.clone(),
upgrade_authority: self.upgrade_authority.clone(),
};
client.initialize(&self.admin, &config.xcall, &config.xcall_manager, &config.nid, &config.icon_bn_usd, &config.upgrade_authority);
client.initialize(&self.admin, &config.xcall, &config.xcall_manager, &config.icon_bn_usd, &config.upgrade_authority);
}

pub fn init_xcall_manager_context(&self) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/optimize-stellar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cargo build --target wasm32-unknown-unknown --release
for WASM in $build_directory/*.wasm; do
NAME=$(basename "$WASM" .wasm)${SUFFIX}.wasm
echo "Optimizing $NAME ... $WASM"
stellar contract optimize --wasm "$WASM"
/usr/local/bin/stellar contract optimize --wasm "$WASM"
done

for WASM in $build_directory/*.optimized.wasm; do
Expand Down

0 comments on commit d6bbcb7

Please sign in to comment.