Skip to content

Instantly share code, notes, and snippets.

@Ankarrr
Last active May 8, 2020 03:06
Show Gist options
  • Save Ankarrr/e4616af70286b548185de9200aa156f8 to your computer and use it in GitHub Desktop.
Save Ankarrr/e4616af70286b548185de9200aa156f8 to your computer and use it in GitHub Desktop.

uToken Test Tutorial

Contract Info

How to use?

Mint()

  1. Caller 要有 USDC
  2. Caller 呼叫 approve(address _spender, uint256 _value) of USDC,_spender 設定為 uUSDC contract address
  3. Caller 呼叫 mint(uint256 underlyingToSupply) of uUSDC,uUSDC 會從 caller 轉出數量為 underlyingToSupply 的 USDC,並發行數量為 underlyingToSupply * 0.9 的 uUSDC Token 給 caller

balanceOf()

  1. Caller 呼叫 balanceOf(address _tokenHolder) of uUSDC,可以查詢 address 的 餘額

transfer()

  1. Caller 呼叫 transfer(address recipient, uint256 amount) of uUSDC,可以 transfer amount token to recipient
@Ankarrr
Copy link
Author

Ankarrr commented May 8, 2020

  1. 流程 ok
  2. 模擬 0.1 是我們抽成,但實際上算法不是這樣
  3. 不用自己算,合約會算出目前價格。只要 call 一個類似 redeem() 的 method
  4. 對,沒意外的話。理論上 _value >= underlyingToSupply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment