2023-03-30 06:51:48 +00:00
|
|
|
# Solidity API
|
|
|
|
|
2023-07-31 05:21:15 +00:00
|
|
|
## NotImplemented
|
2023-03-30 06:51:48 +00:00
|
|
|
|
|
|
|
```solidity
|
2023-07-31 05:21:15 +00:00
|
|
|
error NotImplemented()
|
2023-03-30 06:51:48 +00:00
|
|
|
```
|
|
|
|
|
2023-07-31 05:21:15 +00:00
|
|
|
## WakuRln
|
2023-03-30 06:51:48 +00:00
|
|
|
|
2023-08-03 06:00:43 +00:00
|
|
|
### contractIndex
|
|
|
|
|
|
|
|
```solidity
|
|
|
|
uint16 contractIndex
|
|
|
|
```
|
|
|
|
|
2023-07-31 05:21:15 +00:00
|
|
|
### constructor
|
2023-03-30 06:51:48 +00:00
|
|
|
|
|
|
|
```solidity
|
2023-08-03 06:00:43 +00:00
|
|
|
constructor(address _poseidonHasher, uint16 _contractIndex) public
|
2023-03-30 06:51:48 +00:00
|
|
|
```
|
|
|
|
|
2023-09-11 04:01:16 +00:00
|
|
|
### _register
|
2023-03-30 06:51:48 +00:00
|
|
|
|
|
|
|
```solidity
|
2023-07-31 05:21:15 +00:00
|
|
|
function _register(uint256 idCommitment) internal
|
2023-03-30 06:51:48 +00:00
|
|
|
```
|
|
|
|
|
2023-07-31 05:21:15 +00:00
|
|
|
Registers a member
|
2023-03-30 06:51:48 +00:00
|
|
|
|
|
|
|
#### Parameters
|
|
|
|
|
2023-09-11 04:01:16 +00:00
|
|
|
| Name | Type | Description |
|
|
|
|
| ---- | ---- | ----------- |
|
2023-07-31 05:21:15 +00:00
|
|
|
| idCommitment | uint256 | The idCommitment of the member |
|
2023-03-30 06:51:48 +00:00
|
|
|
|
2023-07-31 05:21:15 +00:00
|
|
|
### register
|
2023-03-30 06:51:48 +00:00
|
|
|
|
|
|
|
```solidity
|
2023-07-31 05:21:15 +00:00
|
|
|
function register(uint256[] idCommitments) external
|
2023-03-30 06:51:48 +00:00
|
|
|
```
|
|
|
|
|
2023-07-31 05:21:15 +00:00
|
|
|
### register
|
2023-03-30 06:51:48 +00:00
|
|
|
|
|
|
|
```solidity
|
2023-07-31 05:21:15 +00:00
|
|
|
function register(uint256 idCommitment) external payable
|
2023-03-30 06:51:48 +00:00
|
|
|
```
|
|
|
|
|
2023-07-31 05:21:15 +00:00
|
|
|
Allows a user to register as a member
|
2023-03-30 06:51:48 +00:00
|
|
|
|
|
|
|
#### Parameters
|
|
|
|
|
2023-09-11 04:01:16 +00:00
|
|
|
| Name | Type | Description |
|
|
|
|
| ---- | ---- | ----------- |
|
2023-07-03 12:47:34 +00:00
|
|
|
| idCommitment | uint256 | The idCommitment of the member |
|
2023-03-30 06:51:48 +00:00
|
|
|
|
2023-07-31 05:21:15 +00:00
|
|
|
### slash
|
2023-03-30 06:51:48 +00:00
|
|
|
|
|
|
|
```solidity
|
2023-07-31 05:21:15 +00:00
|
|
|
function slash(uint256 idCommitment, address payable receiver, uint256[8] proof) external pure
|
2023-03-30 06:51:48 +00:00
|
|
|
```
|
|
|
|
|
2023-07-31 05:21:15 +00:00
|
|
|
_Allows a user to slash a member_
|
2023-03-30 06:51:48 +00:00
|
|
|
|
|
|
|
#### Parameters
|
|
|
|
|
2023-09-11 04:01:16 +00:00
|
|
|
| Name | Type | Description |
|
|
|
|
| ---- | ---- | ----------- |
|
|
|
|
| idCommitment | uint256 | The idCommitment of the member |
|
|
|
|
| receiver | address payable | |
|
|
|
|
| proof | uint256[8] | |
|
2023-03-30 06:51:48 +00:00
|
|
|
|
2023-09-11 04:01:16 +00:00
|
|
|
### _validateRegistration
|
2023-03-30 06:51:48 +00:00
|
|
|
|
|
|
|
```solidity
|
2023-07-31 05:21:15 +00:00
|
|
|
function _validateRegistration(uint256 idCommitment) internal view
|
2023-03-30 06:51:48 +00:00
|
|
|
```
|
|
|
|
|
2023-07-31 05:21:15 +00:00
|
|
|
_Inheriting contracts MUST override this function_
|
2023-03-30 06:51:48 +00:00
|
|
|
|
2023-09-11 04:01:16 +00:00
|
|
|
### _validateSlash
|
2023-07-03 12:47:34 +00:00
|
|
|
|
2023-07-31 05:21:15 +00:00
|
|
|
```solidity
|
|
|
|
function _validateSlash(uint256 idCommitment, address payable receiver, uint256[8] proof) internal pure
|
|
|
|
```
|
2023-08-02 05:24:59 +00:00
|
|
|
|
|
|
|
### withdraw
|
|
|
|
|
|
|
|
```solidity
|
|
|
|
function withdraw() external pure
|
|
|
|
```
|
|
|
|
|
|
|
|
Allows a user to withdraw funds allocated to them upon slashing a member
|
2023-08-03 06:00:43 +00:00
|
|
|
|
|
|
|
## StorageAlreadyExists
|
|
|
|
|
|
|
|
```solidity
|
|
|
|
error StorageAlreadyExists(address storageAddress)
|
|
|
|
```
|
|
|
|
|
|
|
|
## NoStorageContractAvailable
|
|
|
|
|
|
|
|
```solidity
|
|
|
|
error NoStorageContractAvailable()
|
|
|
|
```
|
|
|
|
|
2023-08-03 12:55:13 +00:00
|
|
|
## IncompatibleStorage
|
2023-08-03 06:00:43 +00:00
|
|
|
|
|
|
|
```solidity
|
2023-08-03 12:55:13 +00:00
|
|
|
error IncompatibleStorage()
|
|
|
|
```
|
|
|
|
|
|
|
|
## IncompatibleStorageIndex
|
|
|
|
|
|
|
|
```solidity
|
|
|
|
error IncompatibleStorageIndex()
|
2023-08-03 06:00:43 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## WakuRlnRegistry
|
|
|
|
|
2023-08-03 11:50:25 +00:00
|
|
|
### nextStorageIndex
|
2023-08-03 06:00:43 +00:00
|
|
|
|
|
|
|
```solidity
|
2023-08-03 11:50:25 +00:00
|
|
|
uint16 nextStorageIndex
|
2023-08-03 06:00:43 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### storages
|
|
|
|
|
|
|
|
```solidity
|
|
|
|
mapping(uint16 => address) storages
|
|
|
|
```
|
|
|
|
|
|
|
|
### usingStorageIndex
|
|
|
|
|
|
|
|
```solidity
|
|
|
|
uint16 usingStorageIndex
|
|
|
|
```
|
|
|
|
|
|
|
|
### poseidonHasher
|
|
|
|
|
|
|
|
```solidity
|
|
|
|
contract IPoseidonHasher poseidonHasher
|
|
|
|
```
|
|
|
|
|
|
|
|
### NewStorageContract
|
|
|
|
|
|
|
|
```solidity
|
|
|
|
event NewStorageContract(uint16 index, address storageAddress)
|
|
|
|
```
|
|
|
|
|
2023-08-08 10:40:06 +00:00
|
|
|
### onlyUsableStorage
|
|
|
|
|
|
|
|
```solidity
|
|
|
|
modifier onlyUsableStorage()
|
|
|
|
```
|
|
|
|
|
2023-09-11 04:01:16 +00:00
|
|
|
### initialize
|
2023-08-03 06:00:43 +00:00
|
|
|
|
|
|
|
```solidity
|
2023-09-11 04:01:16 +00:00
|
|
|
function initialize(address _poseidonHasher) external
|
2023-08-03 06:00:43 +00:00
|
|
|
```
|
|
|
|
|
2023-09-11 04:01:16 +00:00
|
|
|
### _authorizeUpgrade
|
|
|
|
|
|
|
|
```solidity
|
|
|
|
function _authorizeUpgrade(address newImplementation) internal
|
|
|
|
```
|
|
|
|
|
|
|
|
_Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
|
|
|
|
{upgradeTo} and {upgradeToAndCall}.
|
|
|
|
|
|
|
|
Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
|
|
|
|
|
|
|
|
```solidity
|
|
|
|
function _authorizeUpgrade(address) internal override onlyOwner {}
|
|
|
|
```_
|
|
|
|
|
|
|
|
### _insertIntoStorageMap
|
2023-08-03 06:00:43 +00:00
|
|
|
|
|
|
|
```solidity
|
|
|
|
function _insertIntoStorageMap(address storageAddress) internal
|
|
|
|
```
|
|
|
|
|
|
|
|
### registerStorage
|
|
|
|
|
|
|
|
```solidity
|
|
|
|
function registerStorage(address storageAddress) external
|
|
|
|
```
|
|
|
|
|
|
|
|
### newStorage
|
|
|
|
|
|
|
|
```solidity
|
|
|
|
function newStorage() external
|
|
|
|
```
|
|
|
|
|
|
|
|
### register
|
|
|
|
|
|
|
|
```solidity
|
2023-08-23 12:56:20 +00:00
|
|
|
function register(uint256[] commitments) external
|
2023-08-03 12:55:13 +00:00
|
|
|
```
|
|
|
|
|
2023-08-08 08:02:07 +00:00
|
|
|
### register
|
|
|
|
|
|
|
|
```solidity
|
2023-08-23 12:56:20 +00:00
|
|
|
function register(uint16 storageIndex, uint256[] commitments) external
|
2023-08-08 08:02:07 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### register
|
|
|
|
|
|
|
|
```solidity
|
2023-08-23 12:56:20 +00:00
|
|
|
function register(uint16 storageIndex, uint256 commitment) external
|
2023-08-08 08:02:07 +00:00
|
|
|
```
|
|
|
|
|
2023-08-03 12:55:13 +00:00
|
|
|
### forceProgress
|
|
|
|
|
|
|
|
```solidity
|
|
|
|
function forceProgress() external
|
2023-08-03 06:00:43 +00:00
|
|
|
```
|
2023-09-11 04:01:16 +00:00
|
|
|
|