# ARB答案

By [小麻不算麻](https://paragraph.com/@0x184900a9e37fbafd2e07a386ae348ca4a853546b-2) · 2025-08-11

---

PHASE 2

生态概览 - Arbitrum
===============

B 在以太坊网络上实现快速且经济高效的交易

A Arbitrum One 和Arbitrum Nova

C 将以太坊的计算和存储转移至链下

C Optimistic Rollups

B 执行和管理 Arbitrum 链上的操作和状态

C 操作系统

B L1 资源费用和 L2 资源费用

D 以上所有

C 降低费用、增加容量和整体更快的体验

A

B 当前状态和下一笔交易

B 更新区块链的当前状态

B

C

A

B

A

A

C 直接使用 Geth 实现

C 创建一个被信任的小组，即数据可用性委员会

A 存储和管理区块链上的数据

B 数据块的哈希值、过期时间和签名证据

B Sequencer API和REST AP

A 数据提交、签名过程、创建和发布 DACert

B 数据的可用性

C 游戏和社交媒体应用

B 一个 Layer3 解决方案

C 允许使用任意 ERC-20 代币作为原生 gas 代币支付 gas

C 允许使用多种编程语言开发 EVM 兼容智能合约

A

B 编码、编译、执行、验证

C 提供更快的计算速度、更低的 gas 成本，并启用新的使用案例

C 两者都使用 Nitro 技术栈，但实现不同的协议

**Quiz 1**

ABC

Rust 开发入门
=========

A

B

let mut x = 1;

x += 2;

assert\_eq!(x, 3);

assert\_eq!(y, 2);

assert\_eq!(i8::MAX, 127);

assert\_eq!(u8::MAX, 255);

assert\_eq!(size\_of\_val(&c1),4);

assert\_eq!(size\_of\_val(&c2),4);

x + y

x + 2

fn sum(x: i32, y: i32) -> i32 {

A

A

B

let s2 = s1;

let y = &x;

let p = &mut s;

A

let slice2 = &s\[..2\];

let slice = &s\[0..3\];

B

s.push('!');

let slice = &s\[..5\];

let t: (u8, u16, i64, &str, String) = (1u8, 2u16, 3i64, "hello", String::from(", world"));

assert\_eq!(t.3, "rust");

let mut p = Person {

[p.name](http://p.name) = String::from("rust");

Direction::East => println!("Moving East"),

let arr: \[i32 ; 5\] = \[1, 2, 3, 4, 5\];

let arr: \[char; 3\] = \['中', 'b', 'c'\];

let list: \[i32; 100\] = \[1;100\] ;

let v2 = Vec::from(\[1, 2, 3\]);

\*i += 1

let mut student\_map2 = student\_arr.into\_iter().collect();

assert\_eq!(\*alice\_grade, 100);

for name in &names {

break

Message::Move{x: a, y: b} => {

assert\_eq!(g, 255);

assert\_eq!(b, 0);

fn new() -> Self { Mario { is\_small : false , coins : 100 , } }

x: T,

fn tweet(&self) -> String;

B

A

type AssociatedType = i32;

B

fn longest<'a>(x: &'a str, y: &'a str) -> &'a str {

let b = divide(a, a + num)?;

Ok(result) => println!("Result:{}", result),

A

macro\_rules!

A

derive

A

proc\_macro

A

[**Rust 实现猜数游戏**](https://www.hackquest.io/zh-cn/courses/ed7b0d3f-80ad-4604-bc17-151ee6cb38cb)

cargo new

cargo build

cargo run

cargo new bulls\_and\_cows

rand = "0.8"

use rand::Rng;

let secret\_number = rand::thread\_rng().gen\_range(1..11);

let mut attempts = 0;

use std::io;

let mut guess = String::new();

io::stdin().read\_line(&mut guess);

.expect("Oops! Something goes wrong");

loop

let guess = guess.trim();

let guess: u32 = match guess.trim().parse()

Ok(num) => num,

Err(\_) => { println!("Please input valid number"); continue; }

Ordering::Less

**实用工具 - Stylus**
=================

A

A

self.number.get()

self.number.set(new\_number);

A

#\[derive(Erase)\]

B

#\[external\]

A

#\[entrypoint\]

#\[payable\]

A

#\[borrow\]

B

cargo stylus export-abi

B

B

A

A

delegate\_call

A

A

evm::log

msg::sender()

A

A

A

A

cargo stylus check

\--estimate-gas-only

rustc -vV | grep host

A

**Quiz 1**

A

A

B

#\[payable\]

A

A

在 Arbitrum 上建设你的项目
==================

A

#!\[cfg\_attr(not(feature = "export-abi"), no\_main, no\_std)\]

extern crate alloc;

#\[global\_allocator\]

static ALLOC: wee\_alloc::WeeAlloc = wee\_alloc::WeeAlloc::INIT;

mod erc20;

use crate::erc20::{Erc20, Erc20Params};

use alloc::vec::Vec;

use stylus\_sdk::{alloy\_primitives::U256, msg, prelude::\*};

struct StylusERC20Params;

impl Erc20Params for StylusERC20Params {}

const NAME: &'static str = "ERC20 Example";

const SYMBOL: &'static str = "EE";

const DECIMALS: u8 = 18;

sol\_storage!

#\[entrypoint\]

#\[borrow\]

Erc20 erc20; #\[external\] #\[inherit(Erc20)\] impl StylusERC20 {} pub fn mint(&mut self, amount: U256) -> Result<(), Vec> {} self.erc20.mint(msg::sender(), amount); Ok(()) [**在 Arbitrum 上实现 NFT（Erc721）**](https://www.hackquest.io/zh-cn/courses/ff85f0dd-3986-4e4b-bacb-677aea8eff18) D #!\[cfg\_attr(not(any(feature = "export-abi", test)), no\_main)\] extern crate alloc; static ALLOC: wee\_alloc::WeeAlloc = wee\_alloc::WeeAlloc::INIT; use stylus\_sdk::{msg, prelude::\*}; mod erc721; use crate::erc721::{Erc721, Erc721Params}; struct StylusNFTParams; const NAME: &'static str = "StylusNFT"; const SYMBOL: &'static str = "SNFT"; 下面这是一个答案 impl StylusNFT { } 上面这是一个答案 #\[external\] #\[inherit(Erc721)\] sol\_storage! {} struct StylusNFT {} #\[entrypoint\] Erc721 erc721; #\[borrow\] uint256 counter; use alloy\_primitives::{Address, U256}; use erc721::{Erc721Error, NotAuthorized}; pub fn safe\_mint(&mut self, to: Address) -> Result<(), Erc721Error> {} let token\_id = self.counter.get(); self.erc721.\_safe\_mint(to, token\_id)?; let new\_value = token\_id + U256::from(1); self.counter.set(new\_value); Ok(()) [**Arbitrum Stylus 智能金库**](https://www.hackquest.io/zh-cn/courses/0e91b685-532a-4235-a737-d601695e0ec8) A #!\[cfg\_attr(not(feature = "export-abi"), no\_main, no\_std)\] extern crate alloc; #\[global\_allocator\] use crate::erc20::{Erc20, Erc20Params}; use alloc::vec::Vec; use stylus\_sdk::{alloy\_primitives::{U256, Address}, call, call::RawCall, msg, contract, function\_selector, prelude::\*}; impl Erc20Params for VaultParams const NAME: &'static str = "Vault Example"; const SYMBOL: &'static str = "VAULT"; const DECIMALS: u8 = 18; sol\_storage! #\[entrypoint\] struct Vault {} address asset; uint totalSupply; #\[borrow\] Erc20 erc20; #\[external\] #\[inherit(Erc20)\] impl Vault {} pub fn setAsset(&mut self, \_asset: Address) -> Result<Address, Vec> {} self.asset.set(\_asset); Ok(\_asset) #\[payable\] pub fn deposit(&mut self, amount: U256) -> Result<(), Vec> {} let selector = function\_selector!("transferFrom(address,address,uint256)"); let data = \[\]; &selector\[..\], &msg::sender().into\_array(), &self.asset.get().into\_array(), &amount.to\_be\_bytes::<32>(), .concat(); RawCall::new().call(self.asset.get(), &data); let supply = self.totalSupply.get(); let shares = if supply == U256::ZERO { amount } else { amount.checked\_mul(supply).ok\_or("Overflow")?.checked\_div(self.totalAssets()?).ok\_or("Divide by zero")?}; Ok(()) pub fn withdraw(&mut self, amount: U256) -> Result<(), Vec> {} let supply = self.totalSupply.get(); let shares = if supply == U256::ZERO {amount} else { amount.checked\_mul(supply).ok\_or("Overflow")?.checked\_div(self.totalAssets()?).ok\_or("Divide by zero")?}; self.erc20.burn(msg::sender(), shares)?; call::transfer\_eth(msg::sender(), amount) pub fn asset(&self) -> Result<Address, Vec> {} Ok(self.asset.get()) pub fn totalAssets(&self) -> Result<U256, Vec> {} Ok(self.totalSupply.get())

---

*Originally published on [小麻不算麻](https://paragraph.com/@0x184900a9e37fbafd2e07a386ae348ca4a853546b-2/arb)*
