update documentation

This commit is contained in:
hueso
2024-02-13 15:50:31 -03:00
parent f02dad07c8
commit 4b129e2632
20 changed files with 726 additions and 369 deletions

89
docs/core/BaseUtils.md Normal file
View File

@@ -0,0 +1,89 @@
# Solidity API
## BaseUtils
### _setUsedTransactions
```solidity
function _setUsedTransactions(bytes32 message) internal
```
███ Helper FX ██████████████████████████████████████████████████████████
### usedTransactions
```solidity
function usedTransactions(bytes32 message) public view returns (bool used)
```
### _signerCheck
```solidity
function _signerCheck(bytes32 _message, bytes _signature) internal view
```
### _merkleVerify
```solidity
function _merkleVerify(bytes32[] _merkleProof, bytes32 _root, address _addr) internal pure
```
### _castBool
```solidity
function _castBool(bool _valid) internal pure returns (uint256 _validCasted)
```
### getStr
```solidity
function getStr(string str) public pure returns (bytes32 strEnc)
```
### _setSellerBalance
```solidity
function _setSellerBalance(address _sellerKey, contract ERC20 _erc20, uint256 _packed, bytes32 _pixTarget) internal
```
### _setValidState
```solidity
function _setValidState(address _sellerKey, contract ERC20 _erc20, uint256 _packed) internal
```
### _addSellerBalance
```solidity
function _addSellerBalance(address _sellerKey, contract ERC20 _erc20, uint256 _amount) internal
```
### _decSellerBalance
```solidity
function _decSellerBalance(address _sellerKey, contract ERC20 _erc20, uint256 _amount) internal
```
### __sellerBalance
```solidity
function __sellerBalance(address _sellerKey, contract ERC20 _erc20) internal view returns (uint256 _packed)
```
### _castAddrToKey
```solidity
function _castAddrToKey(address _addr) public pure returns (uint256 _key)
```
Public method that handles `address`
to `uint256` safe type casting.
_Function sighash: 0x4b2ae980._
### _castKeyToAddr
```solidity
function _castKeyToAddr(uint256 _key) public pure returns (address _addr)
```

96
docs/core/Constants.md Normal file
View File

@@ -0,0 +1,96 @@
# Solidity API
## Constants
### _ROOT_UPDATED_EVENT_SIGNATURE
```solidity
uint256 _ROOT_UPDATED_EVENT_SIGNATURE
```
███ Constants ██████████████████████████████████████████████████████████
### _ALLOWED_ERC20_UPDATED_EVENT_SIGNATURE
```solidity
uint256 _ALLOWED_ERC20_UPDATED_EVENT_SIGNATURE
```
### _TRUSTED_FORWARDER_UPDATED_EVENT_SIGNATURE
```solidity
uint256 _TRUSTED_FORWARDER_UPDATED_EVENT_SIGNATURE
```
### _SELLER_ALLOWLIST_SLOT_SEED
```solidity
uint256 _SELLER_ALLOWLIST_SLOT_SEED
```
_Seller casted to key => Seller's allowlist merkleroot.
mapping(uint256 => bytes32) public sellerAllowList;_
### _ALLOWED_ERC20_SLOT_SEED
```solidity
uint256 _ALLOWED_ERC20_SLOT_SEED
```
_Tokens allowed to serve as the underlying amount of a deposit.
mapping(ERC20 => bool) public allowedERC20s;_
### _SELLER_BALANCE_SLOT_SEED
```solidity
uint256 _SELLER_BALANCE_SLOT_SEED
```
_Value in custom storage slot given by:
mstore(0x20, token)
mstore(0x0c, _SELLER_BALANCE_SLOT_SEED)
mstore(0x00, seller)
let value := sload(keccak256(0x0c, 0x34))._
### BITMASK_SB_ENTRY
```solidity
uint256 BITMASK_SB_ENTRY
```
_The bitmask of `sellerBalance` entry._
### BITPOS_VALID
```solidity
uint256 BITPOS_VALID
```
_The bit position of `valid` in `sellerBalance`._
### WAD
```solidity
uint256 WAD
```
_The scalar of BRZ token._
### MAXBALANCE_UPPERBOUND
```solidity
uint256 MAXBALANCE_UPPERBOUND
```
### REPUTATION_LOWERBOUND
```solidity
uint256 REPUTATION_LOWERBOUND
```
### LOCKAMOUNT_UPPERBOUND
```solidity
uint256 LOCKAMOUNT_UPPERBOUND
```

1
docs/core/DataTypes.md Normal file
View File

@@ -0,0 +1 @@
# DataTypes

264
docs/core/EventAndErrors.md Normal file
View File

@@ -0,0 +1,264 @@
# EventAndErrors
## Events
### AllowedERC20Updated
```solidity
event AllowedERC20Updated(address indexed token, bool indexed state)
```
#### Parameters
| Name | Type | Description |
| --------------- | ------- | ----------- |
| token `indexed` | address | undefined |
| state `indexed` | bool | undefined |
### DepositAdded
```solidity
event DepositAdded(address indexed seller, uint256 depositID, address token, uint256 amount)
```
███ Events ████████████████████████████████████████████████████████████
#### Parameters
| Name | Type | Description |
| ---------------- | ------- | ----------- |
| seller `indexed` | address | undefined |
| depositID | uint256 | undefined |
| token | address | undefined |
| amount | uint256 | undefined |
### DepositClosed
```solidity
event DepositClosed(address indexed seller, uint256 depositID)
```
#### Parameters
| Name | Type | Description |
| ---------------- | ------- | ----------- |
| seller `indexed` | address | undefined |
| depositID | uint256 | undefined |
### DepositWithdrawn
```solidity
event DepositWithdrawn(address indexed seller, uint256 depositID, uint256 amount)
```
#### Parameters
| Name | Type | Description |
| ---------------- | ------- | ----------- |
| seller `indexed` | address | undefined |
| depositID | uint256 | undefined |
| amount | uint256 | undefined |
### FundsWithdrawn
```solidity
event FundsWithdrawn(address owner, uint256 amount)
```
#### Parameters
| Name | Type | Description |
| ------ | ------- | ----------- |
| owner | address | undefined |
| amount | uint256 | undefined |
### LockAdded
```solidity
event LockAdded(address indexed buyer, bytes32 indexed lockID, uint256 depositID, uint256 amount)
```
#### Parameters
| Name | Type | Description |
| ---------------- | ------- | ----------- |
| buyer `indexed` | address | undefined |
| lockID `indexed` | bytes32 | undefined |
| depositID | uint256 | undefined |
| amount | uint256 | undefined |
### LockBlocksUpdated
```solidity
event LockBlocksUpdated(uint256 blocks)
```
#### Parameters
| Name | Type | Description |
| ------ | ------- | ----------- |
| blocks | uint256 | undefined |
### LockReleased
```solidity
event LockReleased(address indexed buyer, bytes32 lockId)
```
#### Parameters
| Name | Type | Description |
| --------------- | ------- | ----------- |
| buyer `indexed` | address | undefined |
| lockId | bytes32 | undefined |
### LockReturned
```solidity
event LockReturned(address indexed buyer, bytes32 lockId)
```
#### Parameters
| Name | Type | Description |
| --------------- | ------- | ----------- |
| buyer `indexed` | address | undefined |
| lockId | bytes32 | undefined |
### ReputationUpdated
```solidity
event ReputationUpdated(address reputation)
```
#### Parameters
| Name | Type | Description |
| ---------- | ------- | ----------- |
| reputation | address | undefined |
### ValidSignersUpdated
```solidity
event ValidSignersUpdated(address[] signers)
```
#### Parameters
| Name | Type | Description |
| ------- | --------- | ----------- |
| signers | address[] | undefined |
## Errors
### AddressDenied
```solidity
error AddressDenied()
```
_Address doesn't exist in a MerkleTree.Address not allowed as relayer.0x3b8474be_
### AlreadyReleased
```solidity
error AlreadyReleased()
```
_Lock already released or returned.0x63b4904e_
### AmountNotAllowed
```solidity
error AmountNotAllowed()
```
_Wished amount to be locked exceeds the limit allowed.0x1c18f846_
### DepositAlreadyExists
```solidity
error DepositAlreadyExists()
```
_Deposit already exist and it is still valid.0xc44bd765_
### InvalidDeposit
```solidity
error InvalidDeposit()
```
_Deposit not valid anymore.0xb2e532de_
### InvalidSigner
```solidity
error InvalidSigner()
```
_Signer is not a valid signer.0x815e1d64_
### LengthMismatch
```solidity
error LengthMismatch()
```
_Arrays' length don't match.0xff633a38_
### LoopOverflow
```solidity
error LoopOverflow()
```
_Loop bounds have overflowed.0xdfb035c9_
### NoTokens
```solidity
error NoTokens()
```
_No tokens array provided as argument.0xdf957883_
### NotEnoughTokens
```solidity
error NotEnoughTokens()
```
_Not enough token remaining on deposit.0x22bbb43c_
### NotExpired
```solidity
error NotExpired()
```
_Lock not expired or already released.Another lock with same ID is not expired yet.0xd0404f85_
### OnlySeller
```solidity
error OnlySeller()
```
_Only seller could call this function.`msg.sender` and the seller differ.0x85d1f726_
### TokenDenied
```solidity
error TokenDenied()
```
_Token address not allowed to be deposited.0x1578328e_
### TxAlreadyUsed
```solidity
error TxAlreadyUsed()
```
_Transaction already used to unlock payment.0xf490a6ea_

View File

@@ -0,0 +1,98 @@
# Solidity API
## OwnerSettings
### reputation
```solidity
contract IReputation reputation
```
_List of valid Bacen signature addresses
mapping(uint256 => bool) public validBacenSigners;
Value in custom storage slot given by:
let value := sload(shl(12, address))._
### defaultLockBlocks
```solidity
uint256 defaultLockBlocks
```
_Default blocks that lock will hold tokens._
### constructor
```solidity
constructor(uint256 defaultBlocks, address[] validSigners, address _reputation, contract ERC20[] tokens, bool[] tokenStates) internal
```
███ Constructor ████████████████████████████████████████████████████████
### setTrustedFowarders
```solidity
function setTrustedFowarders(address[] forwarders, bool[] states) external
```
███ Owner Only █████████████████████████████████████████████████████████
### withdrawBalance
```solidity
function withdrawBalance() external
```
_Contract's underlying balance withdraw method.
Function sighash: 0x5fd8c710._
### setReputation
```solidity
function setReputation(contract IReputation _reputation) public
```
### setDefaultLockBlocks
```solidity
function setDefaultLockBlocks(uint256 _blocks) public
```
### setValidSigners
```solidity
function setValidSigners(address[] _validSigners) public
```
### tokenSettings
```solidity
function tokenSettings(contract ERC20[] _tokens, bool[] _states) public
```
### validBacenSigners
```solidity
function validBacenSigners(uint256 signer) public view returns (bool valid)
```
███ View FX ████████████████████████████████████████████████████████████
### sellerAllowList
```solidity
function sellerAllowList(address sellerKey) public view returns (bytes32 root)
```
### allowedERC20s
```solidity
function allowedERC20s(contract ERC20 erc20) public view returns (bool state)
```
### _limiter
```solidity
function _limiter(uint256 _userCredit) internal view returns (uint256 _spendLimit)
```