The home for Hyperlane core contracts, sdk packages, and other infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
hyperlane-monorepo/solidity/optics-xapps
James Prestwich e5f8ed6515
feature: add verify scripts for more networks (#702)
3 years ago
..
contracts Final Contract Cleaning + Renaming (#698) 3 years ago
interfaces/bridge feature: allow custom token representations (#511) 3 years ago
.env.example verify improvements: add hardhat clean & .env.example (#574) 3 years ago
.eslintrc.json Refactor/rename optics-bridge directory to optics-xapps/token-bridge (#319) 4 years ago
.gitignore Fresh deploy (#556) 3 years ago
.prettierrc Refactor/rename optics-bridge directory to optics-xapps/token-bridge (#319) 4 years ago
.solcover.js Refactor/rename optics-bridge directory to optics-xapps/token-bridge (#319) 4 years ago
.solhint.json Refactor/rename optics-bridge directory to optics-xapps/token-bridge (#319) 4 years ago
.solhintignore Refactor/rename optics-bridge directory to optics-xapps/token-bridge (#319) 4 years ago
README.md Refactor/rename optics-bridge directory to optics-xapps/token-bridge (#319) 4 years ago
hardhat.config.ts feature: add verify scripts for more networks (#702) 3 years ago
package-lock.json fix: solidity/optics-xapps/package.json & solidity/optics-xapps/package-lock.json to reduce vulnerabilities (#664) 3 years ago
package.json feature: add verify scripts for more networks (#702) 3 years ago
tsconfig.json Fresh deploy (#556) 3 years ago

README.md

Optics Token Bridge

Message Format

Bridge messages follow the following format:

TokenID (36 bytes)
    -  4 bytes - domain specifier
    - 32 bytes - id (address) on that domain

Actions (variable)
    EITHER
    - Transfer (64 bytes)
        - 32 bytes - to. local recipient
        - 32 bytes - amount. number of tokens to send
    - Details
        - 32 bytes - name. new name of token
        - 32 bytes - symbol. new symbol for token
        -  1 byte  - decimals. new decimal place count

Message (100 or 101 bytes)
    - TokenID (36 bytes)
    - Action  (64 or 65 bytes)

Given a message we know the following:

  • the TokenID is at indices 0-35
    • 0 - 3 Domain
    • 4 - 35 Id
  • the Action is at indices 36 - end.
    • the action type can be determined from the message length alone.
    • for Transfer actions
      • 36 - 67 To
      • 68 - 99 Amount
    • for Details actions
      • 36 - 67 Name
      • 68 - 99 Symbol
      • 100 Decimals