SuperTransmuter

Git Source

Inherits: ISuperTransmuter, Transmuter, StateSyncer

Author: Zeropoint Labs.

SPDX-License-Identifier: Apache-2.0

This contract inherits from ERC1155A transmuter, changing the way transmuters are registered to only require a superformId. Metadata is fetched from underlying vault

State Variables

DEPLOY_NEW_TRANSMUTER

bytes32 constant DEPLOY_NEW_TRANSMUTER = keccak256("DEPLOY_NEW_TRANSMUTER");

xChainPayloadCounter

uint256 public xChainPayloadCounter;

Functions

onlyMinter

minters can be router with id 2 (or) state registry for that beacon

modifier onlyMinter(uint256 superformId) override;

onlyBatchMinter

if registry id is 2 (or) corresponding state registry can mint

minters can be router with id 2 (or) state registry for that beacon

modifier onlyBatchMinter(uint256[] memory superformIds) override;

onlyBurner

if registry id is 1 (or) corresponding state registry can mint

only routers with id 2 can burn sERC20

modifier onlyBurner() override;

constructor

constructor(
    IERC1155A superPositions_,
    address superRegistry_,
    uint8 routerType_
)
    Transmuter(superPositions_)
    StateSyncer(superRegistry_, routerType_);

Parameters

NameTypeDescription
superPositions_IERC1155Athe super positions contract
superRegistry_addressthe superform registry contract
routerType_uint8the router type

registerTransmuter

explicity revert on register transmuter

function registerTransmuter(uint256, string memory, string memory, uint8) external pure override returns (address);

registerTransmuter

this overrides registerTransmuter from original transmuter implementation so that users cannot insert name, symbol, and decimals

anyone can register a transmuter for an existent superform

function registerTransmuter(uint256 superformId_, bytes memory extraData_) external override returns (address);

Parameters

NameTypeDescription
superformId_uint256
extraData_bytesis an optional param to broadcast changes to all chains

mintSingle

broadcast and deploy to the other destination chains

function mintSingle(
    address srcSender_,
    uint256 id_,
    uint256 amount_
)
    external
    override(IStateSyncer, StateSyncer)
    onlyMinter(id_);

Parameters

NameTypeDescription
srcSender_addressis the beneficiary of shares
id_uint256is the id of the shares
amount_uint256is the amount of shares to mint

mintBatch

allows minter to mint shares on source in batch

function mintBatch(
    address srcSender_,
    uint256[] memory ids_,
    uint256[] memory amounts_
)
    external
    override(IStateSyncer, StateSyncer)
    onlyBatchMinter(ids_);

Parameters

NameTypeDescription
srcSender_addressis the beneficiary of shares
ids_uint256[]are the ids of the shares
amounts_uint256[]are the amounts of shares to mint

burnSingle

allows burner to burn shares on source

function burnSingle(
    address srcSender_,
    uint256 id_,
    uint256 amount_
)
    external
    override(IStateSyncer, StateSyncer)
    onlyBurner;

Parameters

NameTypeDescription
srcSender_addressis the address of the sender
id_uint256is the id of the shares
amount_uint256is the amount of shares to burn

burnBatch

allows burner to burn shares on source in batch

function burnBatch(
    address srcSender_,
    uint256[] memory ids_,
    uint256[] memory amounts_
)
    external
    override(IStateSyncer, StateSyncer)
    onlyBurner;

Parameters

NameTypeDescription
srcSender_addressis the address of the sender
ids_uint256[]are the ids of the shares
amounts_uint256[]are the amounts of shares to burn

stateMultiSync

note each allowance check in burn needs to pass. Since we burn atomically (on SuperformRouter level), if this loop fails, tx reverts right in the 1st stage

function stateMultiSync(AMBMessage memory data_)
    external
    override(IStateSyncer, StateSyncer)
    returns (uint64 srcChainId_);

Parameters

NameTypeDescription
data_AMBMessageis the received information to be processed.

Returns

NameTypeDescription
srcChainId_uint64is the decoded srcChainId.

stateSync

here we decode the txInfo and params from the data brought back from destination

decode remaining info on superPositions to mint from destination

decode initial payload info stored on source chain in this contract

verify this is a single vault mint

compare final shares beneficiary to be the same (dst/src)

compare txType to be the same (dst/src)

mint super positions accordingly

function stateSync(AMBMessage memory data_) external override(IStateSyncer, StateSyncer) returns (uint64 srcChainId_);

Parameters

NameTypeDescription
data_AMBMessageis the received information to be processed.

Returns

NameTypeDescription
srcChainId_uint64is the decoded srcChainId.

stateSyncBroadcast

here we decode the txInfo and params from the data brought back from destination

decode remaining info on superPositions to mint from destination

decode initial payload info stored on source chain in this contract

verify this is a multi vault mint

compare final shares beneficiary to be the same (dst/src)

compare txType to be the same (dst/src)

mint super positions accordingly

function stateSyncBroadcast(bytes memory data_) external payable override;

Parameters

NameTypeDescription
data_bytesis the crosschain payload

_broadcast

this function is only accessible through broadcast registry

interacts with broadcast state registry to broadcasting state changes to all connected remote chains

function _broadcast(bytes memory message_, bytes memory extraData_) internal;

Parameters

NameTypeDescription
message_bytesis the crosschain message to be sent.
extraData_bytesis the amb override information.

_deployTransmuter

ambIds are validated inside the broadcast state registry

broadcastParams if wrong will revert in the amb implementation

deploys new transmuter on broadcasting

function _deployTransmuter(bytes memory message_) internal;