跳转到主要内容
Stable 使用 gUSDT(未包装的 USDT0)作为燃料代币,因此您需要在钱包中有 gUSDT 才能与链进行交互。首先,您需要使用水龙头为您的账户充值 gUSDT。
  1. 访问 https://faucet.stable.xyz
  2. 点击”Get gUSDT”按钮,1 gUSDT 将被投放到您的钱包中。
如果您想要更多 gUSDT 或 USDT0,您可以从以太坊 Sepolia 将测试 USDT 桥接到 Stable 测试网。
  1. 访问 https://sepolia.etherscan.io/token/0xc4DCC311c028e341fd8602D8eB89c5de94625927#writeContract,通过调用 _mint 函数将所需数量的测试 Tether USD 铸造到您的账户中。
  2. 向以太坊 Sepolia 上的 LayerZero 桥接合约发送以下交易,将测试 USDT 桥接到 Stable 测试网:
    export function addrTo32Bytes(addr: string): Buffer {
      const hex20 = ethers.utils.getAddress(addr).slice(2);
      const padded = hex20.padStart(64, "0");      // 32 bytes ⇒ 64 hex
      return Buffer.from(padded, "hex");           // length === 32
    }
    
    async function main() {
      const [owner] = await ethers.getSigners();
    
      const SEPOLIA_USDT0 = "0xc4DCC311c028e341fd8602D8eB89c5de94625927";
      const SEPOLIA_USDT0_OAPP = "0xc099cD946d5efCC35A99D64E808c1430cEf08126"
      const RECEIVER_EID = 40374;
    
      const usdt0 = await ethers.getContractAt("ERC20", SEPOLIA_USDT0);
      await usdt0.approve(SEPOLIA_USDT0_OAPP, ethers.utils.parseEther("1"));
    
      const options = Options.newOptions().addExecutorLzReceiveOption(0, 0).toBytes();
      const amount = ethers.utils.parseEther("1"); // 将此更改为您所需的数量
      const OFTAdapter = await ethers.getContractAt("OFTAdapter", SEPOLIA_USDT0_OAPP);
    
      const sendParams = {
        dstEid: RECEIVER_EID,
        to: addrTo32Bytes(owner.address),
        amountLD: amount,
        minAmountLD: amount,
        extraOptions: options,
        composeMsg: Buffer.from(""),
        oftCmd: Buffer.from(""),
      };
      const fee = await OFTAdapter.quoteSend(sendParams, false);
      await OFTAdapter.send(
        sendParams,
        fee,
        owner.address,
        {
          value: fee.nativeFee,
        }
      )
    }
    
  3. 通过调用 OStableWrapper 合约 中的 depositTo 函数,将测试网 USDT0 解包为 gUSDT