Wrapping For Developers

Other smart contracts can mint and burn tokens. Each action issues an actionId for tracking.

How to Mint

address wrappedUSDC = 0x03297A859fc70889E6132b6be9DD31c1d3edb9c7;
uint256 vetValue = 1000 ether; // equals 1000 VET

// initiate mint for the given token address
// the value of VET send will be used
bytes32 actionId = IBridge(0xb7A0A71eCb799c87C1eafb7c2946FE80505a3086).mintToken{value: vetValue}(wrappedUSDC);
You can get an estimated result from the API at:
https://bridge.vet/api/estimate/mint/:tokenAddress/?value=:vetValue

How to Burn

address wrappedUSDC = 0x03297A859fc70889E6132b6be9DD31c1d3edb9c7;
uint256 wrappedAmount = 1000 ether; // equals 1000 wUSDC

// initiate burn for defining given token address and the number of tokens to burn
// an approval to transfer the tokens is required first
IERC20(wrappedUSDC).approve(0xb7A0A71eCb799c87C1eafb7c2946FE80505a3086, wrappedAmount);
bytes32 actionId = IBridge(0xb7A0A71eCb799c87C1eafb7c2946FE80505a3086).burnToken(wrappedUSDC, wrappedAmount);
You can get an estimated result from the API at:
https://bridge.vet/api/estimate/burn/:tokenAddress/?value=:tokenAmount

Status Information

The values returned from actions(actionId) represent these:
  1. user: the address that started the action
  2. value: the VET value used in the action
  3. token: the address of the token being (un)wrapped
  4. status: 0 = open, 1 = pending, 2 = cancelled, 3 = fulfilled
  5. extraData: additional details for status tracking
You can get the status from the API at:
  1. https://bridge.vet/api/status/actionId/:actionId
  2. https://bridge.vet/api/status/txId/:txId

Contract Interface

pragma solidity >=0.7.0 <0.9.0;

// Address: 0xb7A0A71eCb799c87C1eafb7c2946FE80505a3086
interface IBridge {
    // available actions
    function mintToken( address token ) external payable returns (bytes32 actionId);
    function burnToken( address token, uint256 tokenAmount ) external payable returns (bytes32 actionId);
    function cancelAction( bytes32 actionId ) external payable;

    // insight
    function actions( bytes32  ) external view returns (address user,  uint256 value,  address token,  uint256 tokenAmount,  uint256 status,  string memory extraData) ;
    function openOrPendingActions( uint256  ) external view returns (bytes32 ) ;
    function supportedTokens( address  ) external view returns (bool ) ;

    // tracking status and insights
    event BurnFulfillment( bytes32 indexed actionId, address indexed tokenAddress, address indexed minter, uint256 tokenAmount, uint256 value ) ;
    event BurnRequest( bytes32 indexed actionId, address indexed tokenAddress, address indexed user, uint256 tokenAmount ) ;
    event MintFulfillment( bytes32 indexed actionId, address indexed tokenAddress, address indexed minter, uint256 value, uint256 tokenAmount ) ;
    event MintRequest( bytes32 indexed actionId, address indexed tokenAddress, address indexed user, uint256 value ) ;
}