Skip to content

Commit e164a09

Browse files
authored
Merge pull request #122 from renproject/feat/support-dai
DAI support
2 parents 3ff3e87 + 2da9f21 commit e164a09

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

multichain.go

+10-6
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ const (
115115
SOL = Asset("SOL") // Solana
116116
ZEC = Asset("ZEC") // Zcash
117117

118+
DAI = Asset("DAI") // Dai
118119
REN = Asset("REN") // Ren
119120
USDC = Asset("USDC") // Circle USD
120121

@@ -138,13 +139,14 @@ const (
138139
type AssetType string
139140

140141
const (
141-
// AssetTypeNative is an identifier for all the native assets of account based
142-
// chains namely. For instance, ETH for Ethereum, BNB for BinanceSmartChain.
142+
// AssetTypeNative is an identifier for all the native assets of account
143+
// based chains namely. For instance, ETH for Ethereum, BNB for
144+
// BinanceSmartChain.
143145
AssetTypeNative = AssetType("NativeAsset")
144146

145147
// AssetTypeToken is an identifier for all tokens (ERC20, BEP20) deployed on
146-
// programmable account-based chains. For instance, REN is an ERC-20 token on
147-
// Ethereum, USDC is an ERC-20 token on Ethereum.
148+
// programmable account-based chains. For instance, REN and USDC are ERC-20
149+
// tokens on Ethereum.
148150
AssetTypeToken = AssetType("TokenAsset")
149151
)
150152

@@ -180,6 +182,8 @@ func (asset Asset) OriginChain() Chain {
180182
return BinanceSmartChain
181183
case BTC:
182184
return Bitcoin
185+
case DAI:
186+
return Ethereum
183187
case DGB:
184188
return DigiByte
185189
case DOGE:
@@ -230,7 +234,7 @@ func (asset Asset) ChainType() ChainType {
230234
switch asset {
231235
case BCH, BTC, DGB, DOGE, ZEC:
232236
return ChainTypeUTXOBased
233-
case ArbETH, AVAX, BNB, ETH, FIL, FTM, GLMR, LUNA, MATIC, REN, SOL, USDC:
237+
case ArbETH, AVAX, BNB, ETH, DAI, FIL, FTM, GLMR, LUNA, MATIC, REN, SOL, USDC:
234238
return ChainTypeAccountBased
235239

236240
case KETH, GETH:
@@ -254,7 +258,7 @@ func (asset Asset) Type() AssetType {
254258
switch asset {
255259
case ArbETH, AVAX, BNB, ETH, FTM, GLMR, MATIC, SOL:
256260
return AssetTypeNative
257-
case REN, USDC:
261+
case DAI, REN, USDC:
258262
return AssetTypeToken
259263

260264
case KETH, GETH:

multichain_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@ var _ = Describe("Multichain", func() {
212212
asset multichain.Asset
213213
chain multichain.Chain
214214
}{
215+
{
216+
multichain.DAI,
217+
multichain.Ethereum,
218+
},
215219
{
216220
multichain.REN,
217221
multichain.Ethereum,

0 commit comments

Comments
 (0)