内置合约
Conflux引入了几个内嵌的内置合约,以便更好地进行系统维护和链上治理。 Now Conflux has seven internal contracts: AdminControl
contract, SponsorWhitelistControl
contract and Staking
contract are introduced from the beginning, ConfluxContext
, PoSRegister
, ConfluxContext
are introduced at v2 hard-fork, ParamsControl
is introduced at v2.1 hard-fork. 这些合约提供了在这里
定义的solidity函数api。 这些函数只能通过CALL或STATICCALL操作来调用。 使用操作CALLCODE或DELEGATECALL与内部合约交互将触发错误。
这7个内置合约的地址如下所示:
- AdminControl:
0x0888000000000000000000000000000000000000
cfxtest:aaejuaaaaaaaaaaaaaaaaaaaaaaaaaaaaawby2s44d
cfx:aaejuaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2mhjju8k
- SponsorWhitelistControl:
0x0888000000000000000000000000000000000001
cfxtest:aaejuaaaaaaaaaaaaaaaaaaaaaaaaaaaaeprn7v0eh
cfx:aaejuaaaaaaaaaaaaaaaaaaaaaaaaaaaaegg2r16ar
- Staking:
0x0888000000000000000000000000000000000002
cfxtest:aaejuaaaaaaaaaaaaaaaaaaaaaaaaaaaajh3dw3ctn
cfx:aaejuaaaaaaaaaaaaaaaaaaaaaaaaaaaajrwuc9jnb
- ConfluxContext:
0x0888000000000000000000000000000000000004
cfxtest:aaejuaaaaaaaaaaaaaaaaaaaaaaaaaaaauv2xpkd3x
cfx:aaejuaaaaaaaaaaaaaaaaaaaaaaaaaaaau5xa6tk73
- PoSRegister:
0x0888000000000000000000000000000000000005
cfxtest:aaejuaaaaaaaaaaaaaaaaaaaaaaaaaaaaytypk0th1
cfx:aaejuaaaaaaaaaaaaaaaaaaaaaaaaaaaayf993ufd7
- CrossSpaceCall:
0x0888000000000000000000000000000000000006
cfxtest:aaejuaaaaaaaaaaaaaaaaaaaaaaaaaaaa2eaeg85p5
cfx:aaejuaaaaaaaaaaaaaaaaaaaaaaaaaaaa2sn102vjv
- ParamsControl:
0x0888000000000000000000000000000000000007
cfxtest:aaejuaaaaaaaaaaaaaaaaaaaaaaaaaaaa64p5db1w9
cfx:aaejuaaaaaaaaaaaaaaaaaaaaaaaaaaaa6uhjxh70z
此文档中的所有示例代码都将使用 js-conflux-sdk。
📄️ AdminControl
概览
📄️ SponsorWhitelistControl
Conflux实现了赞助机制,来补贴智能合约的使用。 This allows a new account with a zero balance to call smart contracts, provided the execution is sponsored (usually by the operator of Dapps). The internal SponsorWhitelistControl contract records the sponsorship information for smart contracts.
📄️ Staking
概览
📄️ ConfluxContext
这个合约可以用来查询Conflux网络信息,包括:
📄️ PoSRegister
这个合约用于让用户参与PoS链。 需要与这个合约交互才能成为PoS节点。 这个合约提供了几个方法来增加或减少PoS投票:
📄️ CrossSpaceCall
CrossSpaceCall 接口
📄️ ParamsControl
ParamsControl位于地址0x0888000000000000000000000000000000000007,具有以下接口。 它可以用来参与链参数投票。