Skip to content

Commit

Permalink
Merge branch 'tiago/cap-wnam' (#1781)
Browse files Browse the repository at this point in the history
* origin/tiago/cap-wnam:
  Add changelog for #1781
  Add invalidate_wnam_over_cap_tx() unit test
  Fix wNAM edge cases in Bridge pool VP unit tests
  New Bridge pool VP unit tests for wrapped NAM
  Add `asset` field to Balance
  Refactor Bridge pool tests to allow modifying pending transfer
  Fix test_act_on_changes_storage_for_transfers_to_eth() unit test
  Test that wrapped NAM is never minted
  Fix test_redeem_native_token() unit test
  Fix test_wrapped_nam_not_burned() unit test
  Add test_wnam_doesnt_mint_nuts() unit test
  Refactor get_erc20_flow_control to use EthBridgeQueries
  Replace ERC20 supply RPC query with atomic read of all flow control data
  Flow control of NAM transferred to Ethereum
  Allow null pre-balances during Bridge pool escrow checks
  Update wNAM supplies when acting on Ethereum events
  Harden Bridge pool VP against wNAM NUT transfers
  Vet Ethereum bridge config of the native token
  Refactor redeem_native_token to use update::amount
  Use EthAssetMint helper methods
  Add helper methods to EthAssetMint
  • Loading branch information
Fraccaman committed Sep 6, 2023
2 parents ac8e7f5 + 161cf43 commit ac5b5be
Show file tree
Hide file tree
Showing 7 changed files with 642 additions and 228 deletions.
2 changes: 2 additions & 0 deletions .changelog/unreleased/features/1781-cap-wnam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Control the flow of NAM over the Ethereum bridge
([\#1781](https://github.com/anoma/namada/pull/1781))
11 changes: 10 additions & 1 deletion ethereum_bridge/src/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use namada_core::ledger::storage_api::{StorageRead, StorageWrite};
use namada_core::types::ethereum_events::EthAddress;
use namada_core::types::ethereum_structs;
use namada_core::types::storage::Key;
use namada_core::types::token::DenominatedAmount;
use namada_core::types::token::{DenominatedAmount, NATIVE_MAX_DECIMAL_PLACES};
use serde::{Deserialize, Serialize};

use crate::storage::eth_bridge_queries::{
Expand Down Expand Up @@ -218,6 +218,15 @@ impl EthereumBridgeConfig {
token_cap: DenominatedAmount { amount: cap, denom },
} in erc20_whitelist
{
if addr == native_erc20
&& denom != &NATIVE_MAX_DECIMAL_PLACES.into()
{
panic!(
"Error writing Ethereum bridge config: The native token \
should have {NATIVE_MAX_DECIMAL_PLACES} decimal places"
);
}

let key = whitelist::Key {
asset: *addr,
suffix: whitelist::KeyType::Whitelisted,
Expand Down
Loading

0 comments on commit ac5b5be

Please sign in to comment.