-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
put workflows jar on a bit of a diet
- Loading branch information
Showing
13 changed files
with
201 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
contracts/src/test/kotlin/com/r3/corda/lib/tokens/contracts/CommonTokens.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.r3.corda.lib.tokens.contracts | ||
|
||
import com.r3.corda.lib.tokens.contracts.types.TokenType | ||
import net.corda.core.contracts.Amount | ||
|
||
class CommonTokens { | ||
|
||
companion object { | ||
val USD = TokenType("USD", 2) | ||
val GBP = TokenType("GBP", 2) | ||
} | ||
|
||
} | ||
|
||
fun Number.ofType(tt: TokenType): Amount<TokenType> { | ||
return Amount(this.toLong(), tt) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,5 +46,4 @@ dependencies { | |
|
||
// CorDapp dependencies. | ||
cordapp project(":contracts") | ||
cordapp project(":modules:money") | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
include 'contracts' | ||
include 'workflows' | ||
include 'modules:money' | ||
include 'modules:contracts-for-testing' | ||
include 'modules:selection' | ||
findProject(':modules:money')?.name = 'money' | ||
include 'freighter-tests' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
workflows/src/main/kotlin/com/r3/corda/lib/tokens/money/DigitalCurrency.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.r3.corda.lib.tokens.money | ||
|
||
import com.r3.corda.lib.tokens.contracts.types.TokenType | ||
import java.util.* | ||
|
||
/** | ||
* A representation of digital money. This implementation somewhat mirrors that of [Currency]. | ||
* | ||
* Note that the primary constructor only exists for simple and convenient access from Java code. | ||
* | ||
* @param currencyCode The currency code that represents the TokenType which the developer wishes to instantiate. | ||
*/ | ||
class DigitalCurrency { | ||
companion object { | ||
private val registry = mapOf( | ||
Pair("XRP", TokenType("Ripple", 6)), | ||
Pair("BTC", TokenType("Bitcoin", 8)), | ||
Pair("ETH", TokenType("Ethereum", 18)), | ||
Pair("DOGE", TokenType("Dogecoin", 8)) | ||
) | ||
|
||
@JvmStatic | ||
fun getInstance(currencyCode: String): TokenType { | ||
return registry[currencyCode] ?: throw IllegalArgumentException("$currencyCode doesn't exist.") | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
workflows/src/main/kotlin/com/r3/corda/lib/tokens/money/FiatCurrency.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.r3.corda.lib.tokens.money | ||
|
||
import com.r3.corda.lib.tokens.contracts.types.TokenType | ||
import java.util.* | ||
|
||
/** | ||
* This class is used to return a [TokenType] with the required currency code and fraction digits for fiat currencies. | ||
* | ||
* Note that the primary constructor only exists for simple and convenient access from Java code. | ||
* | ||
* @param currencyCode The currency code that represents the TokenType which the developer wishes to instantiate. | ||
*/ | ||
class FiatCurrency { | ||
companion object { | ||
// Uses the java money registry. | ||
@JvmStatic | ||
fun getInstance(currencyCode: String): TokenType { | ||
val currency = Currency.getInstance(currencyCode) | ||
return TokenType(currency.currencyCode, currency.defaultFractionDigits) | ||
} | ||
} | ||
} |
Oops, something went wrong.