kotlin - Corda 中的 Cash State 与 Fungible 代币
问题描述
Cash State和Fungible Token都可用于在 Corda 中表示货币。两者都可以发行、转让(移动)和赎回(退出)。
在分类账上表示货币的更合适的类型是什么?使用这两种类型有什么优点和缺点吗?
解决方案
我们已经在 (slack.corda.net) 上讨论过这个问题,您已经发现的简短回答是,可替代代币是代表货币等可替代资产的更好工具。
我们在 youtube 上有一个关于令牌 SDK 的训练营:https ://www.youtube.com/watch?v=IAViczRAEyU
以下是我们查看的有关 CorDapp 概念的一些文档,您将看到令牌是推荐的方法:https ://docs.corda.net/docs/corda-enterprise/4.7/cordapp-advanced-concepts.html #the-demo-finance-cordapp
您还可以在 GitHub 上找到一些清晰的开发人员示例:https ://github.com/corda/samples-java/tree/master/Tokens
大部分的困难将是修改你的状态并且只是改变你的流程来处理令牌:
// Preparing the token type of the paying fiat currency
Currency currency = Currency.getInstance(stockState.getCurrency());
TokenType dividendTokenType = new TokenType(currency.getCurrencyCode(), currency.getDefaultFractionDigits());
// Calculate the actual dividend paying to the shareholder
BigDecimal yield = stockState.getDividend().multiply(BigDecimal.valueOf(claimNoticication.getAmount().getQuantity()));
BigDecimal dividend = yield.multiply(stockState.getPrice()).multiply(BigDecimal.valueOf(Math.pow(10.0, currency.getDefaultFractionDigits())));
// Create the dividend state
Amount<TokenType> dividendAmount = new Amount(dividend.longValue(), dividendTokenType);
推荐阅读
- python - 带有元组的列表:将不重复的特定元素获取到新列表
- ruby-on-rails - 无法在 Windows 上运行 rails 的“瘦”服务器。无法加载 EventMachine C 扩展
- javascript - 如何允许 react-native 启用对 JSX(扩展)文件的支持
- python - 只读的django管理应用程序列表
- server - 在 Centos 6.9 上安装 GLIBCXX_3.4.15
- java - 格式错误的数据库 URL,无法解析主要 URL 部分
- java - 如何在后台程序上运行方法
- r - 如何将数据框转换为列表
- c - dlsym 在不同的文件中, dlopen 在不同的文件中
- json - JSON 数组和谷歌图表