solution: erc20 tokens config

This commit is contained in:
Igor Artamonov
2020-07-03 00:06:48 -04:00
parent 61f07b8b43
commit 6dbe8b96ec
6 changed files with 184 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
/**
* Copyright (c) 2020 EmeraldPay, Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.emeraldpay.dshackle.config
import io.emeraldpay.grpc.Chain
import spock.lang.Specification
class TokensConfigReaderSpec extends Specification {
TokensConfigReader reader = new TokensConfigReader()
def "Read basic"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("tokens/basic.yaml")
when:
def act = reader.read(config)
then:
act != null
act.tokens.size() == 2
with(act.tokens[0]) {
id == "dai"
blockchain == Chain.ETHEREUM
name == "DAI"
type == TokensConfig.Type.ERC20
address == "0x6B175474E89094C44Da98b954EedeAC495271d0F"
}
with(act.tokens[1]) {
id == "tether"
blockchain == Chain.ETHEREUM
name == "Tether"
type == TokensConfig.Type.ERC20
address == "0xdac17f958d2ee523a2206206994597c13d831ec7"
}
}
}

View File

@@ -0,0 +1,11 @@
tokens:
- id: dai
blockchain: ethereum
name: DAI
type: ERC-20
address: 0x6B175474E89094C44Da98b954EedeAC495271d0F
- id: tether
blockchain: ethereum
name: Tether
type: ERC-20
address: 0xdac17f958d2ee523a2206206994597c13d831ec7