Skip to content

Commit

Permalink
Merge branch 'dev' into 'master'
Browse files Browse the repository at this point in the history
Dev

See merge request ergo/rosen-bridge/contract!118
  • Loading branch information
zargarzadehm committed Oct 14, 2024
2 parents d69957a + 58c2ed5 commit 4a79da8
Show file tree
Hide file tree
Showing 18 changed files with 181 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ jobs:
if: github.ref_type == 'tag'
run: |
ROSEN=$(find . -name 'contract-rosen-bridge-*.jar')
java -jar $ROSEN all --version ${{ github.ref_name }}
java -jar $ROSEN all
- name: Upload JSON files
uses: softprops/action-gh-release@v1
Expand Down
8 changes: 7 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,17 @@ libraryDependencies ++= Seq(

name := "contract"
ThisBuild / scalaVersion := "2.12.7"
ThisBuild / version := "3.3.0"
ThisBuild / version := "3.4.0"
ThisBuild / organization := "rosen.bridge"
ThisBuild / organizationName := "rosen-bridge"
ThisBuild / publishMavenStyle := true
Test / publishArtifact := false

assembly / assemblyJarName := s"${name.value}-${organizationName.value}-${version.value}.jar"

lazy val root = (project in file(".")).
enablePlugins(BuildInfoPlugin).
settings(
buildInfoKeys := Seq[BuildInfoKey](name, ThisBuild / version, ThisBuild / scalaVersion),
buildInfoPackage := "info"
)
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ logLevel := Level.Warn

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.0.0")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0")
11 changes: 11 additions & 0 deletions src/main/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,17 @@ networks = {
idKey = "tokenId"
}
ethereum = {
public-launch = {
tokens = {
RWTId="f5985c64c1aa8f08569dc77a046f65f92947abaa9ccd530aead033eece23496e"
CleanupNFT="65ff93c34ea34436fd954d14e8b9bb0672b2951449b34f20817155a5a613845b"
AwcNFT="7541ef3422c56f5d65b6c39e30fddd135f9c989c4b61e26c5ae98ee0ea6f75d7"
RepoConfigNFT="9a92751aba5279affeca331af97d20873992baceb0c584197c1c0efed1f4dfbe"
}
lock-address="0x451698faa07fc68301af622a3ad42205f13c6e4b"
cold-address=""
cleanup-confirm = 21600
}
loen = {
tokens = {
RWTId="2a4ed39265dc9454565c681323dcb06a8e46bb52f49c146b2c2f9bfb99c93208"
Expand Down
8 changes: 7 additions & 1 deletion src/main/scala/helpers/Utils.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package helpers

import io.circe.Json
import org.ergoplatform.ErgoAddressEncoder
import org.ergoplatform.appkit.ErgoContract
import rosen.bridge.{Contracts, TokensMap}
Expand Down Expand Up @@ -29,7 +30,12 @@ object Utils {
val fileType = conf ++ ".json"
val tokensMap = TokensMap.readTokensFromFiles(Configs.tokensMapDirPath, List(fileType))
val idKeys = TokensMap.createIdKeysJson()
TokensMap.createTokensMapJsonFile(tokensMap.deepMerge(idKeys).toString(), conf, networkVersion)
val tokensMapJson = tokensMap.deepMerge(
idKeys
).deepMerge(
Json.fromFields(List(("version", Json.fromString(networkVersion))))
).toString()
TokensMap.createTokensMapJsonFile(tokensMapJson, conf, networkVersion)
println(s"Json of TokensMap created for network type $conf!")
}
})
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/rosen/bridge/Contracts.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import helpers.{Network, NetworkGeneral, Utils}
import org.ergoplatform.appkit.{ConstantsBuilder, ErgoContract}
import scorex.util.encode.{Base16, Base64}
import io.circe.Json

import java.io.PrintWriter
import scala.io.{BufferedSource, Source}

Expand Down Expand Up @@ -47,6 +46,7 @@ class Contracts(networkGeneral: NetworkGeneral, networkConfig: Network) {
def createContractsJson(networkName: String, networkType: String, networkVersion: String): Unit = {
val result = {
Json.fromFields(List(
("version", Json.fromString(networkVersion)),
("addresses", this.toJsonAddresses(networkName)),
("tokens", networkConfig.tokens.toJson().deepMerge(networkGeneral.mainTokens.toJson())),
("cleanupConfirm", Json.fromInt(networkConfig.cleanupConfirm))
Expand Down
16 changes: 9 additions & 7 deletions src/main/scala/rosen/bridge/Main.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package rosen.bridge

import info.BuildInfo
import helpers.Utils
import scopt.OptionParser

Expand Down Expand Up @@ -30,7 +31,7 @@ object RosenContractsExecutor extends App {
opt[String]('v', "version")
.action((x, c) => c.copy(networkVersion = x))
.text("Contracts file version")
.required()
.optional()
)

cmd("tokens")
Expand All @@ -45,7 +46,7 @@ object RosenContractsExecutor extends App {
opt[String]('v', "version")
.action((x, c) => c.copy(networkVersion = x))
.text("tokens file version")
.required()
.optional()
)

cmd("all")
Expand All @@ -60,25 +61,26 @@ object RosenContractsExecutor extends App {
opt[String]('v', "version")
.action((x, c) => c.copy(networkVersion = x))
.text("files version")
.required()
.optional()
)

help("help").text("prints this usage text")
}

parser.parse(args, Config()) match {
case Some(config) =>
val networkVersion = if (config.networkVersion.nonEmpty) config.networkVersion else BuildInfo.version
if (config.mode == "contracts") {
Utils.createContracts(config.networkVersion, config.networkName, config.networkType)
Utils.createContracts(networkVersion, config.networkName, config.networkType)
System.exit(0)
}
else if (config.mode == "tokens") {
Utils.createTokenMap(config.networkVersion, config.networkType)
Utils.createTokenMap(networkVersion, config.networkType)
System.exit(0)
}
else if (config.mode == "all") {
Utils.createContracts(config.networkVersion, networkType = config.networkType)
Utils.createTokenMap(config.networkVersion, config.networkType)
Utils.createContracts(networkVersion, networkType = config.networkType)
Utils.createTokenMap(networkVersion, config.networkType)
System.exit(0)
}

Expand Down
9 changes: 9 additions & 0 deletions tokensMap/Ada.mainnet-public-launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,14 @@
"type": "native",
"residency": "native"
}
},
"ethereum": {
"tokenId": "0x9ea8c7d432b2c4a5095f32a3092a7f513e7c19b1",
"name": "rsADA",
"decimals": 6,
"metaData": {
"type": "ERC-20",
"residency": "wrapped"
}
}
}
9 changes: 9 additions & 0 deletions tokensMap/BTC.mainnet-public-launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,14 @@
"type": "native",
"residency": "native"
}
},
"ethereum": {
"tokenId": "0xd753cd1f5cb336aec4836dc7269bc45ea8607fbc",
"name": "rsBTC",
"decimals": 8,
"metaData": {
"type": "ERC-20",
"residency": "wrapped"
}
}
}
9 changes: 9 additions & 0 deletions tokensMap/COMET.mainnet-public-launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,14 @@
"type": "CIP26",
"residency": "wrapped"
}
},
"ethereum": {
"tokenId": "0x725dcf18e942e7d5b4696f7a2490cc48334a9d67",
"name": "rsCOMET",
"decimals": 0,
"metaData": {
"type": "ERC-20",
"residency": "wrapped"
}
}
}
32 changes: 32 additions & 0 deletions tokensMap/CTT.mainnet-loen.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"ergo": {
"tokenId": "5a378c69d47182f2a28969295e5dd1afdfb88d4b0452da5f2ff09e38ecae48c2",
"name": "CTT-loen",
"decimals": 4,
"metaData": {
"type": "EIP-004",
"residency": "native"
}
},
"cardano": {
"tokenId": "3122541486c983d637e7ed9330c94e490e1fe4a1758725fab7f6d9e0.72734354542d6c6f656e",
"policyId": "3122541486c983d637e7ed9330c94e490e1fe4a1758725fab7f6d9e0",
"assetName": "72734354542d6c6f656e",
"name": "rsCTT-loen",
"decimals": 4,
"metaData": {
"type": "CIP26",
"residency": "wrapped"
}
},
"ethereum": {
"tokenId": "0x1d88c3493d56a1a5f976b3bcd1bcd8aeba786f47",
"name": "rsCTT-loen",
"decimals": 4,
"metaData": {
"type": "ERC-20",
"residency": "wrapped"
}
}
}

9 changes: 9 additions & 0 deletions tokensMap/Erg.mainnet-public-launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,14 @@
"type": "CIP26",
"residency": "wrapped"
}
},
"ethereum": {
"tokenId": "0x6c060ba738af39a09f3b45ac6487dfc9ebb885f6",
"name": "rsERG",
"decimals": 9,
"metaData": {
"type": "ERC-20",
"residency": "wrapped"
}
}
}
31 changes: 31 additions & 0 deletions tokensMap/Eth.mainnet-public-launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"ethereum": {
"tokenId": "eth",
"name": "ETH",
"decimals": 18,
"metaData": {
"type": "native",
"residency": "native"
}
},
"cardano": {
"tokenId": "77a846ea2b33ad1711cdb957f84688403acb61e87cb861ef25cda7d6.7273455448",
"policyId": "77a846ea2b33ad1711cdb957f84688403acb61e87cb861ef25cda7d6",
"assetName": "7273455448",
"name": "rsETH",
"decimals": 9,
"metaData": {
"type": "CIP26",
"residency": "wrapped"
}
},
"ergo": {
"tokenId": "203ef3066a912f35c488487cc2cb94bdb0d30680dab22551c7e6fdbc70dfcc8e",
"name": "rsETH",
"decimals": 9,
"metaData": {
"type": "EIP-004",
"residency": "wrapped"
}
}
}
9 changes: 9 additions & 0 deletions tokensMap/HOSKY.mainnet-public-launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,14 @@
"type": "CIP26",
"residency": "native"
}
},
"ethereum": {
"tokenId": "0x0f068432e1a1c6574fad1bc8ff751b76d5f95d43",
"name": "rsHOSKY",
"decimals": 0,
"metaData": {
"type": "ERC-20",
"residency": "wrapped"
}
}
}
9 changes: 9 additions & 0 deletions tokensMap/RSN.mainnet-public-launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,14 @@
"type": "CIP26",
"residency": "wrapped"
}
},
"ethereum": {
"tokenId": "0xd207d3228ad136d56523ffbf04ee27062da82884",
"name": "rsRSN",
"decimals": 3,
"metaData": {
"type": "ERC-20",
"residency": "wrapped"
}
}
}
9 changes: 9 additions & 0 deletions tokensMap/SPF.mainnet-public-launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,14 @@
"type": "CIP26",
"residency": "wrapped"
}
},
"ethereum": {
"tokenId": "0x5d4d4e1ab6f66dd2239f3a83412a7e3fcaaee487",
"name": "rsSPF",
"decimals": 6,
"metaData": {
"type": "ERC-20",
"residency": "wrapped"
}
}
}
9 changes: 9 additions & 0 deletions tokensMap/SigRSV.mainnet-public-launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,14 @@
"type": "CIP26",
"residency": "wrapped"
}
},
"ethereum": {
"tokenId": "0xe90f17b6d888bc986609eb9607556894a165e2dc",
"name": "rsSigRSV",
"decimals": 0,
"metaData": {
"type": "ERC-20",
"residency": "wrapped"
}
}
}
9 changes: 9 additions & 0 deletions tokensMap/SigUSD.mainnet-public-launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,14 @@
"type": "CIP26",
"residency": "wrapped"
}
},
"ethereum": {
"tokenId": "0xe4d00106b3b9c27b59b7f752417d00f6a8517019",
"name": "rsSigUSD",
"decimals": 2,
"metaData": {
"type": "ERC-20",
"residency": "wrapped"
}
}
}

0 comments on commit 4a79da8

Please sign in to comment.