美文网首页
Bancor ContractRegistry

Bancor ContractRegistry

作者: 坠叶飘香 | 来源:发表于2018-09-07 15:52 被阅读0次

1. ContractRegistry:

维护合约名字和合约地址的对应关系,这样其他合约通过合约名字访问时,可以得到最新的合约地址

mapping (bytes32 => RegistryItem) private items;    // name -> RegistryItem mapping
string[] public contractNames;                      // list of all registered contract names
registerAddress

2.ContractIds:

定义了维护在ContractRegistry的合约的名字


ContractIds

3.BNT项目

ContractRegistry:https://etherscan.io/address/0x7148b1c9154bcf273a2c7d7b90e3edc6fee395e6

3.1.注册ContractFeatures到ContractRegistry

在别的合约需要访问ContractFeatures时可以通过以下方式访问:

IContractFeatures features = IContractFeatures(registry.addressOf(ContractIds.CONTRACT_FEATURES));

https://etherscan.io/tx/0x3038ae4bb59e841f153fe8c0dce617dfbba149c3c90576416f089152044de859

注册ContractFeatures
3.2. 注册BancorNetwork到ContractRegistry

在别的合约需要访问BancorNetwork时可以通过以下方式访问:

IBancorNetwork bancorNetwork = IBancorNetwork(registry.addressOf(ContractIds.BANCOR_NETWORK));

https://etherscan.io/tx/0x74ea2dd002c30d028c74b6d45bc83af0fe267afb552ad694b23b90d7a7f2648a

注册BancorNetwork
3.3. 注册BancorFormula到ContractRegistry

在别的合约需要访问BancorFormula时,可以通过以下方式访问:

IBancorFormula formula = IBancorFormula(registry.addressOf(ContractIds.BANCOR_FORMULA));

https://etherscan.io/tx/0x2af09023e2184b42fcfa8cd6263fb704b0781c886af354e4ef880880c1c36001

注册BancorFormula

相关文章

网友评论

      本文标题:Bancor ContractRegistry

      本文链接:https://www.haomeiwen.com/subject/ocscgftx.html