Wrapped USD
Search
K
Links
Comment on page

WUSD

WUSD is fundamentally an ERC20 token. However, it is extended to enable its wrapping of fiatcoins as well as to facilitate the connection to GLO and its unique credit system.

General

Name
Ticker
Decimals
Wrapped USD
WUSD
18

Functions

The extensions, and their implementations, are largely self-explanatory.

snapshot ()

This returns a struct with information about WUSD's current state.
Name
Meaning
cumulative
Cumulative total amount of all fiatcoins wrapped since deployment
last
The value of cumulative recorded when the last epoch completed
epoch
Count of every wrap() where cumulative - last ≥ 100K was true
  • epoch's count starts at 1, not 0
  • last and cumulative are scaled as 1e18

epochOf (account)

Returns the specific epoch in which account executed their last (un)wrap() provided they had executed, at least once, a wrap() for an amount of fiatcoins that created at least 100 WUSD.
If epochOf() returns 0 then it means one of the following is true:
  • the account never wrapped
  • the account wrapped but has unwrapped all their WUSD
  • the account wrapped but never did it once where at least 100 WUSD was created

wrap (fiatcoin, amount, referrer)

Wraps some amount of fiatcoin via referrer's frontend.
Name
Meaning
fiatcoin
Address of the fiatcoin to be wrapped into WUSD
amount
Amount fiatcoin to be wrapped, decimals of fiatcoin included
referrer
Address of registered frontend used for the transaction or 0 address
A service fee of 1% of amount — or 1 fiatcoin, whichever is higher — is paid. For amounts >=100, the caller starts earning GLO credit and, should the caller's address have fewer than 2 GLO, gets sent some GLO up to a cap of 2 total per address.
The referral units earned by referrer is 1:1 the (normalized) amount of fiatcoin being wrapped. As such, it represents the most effective means to earn said units which convert to GLO credit.
  • amount > 0 must be true
  • The caller must approve WUSD to spend their fiatcoin

unwrap (fiatcoin, amount)

Unwraps some amount of fiatcoin claims earned GLO credit.
Name
Meaning
fiatcoin
Address of the fiatcoin to receive for unwrapping WUSD
amount
Amount of WUSD to be unwrapped
The GLO credit claimed is the lesser of amount / WUSD balance and +1% per epoch since the last (un)wrap().
If the full balance is unwrapped i.e. amount = WUSD balance, any uncredited GLO in the wallet is forfeited.
  • amount > 0 must be true
  • The caller must approve WUSD to spend their WUSD
  • WUSD must have a balance of at least (redenominated) amount + 1 fiatcoin