Skip to content

[FEATURE] Implement a new HTSConnector version for Stargate. StargateConnector #3957

@Ferparishuertas

Description

@Ferparishuertas

Stargate has released a new version v2, and a concept of hydra tokens. To be able to bridge WEth, USDC and USDT ( called hydra tokens) we need to implement the StargateHTSConnector

The difference between the existing connector and the new connector, is that we need to implement aside debit and credit, inflow and outflow to be compatible with startgate.

The idea is to release a Stargate Connector, which include this extra function, and implement an end to end test with a Weth in Testnet, following the crosschain bridge strategy we did for stargate

The methods to implement and adapt to HTS like credit and debit to enable HTS compatibilty are the following

https://github.com/stargate-protocol/stargate-v2/blob/main/packages/stg-evm-v2/src/StargateOFT.sol

/// @notice Burn tokens to represent their removal from the local chain
/// @param _from The address to burn tokens from
/// @param _amount How many tokens to burn in LD
/// @return amountSD The amount burned in SD
function _inflow(address _from, uint256 _amount) internal virtual override returns (uint64 amountSD) {
amountSD = _ld2sd(_amount);
IERC20Minter(token).burnFrom(_from, _sd2ld(amountSD)); // remove dust and burn
}

/// @notice Mint tokens to represent their lading into the local chain
/// @param _to The account to mint tokens for
/// @param _amount The amount of tokens to mint
/// @return success Whether the minting was successful
function _outflow(address _to, uint256 _amount) internal virtual override returns (bool success) {
try IERC20Minter(token).mint(_to, _amount) {
success = true;
} catch {} // solhint-disable-line no-empty-blocks
}
** Support **

For any support or inquiry pls ask Ali/Fer

References

https://stargateprotocol.gitbook.io/stargate/v2-developer-docs
https://github.com/stargate-protocol

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions