Summary
Tokens registered via .with_token("USDC", 6) during builder configuration are inaccessible after build() completes. Users must re-construct the token or store it before the builder is consumed.
let env = MockEnv::builder()
.with_token("USDC", 6)
.build();
// Currently impossible — no way to get the USDC token back
let usdc = env.token("USDC"); // method does not exist
Proposed API
impl MockEnv {
pub fn token(&self, symbol: &str) -> MockToken { ... }
pub fn token_opt(&self, symbol: &str) -> Option<MockToken> { ... }
}
Implementation
MockEnv should store a HashMap<String, MockToken> populated during build()
token() panics with a clear message if the symbol was not registered
token_opt() returns None gracefully
Acceptance Criteria
Summary
Tokens registered via
.with_token("USDC", 6)during builder configuration are inaccessible afterbuild()completes. Users must re-construct the token or store it before the builder is consumed.Proposed API
Implementation
MockEnvshould store aHashMap<String, MockToken>populated duringbuild()token()panics with a clear message if the symbol was not registeredtoken_opt()returnsNonegracefullyAcceptance Criteria
env.token("USDC")works afterwith_token("USDC", 6).build()MockToken::new()(separate code path)prelude