ERC20 Swaps were designed by the developers in the Frictionless protocol to risk off permissionless stablecoins such as USDC or USDT.
Permissionless are a great innovation from the crypto markets which were designed for permissionless crypto referencing to US Dollars, however handling stablecoins for traditional institutional partners is still a risky proposition.
Using the ERC20 Converter contracts, FrictionlessFundDepositTokens can be converted to/from stablecoins using the Frictionless protocol to help Managers accept stablecoins whilst off-loading their associated risks, such as de-peg events, underlying community bank reliance and liquidity risks.
The PROTOCOL_TREASURY manages the on/off ramp of the ERC20 stablecoin, such as USDC/USDT within its fund structures of FRICTIONLESS MARKETS SECURITIES FT.
The availability of a valid configured ERC20 token for conversion to/from FrictionlessFundDepositToken along with the associated fees is transparent, any market participant may query the smart contract.
The principle of an ERC20 Swap is simple.
The PROTOCOL_ADMIN defines the valid token pairs which are convertible on a 1:1 basis.
Fees can be optionally defined for the conversion to/from the ERC20 token.
The holder (Investor) of ERC20 tokens invokes the convertFromERC20
function of the smart contract, the ERC20 tokens are sent to the PROTOCOL_TREASURY and a matching amount of FrictionlessFundDepositToken is minted and sent to the holder (Investor).
If the Investor wishes to convert their FrictionlessFundDepositToken to a valid configured ERC20 token, such as USDC/USDT, then they can invoke the convertToERC20
function of the smart contract. In this case, the PROTOCOL_TREASURY will receive the FrictionlessFundDepositToken and burn it, transferring the matching amount of ERC20 (less any fees) to the Investor.
An example of two live ERC20 swaps on the Avalanche C-Chain are;
In these swaps, you can observe the collection of optional fees and the atomic settlement of the swap of the fsUSD tokens with USDC into the PROTOCOL_TREASURY.
Inherits: IAbstractFeeModule
Author: DEFYCA Labs S.Ã .r.l
Copyright © 2023 DEFYCA Labs S.à .r.l Permission is hereby granted, free of charge, to any person obtaining a copy of the Frictionless protocol smart contracts (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DEFYCA LABS S.à .r.l BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Interface defining the frictionless conversion and atomic swapping of ERC-20 tokens for FrictionlessFundDepositToken
on the Frictionless protocol. The conversion of tokens is considered frictionless as the protocol does not impose any fee structures on the conversion itself.
See {PausableUpgradeable-_pause}
See {PausableUpgradeable-_unpause}
Set the conversion fees for the token pair. The fees can be any combination of zero (0%) or upto 10000 bps (100%) on any directional transfer. Fees can only be set by the Owner (PROTOCOL_ADMIN).
Parameters
Set the conversion fees for the token pair using the tokenFeeKey_. The fees can be any combination of zero (0%) or upto 10000 bps (100%) on any directional transfer. Fees can only be set by the Owner (PROTOCOL_ADMIN).
Parameters
Removes the conversion fees for the token pair using the tokenFeeKey_. Fees can only be set by the Owner (PROTOCOL_ADMIN).
Parameters
Sets the mapping for the convertible tokens in the contract, calling this will add a new conversion pair to the contract.
Parameters
Converts from an ERC20 token to a FrictionlessFundDepositToken
, using the safe precision conversion. The ERC20 token is transferred to configured treasuryAddress in the conversion and the minted FrictionlessFundDepositToken
is sent to the msg.sender
Parameters
Converts from an ERC20 token to a FrictionlessFundDepositToken
, using the safe precision conversion. The ERC20 token is transferred to configured treasuryAddress in the conversion and the minted FrictionlessFundDepositToken
is sent to the convertedTokensRecipient_
Parameters
Returns
Converts to an ERC20 token from a FrictionlessFundDepositToken, using the safe precision conversion. The FrictionlessFundDepositToken is burned in the conversion and the ERC20 is sent to the msg.sender
from the treasuryAddress.
Parameters
Returns
Converts to an ERC20 token from a FrictionlessFundDepositToken
, using the safe precision conversion. The FrictionlessFundDepositToken is burned in the conversion and the ERC20 is sent to the convertedTokensRecipient_ from the treasuryAddress.
Parameters
Returns
Returns the FrictionlessTokensConvertInfo
for the given conversion key
Parameters
Returns
Returns the conversion keys for the given tokenAddr_
Parameters
Returns
Returns the count of conversion keys for the given tokenAddr_
Parameters
Returns
Returns the FrictionlessTokensConvertInfo
for the given tokenAddr_
Parameters
Returns
Returns true if the token specified by the tokenAddr_
has been registered as a valid convertible pair.
Parameters
Returns
Returns true if the token pair specified have been registered as a valid convertible pair.
Parameters
Returns
Returns true if the conversion key is supported.
Parameters
Returns
Returns the conversion key for the given token pair.
Parameters
Returns
Event emitted when a successful conversion occurs between an ERC20 and a FrictionlessFuncDepositToken.
thrown during addFrictionlessTokensConvertInfo
if the tokensConvertInfoArr_ contains zero addresses
thrown during addFrictionlessTokensConvertInfo
if the tokensConvertInfoArr_ cannot be updated
thrown during a convert to/from an ERC20 if the conversion resolves to zero
thrown during a convert to/from an ERC20 if the conversion is attempted for the same token
thrown if the IFrictionlessERC20ConverterManager
is configured as a zero address
Struct to represent the conversion between an ERC20 token and a FrictionlessFundDepositToken
on the Frictionless protocol
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|