update documentation
This commit is contained in:
parent
f02dad07c8
commit
4b129e2632
@ -21,8 +21,6 @@ contract P2PIX is BaseUtils {
|
|||||||
using DT for DT.Lock;
|
using DT for DT.Lock;
|
||||||
using DT for DT.LockStatus;
|
using DT for DT.LockStatus;
|
||||||
|
|
||||||
/// ███ Storage ████████████████████████████████████████████████████████████
|
|
||||||
|
|
||||||
uint256 public lockCounter;
|
uint256 public lockCounter;
|
||||||
|
|
||||||
/// @dev List of Locks.
|
/// @dev List of Locks.
|
||||||
@ -30,8 +28,6 @@ contract P2PIX is BaseUtils {
|
|||||||
/// @dev Stores an relayer's last computed credit.
|
/// @dev Stores an relayer's last computed credit.
|
||||||
mapping(uint256 => uint256) public userRecord;
|
mapping(uint256 => uint256) public userRecord;
|
||||||
|
|
||||||
/// ███ Constructor ████████████████████████████████████████████████████████
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
uint256 defaultBlocks,
|
uint256 defaultBlocks,
|
||||||
address[] memory validSigners,
|
address[] memory validSigners,
|
||||||
@ -48,15 +44,13 @@ contract P2PIX is BaseUtils {
|
|||||||
)
|
)
|
||||||
payable {/* */}
|
payable {/* */}
|
||||||
|
|
||||||
/// ███ Public FX ██████████████████████████████████████████████████████████
|
|
||||||
|
|
||||||
/// @notice Creates a deposit order based on a seller's
|
/// @notice Creates a deposit order based on a seller's
|
||||||
/// offer of an amount of ERC20 tokens.
|
/// offer of an amount of ERC20 tokens.
|
||||||
/// @notice Seller needs to send his tokens to the P2PIX smart contract.
|
/// @notice Seller needs to send his tokens to the P2PIX smart contract.
|
||||||
/// @param pixTarget Pix key destination provided by the offer's seller.
|
/// @param pixTarget Pix key destination provided by the offer's seller.
|
||||||
/// @param allowlistRoot Optional allow list merkleRoot update `bytes32` value.
|
/// @param allowlistRoot Optional allow list merkleRoot update `bytes32` value.
|
||||||
/// as the deposit identifier.
|
/// as the deposit identifier.
|
||||||
/// @dev Function sighash: 0xbfe07da6.
|
/// @dev Function sighash: 0x5e918943
|
||||||
function deposit(
|
function deposit(
|
||||||
string calldata pixTarget,
|
string calldata pixTarget,
|
||||||
bytes32 allowlistRoot,
|
bytes32 allowlistRoot,
|
||||||
@ -104,8 +98,8 @@ contract P2PIX is BaseUtils {
|
|||||||
|
|
||||||
/// @notice Enables seller to invalidate future
|
/// @notice Enables seller to invalidate future
|
||||||
/// locks made to his/her token offering order.
|
/// locks made to his/her token offering order.
|
||||||
/// @dev This function does not affect any ongoing active locks.
|
/// @notice This function does not affect any ongoing active locks.
|
||||||
/// @dev Function sighash: 0x72fada5c.
|
/// @dev Function sighash: 0x6d82d9e0
|
||||||
function setValidState(ERC20 token, bool state) public {
|
function setValidState(ERC20 token, bool state) public {
|
||||||
uint256 _sellerBalance = __sellerBalance(msg.sender, token);
|
uint256 _sellerBalance = __sellerBalance(msg.sender, token);
|
||||||
|
|
||||||
@ -124,22 +118,22 @@ contract P2PIX is BaseUtils {
|
|||||||
|
|
||||||
/// @notice Public method designed to lock an remaining amount of
|
/// @notice Public method designed to lock an remaining amount of
|
||||||
/// the deposit order of a seller.
|
/// the deposit order of a seller.
|
||||||
/// @dev Transaction forwarding must leave `merkleProof` empty;
|
/// @notice Transaction forwarding must leave `merkleProof` empty;
|
||||||
/// otherwise, the trustedForwarder must be previously added
|
/// otherwise, the trustedForwarder must be previously added
|
||||||
/// to a seller whitelist.
|
/// to a seller whitelist.
|
||||||
/// @dev This method can be performed either by:
|
/// @notice This method can be performed either by:
|
||||||
/// - An user allowed via the seller's allowlist;
|
/// - An user allowed via the seller's allowlist;
|
||||||
/// - An user with enough userRecord to lock the wished amount;
|
/// - An user with enough userRecord to lock the wished amount;
|
||||||
/// @dev There can only exist a lock per each `_amount` partitioned
|
/// @notice There can only exist a lock per each `_amount` partitioned
|
||||||
/// from the total `remaining` value.
|
/// from the total `remaining` value.
|
||||||
/// @dev Locks can only be performed in valid orders.
|
/// @notice Locks can only be performed in valid orders.
|
||||||
/// @param amount The deposit's remaining amount wished to be locked.
|
/// @param amount The deposit's remaining amount wished to be locked.
|
||||||
/// @param merkleProof Provided as a pass if the `msg.sender` is in the
|
/// @param merkleProof Provided as a pass if the `msg.sender` is in the
|
||||||
/// seller's allowlist; Left empty otherwise;
|
/// seller's allowlist; Left empty otherwise;
|
||||||
/// @param expiredLocks An array of `bytes32` identifiers to be
|
/// @param expiredLocks An array of identifiers to be
|
||||||
/// provided so to unexpire locks using this transaction gas push.
|
/// provided so to unexpire locks using this transaction gas push.
|
||||||
/// @return lockID The `bytes32` value returned as the lock identifier.
|
/// @return lockID The lock identifier.
|
||||||
/// @dev Function sighash: 0x03aaf306.
|
/// @dev Function sighash: 0xdc43221c
|
||||||
function lock(
|
function lock(
|
||||||
address seller,
|
address seller,
|
||||||
ERC20 token,
|
ERC20 token,
|
||||||
@ -196,16 +190,16 @@ contract P2PIX is BaseUtils {
|
|||||||
|
|
||||||
/// @notice Lock release method that liquidate lock
|
/// @notice Lock release method that liquidate lock
|
||||||
/// orders and distributes relayer fees.
|
/// orders and distributes relayer fees.
|
||||||
/// @dev This method can be called by any public actor
|
/// @notice This method can be called by any public actor
|
||||||
/// as long the signature provided is valid.
|
/// as long the signature provided is valid.
|
||||||
/// @dev `relayerPremium` gets splitted equaly
|
/// @notice `relayerPremium` gets splitted equaly
|
||||||
/// if relayer addresses differ.
|
/// if relayer addresses differ.
|
||||||
/// @dev If the `msg.sender` of this method and `l.relayerAddress` are the same,
|
/// @notice If the `msg.sender` of this method and `l.relayerAddress` are the same,
|
||||||
/// `msg.sender` accrues both l.amount and l.relayerPremium as userRecord credit.
|
/// `msg.sender` accrues both l.amount and l.relayerPremium as userRecord credit.
|
||||||
/// In case of they differing:
|
/// In case of they differing:
|
||||||
/// - `lock` caller gets accrued with `l.amount` as userRecord credit;
|
/// - `lock` caller gets accrued with `l.amount` as userRecord credit;
|
||||||
/// - `release` caller gets accrued with `l.relayerPremium` as userRecord credit;
|
/// - `release` caller gets accrued with `l.relayerPremium` as userRecord credit;
|
||||||
/// @dev Function sighash: 0x4e1389ed.
|
/// @dev Function sighash: 0x11fc7f9a
|
||||||
function release(
|
function release(
|
||||||
uint256 lockID,
|
uint256 lockID,
|
||||||
bytes32 pixTimestamp,
|
bytes32 pixTimestamp,
|
||||||
@ -254,11 +248,11 @@ contract P2PIX is BaseUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @notice Unlocks expired locks.
|
/// @notice Unlocks expired locks.
|
||||||
/// @dev Triggered in the callgraph by both `lock` and `withdraw` functions.
|
/// @notice Triggered in the callgraph by both `lock` and `withdraw` functions.
|
||||||
/// @dev This method can also have any public actor as its `tx.origin`.
|
/// @notice This method can also have any public actor as its `tx.origin`.
|
||||||
/// @dev For each successfull unexpired lock recovered,
|
/// @notice For each successfull unexpired lock recovered,
|
||||||
/// `userRecord[_castAddrToKey(l.relayerAddress)]` is decreased by half of its value.
|
/// `userRecord[_castAddrToKey(l.relayerAddress)]` is decreased by half of its value.
|
||||||
/// @dev Function sighash: 0x8e2749d6.
|
/// @dev Function sighash: 0xb0983d39
|
||||||
function unlockExpired(uint256[] calldata lockIDs)
|
function unlockExpired(uint256[] calldata lockIDs)
|
||||||
public
|
public
|
||||||
{
|
{
|
||||||
@ -308,9 +302,9 @@ contract P2PIX is BaseUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @notice Seller's expired deposit fund sweeper.
|
/// @notice Seller's expired deposit fund sweeper.
|
||||||
/// @dev A seller may use this method to recover
|
/// @notice A seller may use this method to recover
|
||||||
/// tokens from expired deposits.
|
/// tokens from expired deposits.
|
||||||
/// @dev Function sighash: 0x36317972.
|
/// @dev Function sighash: 0xfb8c5ef0
|
||||||
function withdraw(
|
function withdraw(
|
||||||
ERC20 token,
|
ERC20 token,
|
||||||
uint256 amount,
|
uint256 amount,
|
||||||
@ -368,15 +362,12 @@ contract P2PIX is BaseUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ███ Helper FX ██████████████████████████████████████████████████████████
|
|
||||||
|
|
||||||
// solhint-disable-next-line no-empty-blocks
|
// solhint-disable-next-line no-empty-blocks
|
||||||
receive() external payable {}
|
receive() external payable {}
|
||||||
|
|
||||||
/// @notice Private view auxiliar logic that reverts
|
/// @notice Private view auxiliar logic that reverts
|
||||||
/// on a not expired lock passed as argument of the function.
|
/// on a not expired lock passed as argument of the function.
|
||||||
/// @dev Called exclusively by the `unlockExpired` method.
|
/// @dev Called exclusively by the `unlockExpired` method.
|
||||||
/// @dev Function sighash: 0x74e2a0bb.
|
|
||||||
function _notExpired(DT.Lock storage _l) private view {
|
function _notExpired(DT.Lock storage _l) private view {
|
||||||
if (_l.expirationBlock > block.number)
|
if (_l.expirationBlock > block.number)
|
||||||
revert NotExpired();
|
revert NotExpired();
|
||||||
@ -517,7 +508,7 @@ contract P2PIX is BaseUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @notice External getter that returns the status of a lockIDs array.
|
/// @notice External getter that returns the status of a lockIDs array.
|
||||||
/// @dev Call will not revert if provided with an empty array as parameter.
|
/// @notice Call will not revert if provided with an empty array as parameter.
|
||||||
/// @dev Function sighash: 0x49ef8448
|
/// @dev Function sighash: 0x49ef8448
|
||||||
function getLocksStatus(uint256[] memory ids)
|
function getLocksStatus(uint256[] memory ids)
|
||||||
external
|
external
|
||||||
|
@ -1,6 +1,28 @@
|
|||||||
# Reputation
|
# Solidity API
|
||||||
|
|
||||||
## Methods
|
## Reputation
|
||||||
|
|
||||||
|
### maxLimit
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
uint256 maxLimit
|
||||||
|
```
|
||||||
|
|
||||||
|
_Asymptote numerator constant value for the `limiter` fx._
|
||||||
|
|
||||||
|
### magicValue
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
uint256 magicValue
|
||||||
|
```
|
||||||
|
|
||||||
|
_Denominator's constant operand for the `limiter` fx._
|
||||||
|
|
||||||
|
### constructor
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
constructor() public payable
|
||||||
|
```
|
||||||
|
|
||||||
### limiter
|
### limiter
|
||||||
|
|
||||||
@ -8,81 +30,12 @@
|
|||||||
function limiter(uint256 _userCredit) external pure returns (uint256 _spendLimit)
|
function limiter(uint256 _userCredit) external pure returns (uint256 _spendLimit)
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Parameters
|
### sqrt
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ------------ | ------- | ----------- |
|
|
||||||
| \_userCredit | uint256 | undefined |
|
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ------------ | ------- | ----------- |
|
|
||||||
| \_spendLimit | uint256 | undefined |
|
|
||||||
|
|
||||||
### magicValue
|
|
||||||
|
|
||||||
```solidity
|
```solidity
|
||||||
function magicValue() external view returns (uint256)
|
function sqrt(uint256 x) internal pure returns (uint256 z)
|
||||||
```
|
```
|
||||||
|
|
||||||
_Denominator's constant operand for the `limiter` fx. _
|
Taken from Solmate's FixedPointMathLib.
|
||||||
|
(https://github.com/transmissions11/solmate/blob/main/src/utils/FixedPointMathLib.sol)
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ---- | ------- | ----------- |
|
|
||||||
| \_0 | uint256 | undefined |
|
|
||||||
|
|
||||||
### maxLimit
|
|
||||||
|
|
||||||
```solidity
|
|
||||||
function maxLimit() external view returns (uint256)
|
|
||||||
```
|
|
||||||
|
|
||||||
_Asymptote numerator constant value for the `limiter` fx._
|
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ---- | ------- | ----------- |
|
|
||||||
| \_0 | uint256 | undefined |
|
|
||||||
|
|
||||||
### owner
|
|
||||||
|
|
||||||
```solidity
|
|
||||||
function owner() external view returns (address)
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ---- | ------- | ----------- |
|
|
||||||
| \_0 | address | undefined |
|
|
||||||
|
|
||||||
### setOwner
|
|
||||||
|
|
||||||
```solidity
|
|
||||||
function setOwner(address newOwner) external nonpayable
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Parameters
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| -------- | ------- | ----------- |
|
|
||||||
| newOwner | address | undefined |
|
|
||||||
|
|
||||||
## Events
|
|
||||||
|
|
||||||
### OwnerUpdated
|
|
||||||
|
|
||||||
```solidity
|
|
||||||
event OwnerUpdated(address indexed user, address indexed newOwner)
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Parameters
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ------------------ | ------- | ----------- |
|
|
||||||
| user `indexed` | address | undefined |
|
|
||||||
| newOwner `indexed` | address | undefined |
|
|
||||||
|
89
docs/core/BaseUtils.md
Normal file
89
docs/core/BaseUtils.md
Normal 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
96
docs/core/Constants.md
Normal 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
|
||||||
|
```
|
||||||
|
|
98
docs/core/OwnerSettings.md
Normal file
98
docs/core/OwnerSettings.md
Normal 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)
|
||||||
|
```
|
||||||
|
|
@ -1,46 +1,42 @@
|
|||||||
# Owned
|
# Solidity API
|
||||||
|
|
||||||
_Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/auth/Owned.sol)_
|
## Owned
|
||||||
|
|
||||||
Simple single owner authorization mixin.
|
Simple single owner authorization mixin.
|
||||||
|
|
||||||
## Methods
|
### Unauthorized
|
||||||
|
|
||||||
### owner
|
|
||||||
|
|
||||||
```solidity
|
```solidity
|
||||||
function owner() external view returns (address)
|
error Unauthorized()
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ---- | ------- | ----------- |
|
|
||||||
| \_0 | address | undefined |
|
|
||||||
|
|
||||||
### setOwner
|
|
||||||
|
|
||||||
```solidity
|
|
||||||
function setOwner(address newOwner) external nonpayable
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Parameters
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| -------- | ------- | ----------- |
|
|
||||||
| newOwner | address | undefined |
|
|
||||||
|
|
||||||
## Events
|
|
||||||
|
|
||||||
### OwnerUpdated
|
### OwnerUpdated
|
||||||
|
|
||||||
```solidity
|
```solidity
|
||||||
event OwnerUpdated(address indexed user, address indexed newOwner)
|
event OwnerUpdated(address user, address newOwner)
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Parameters
|
### owner
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
address owner
|
||||||
|
```
|
||||||
|
|
||||||
|
### onlyOwner
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
modifier onlyOwner()
|
||||||
|
```
|
||||||
|
|
||||||
|
### constructor
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
constructor(address _owner) internal
|
||||||
|
```
|
||||||
|
|
||||||
|
### setOwner
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
function setOwner(address newOwner) public virtual
|
||||||
|
```
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ------------------ | ------- | ----------- |
|
|
||||||
| user `indexed` | address | undefined |
|
|
||||||
| newOwner `indexed` | address | undefined |
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# IReputation
|
# Solidity API
|
||||||
|
|
||||||
## Methods
|
## IReputation
|
||||||
|
|
||||||
### limiter
|
### limiter
|
||||||
|
|
||||||
@ -8,14 +8,3 @@
|
|||||||
function limiter(uint256 _userCredit) external pure returns (uint256 _spendLimit)
|
function limiter(uint256 _userCredit) external pure returns (uint256 _spendLimit)
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Parameters
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ------------ | ------- | ----------- |
|
|
||||||
| \_userCredit | uint256 | undefined |
|
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ------------ | ------- | ----------- |
|
|
||||||
| \_spendLimit | uint256 | undefined |
|
|
||||||
|
53
docs/lib/metatx/ERC2771Context.md
Normal file
53
docs/lib/metatx/ERC2771Context.md
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
# Solidity API
|
||||||
|
|
||||||
|
## Context
|
||||||
|
|
||||||
|
_Provides information about the current execution context, including the
|
||||||
|
sender of the transaction and its data. While these are generally available
|
||||||
|
via msg.sender and msg.data, they should not be accessed in such a direct
|
||||||
|
manner, since when dealing with meta-transactions the account sending and
|
||||||
|
paying for execution may not be the actual sender (as far as an application
|
||||||
|
is concerned).
|
||||||
|
|
||||||
|
This contract is only required for intermediate, library-like contracts._
|
||||||
|
|
||||||
|
### _msgSender
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
function _msgSender() internal view virtual returns (address)
|
||||||
|
```
|
||||||
|
|
||||||
|
### _msgData
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
function _msgData() internal view virtual returns (bytes)
|
||||||
|
```
|
||||||
|
|
||||||
|
## ERC2771Context
|
||||||
|
|
||||||
|
_Context variant with ERC2771 support._
|
||||||
|
|
||||||
|
### trustedForwarders
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
mapping(address => bool) trustedForwarders
|
||||||
|
```
|
||||||
|
|
||||||
|
### _msgSender
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
function _msgSender() internal view virtual returns (address sender)
|
||||||
|
```
|
||||||
|
|
||||||
|
### isTrustedForwarder
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
function isTrustedForwarder(address forwarder) public view virtual returns (bool)
|
||||||
|
```
|
||||||
|
|
||||||
|
### _msgData
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
function _msgData() internal view virtual returns (bytes)
|
||||||
|
```
|
||||||
|
|
16
docs/lib/mock/mockToken.md
Normal file
16
docs/lib/mock/mockToken.md
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# Solidity API
|
||||||
|
|
||||||
|
## MockToken
|
||||||
|
|
||||||
|
### constructor
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
constructor(uint256 supply) public
|
||||||
|
```
|
||||||
|
|
||||||
|
### mint
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
function mint(address[] to, uint256 value) public virtual
|
||||||
|
```
|
||||||
|
|
@ -1,230 +1,128 @@
|
|||||||
# ERC20
|
# Solidity API
|
||||||
|
|
||||||
_Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol)Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)_
|
## ERC20
|
||||||
|
|
||||||
Modern and gas efficient ERC20 + EIP-2612 implementation.
|
Modern and gas efficient ERC20 + EIP-2612 implementation.
|
||||||
|
|
||||||
_Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it._
|
_Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it._
|
||||||
|
|
||||||
## Methods
|
### Transfer
|
||||||
|
|
||||||
### DOMAIN_SEPARATOR
|
|
||||||
|
|
||||||
```solidity
|
```solidity
|
||||||
function DOMAIN_SEPARATOR() external view returns (bytes32)
|
event Transfer(address from, address to, uint256 amount)
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ---- | ------- | ----------- |
|
|
||||||
| \_0 | bytes32 | undefined |
|
|
||||||
|
|
||||||
### allowance
|
|
||||||
|
|
||||||
```solidity
|
|
||||||
function allowance(address, address) external view returns (uint256)
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Parameters
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ---- | ------- | ----------- |
|
|
||||||
| \_0 | address | undefined |
|
|
||||||
| \_1 | address | undefined |
|
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ---- | ------- | ----------- |
|
|
||||||
| \_0 | uint256 | undefined |
|
|
||||||
|
|
||||||
### approve
|
|
||||||
|
|
||||||
```solidity
|
|
||||||
function approve(address spender, uint256 amount) external nonpayable returns (bool)
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Parameters
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ------- | ------- | ----------- |
|
|
||||||
| spender | address | undefined |
|
|
||||||
| amount | uint256 | undefined |
|
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ---- | ---- | ----------- |
|
|
||||||
| \_0 | bool | undefined |
|
|
||||||
|
|
||||||
### balanceOf
|
|
||||||
|
|
||||||
```solidity
|
|
||||||
function balanceOf(address) external view returns (uint256)
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Parameters
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ---- | ------- | ----------- |
|
|
||||||
| \_0 | address | undefined |
|
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ---- | ------- | ----------- |
|
|
||||||
| \_0 | uint256 | undefined |
|
|
||||||
|
|
||||||
### decimals
|
|
||||||
|
|
||||||
```solidity
|
|
||||||
function decimals() external view returns (uint8)
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ---- | ----- | ----------- |
|
|
||||||
| \_0 | uint8 | undefined |
|
|
||||||
|
|
||||||
### name
|
|
||||||
|
|
||||||
```solidity
|
|
||||||
function name() external view returns (string)
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ---- | ------ | ----------- |
|
|
||||||
| \_0 | string | undefined |
|
|
||||||
|
|
||||||
### nonces
|
|
||||||
|
|
||||||
```solidity
|
|
||||||
function nonces(address) external view returns (uint256)
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Parameters
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ---- | ------- | ----------- |
|
|
||||||
| \_0 | address | undefined |
|
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ---- | ------- | ----------- |
|
|
||||||
| \_0 | uint256 | undefined |
|
|
||||||
|
|
||||||
### permit
|
|
||||||
|
|
||||||
```solidity
|
|
||||||
function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external nonpayable
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Parameters
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| -------- | ------- | ----------- |
|
|
||||||
| owner | address | undefined |
|
|
||||||
| spender | address | undefined |
|
|
||||||
| value | uint256 | undefined |
|
|
||||||
| deadline | uint256 | undefined |
|
|
||||||
| v | uint8 | undefined |
|
|
||||||
| r | bytes32 | undefined |
|
|
||||||
| s | bytes32 | undefined |
|
|
||||||
|
|
||||||
### symbol
|
|
||||||
|
|
||||||
```solidity
|
|
||||||
function symbol() external view returns (string)
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ---- | ------ | ----------- |
|
|
||||||
| \_0 | string | undefined |
|
|
||||||
|
|
||||||
### totalSupply
|
|
||||||
|
|
||||||
```solidity
|
|
||||||
function totalSupply() external view returns (uint256)
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ---- | ------- | ----------- |
|
|
||||||
| \_0 | uint256 | undefined |
|
|
||||||
|
|
||||||
### transfer
|
|
||||||
|
|
||||||
```solidity
|
|
||||||
function transfer(address to, uint256 amount) external nonpayable returns (bool)
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Parameters
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ------ | ------- | ----------- |
|
|
||||||
| to | address | undefined |
|
|
||||||
| amount | uint256 | undefined |
|
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ---- | ---- | ----------- |
|
|
||||||
| \_0 | bool | undefined |
|
|
||||||
|
|
||||||
### transferFrom
|
|
||||||
|
|
||||||
```solidity
|
|
||||||
function transferFrom(address from, address to, uint256 amount) external nonpayable returns (bool)
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Parameters
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ------ | ------- | ----------- |
|
|
||||||
| from | address | undefined |
|
|
||||||
| to | address | undefined |
|
|
||||||
| amount | uint256 | undefined |
|
|
||||||
|
|
||||||
#### Returns
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ---- | ---- | ----------- |
|
|
||||||
| \_0 | bool | undefined |
|
|
||||||
|
|
||||||
## Events
|
|
||||||
|
|
||||||
### Approval
|
### Approval
|
||||||
|
|
||||||
```solidity
|
```solidity
|
||||||
event Approval(address indexed owner, address indexed spender, uint256 amount)
|
event Approval(address owner, address spender, uint256 amount)
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Parameters
|
### name
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ----------------- | ------- | ----------- |
|
|
||||||
| owner `indexed` | address | undefined |
|
|
||||||
| spender `indexed` | address | undefined |
|
|
||||||
| amount | uint256 | undefined |
|
|
||||||
|
|
||||||
### Transfer
|
|
||||||
|
|
||||||
```solidity
|
```solidity
|
||||||
event Transfer(address indexed from, address indexed to, uint256 amount)
|
string name
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Parameters
|
### symbol
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
string symbol
|
||||||
|
```
|
||||||
|
|
||||||
|
### decimals
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
uint8 decimals
|
||||||
|
```
|
||||||
|
|
||||||
|
### totalSupply
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
uint256 totalSupply
|
||||||
|
```
|
||||||
|
|
||||||
|
### balanceOf
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
mapping(address => uint256) balanceOf
|
||||||
|
```
|
||||||
|
|
||||||
|
### allowance
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
mapping(address => mapping(address => uint256)) allowance
|
||||||
|
```
|
||||||
|
|
||||||
|
### INITIAL_CHAIN_ID
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
uint256 INITIAL_CHAIN_ID
|
||||||
|
```
|
||||||
|
|
||||||
|
### INITIAL_DOMAIN_SEPARATOR
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
bytes32 INITIAL_DOMAIN_SEPARATOR
|
||||||
|
```
|
||||||
|
|
||||||
|
### nonces
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
mapping(address => uint256) nonces
|
||||||
|
```
|
||||||
|
|
||||||
|
### constructor
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
constructor(string _name, string _symbol, uint8 _decimals) internal
|
||||||
|
```
|
||||||
|
|
||||||
|
### approve
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
function approve(address spender, uint256 amount) public virtual returns (bool)
|
||||||
|
```
|
||||||
|
|
||||||
|
### transfer
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
function transfer(address to, uint256 amount) public virtual returns (bool)
|
||||||
|
```
|
||||||
|
|
||||||
|
### transferFrom
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
function transferFrom(address from, address to, uint256 amount) public virtual returns (bool)
|
||||||
|
```
|
||||||
|
|
||||||
|
### permit
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public virtual
|
||||||
|
```
|
||||||
|
|
||||||
|
### DOMAIN_SEPARATOR
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
function DOMAIN_SEPARATOR() public view virtual returns (bytes32)
|
||||||
|
```
|
||||||
|
|
||||||
|
### computeDomainSeparator
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
function computeDomainSeparator() internal view virtual returns (bytes32)
|
||||||
|
```
|
||||||
|
|
||||||
|
### _mint
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
function _mint(address to, uint256 amount) internal virtual
|
||||||
|
```
|
||||||
|
|
||||||
|
### _burn
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
function _burn(address from, uint256 amount) internal virtual
|
||||||
|
```
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| -------------- | ------- | ----------- |
|
|
||||||
| from `indexed` | address | undefined |
|
|
||||||
| to `indexed` | address | undefined |
|
|
||||||
| amount | uint256 | undefined |
|
|
||||||
|
38
docs/lib/utils/ECDSA.md
Normal file
38
docs/lib/utils/ECDSA.md
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# Solidity API
|
||||||
|
|
||||||
|
## ECDSA
|
||||||
|
|
||||||
|
Gas optimized ECDSA wrapper.
|
||||||
|
|
||||||
|
### InvalidSignature
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
error InvalidSignature()
|
||||||
|
```
|
||||||
|
|
||||||
|
_The signature is invalid._
|
||||||
|
|
||||||
|
### recoverCalldata
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
function recoverCalldata(bytes32 hash, bytes signature) internal view returns (address result)
|
||||||
|
```
|
||||||
|
|
||||||
|
_Recovers the signer's address from a message digest `hash`,
|
||||||
|
and the `signature`.
|
||||||
|
|
||||||
|
This function does NOT accept EIP-2098 short form signatures.
|
||||||
|
Use `recover(bytes32 hash, bytes32 r, bytes32 vs)` for EIP-2098
|
||||||
|
short form signatures instead._
|
||||||
|
|
||||||
|
### toEthSignedMessageHash
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 result)
|
||||||
|
```
|
||||||
|
|
||||||
|
_Returns an Ethereum Signed Message, created from a `hash`.
|
||||||
|
This produces a hash corresponding to the one signed with the
|
||||||
|
[`eth_sign`](https://eth.wiki/json-rpc/API#eth_sign)
|
||||||
|
JSON-RPC method as part of EIP-191._
|
||||||
|
|
@ -1,5 +1,14 @@
|
|||||||
# MerkleProofLib
|
# Solidity API
|
||||||
|
|
||||||
_Solady (https://github.com/vectorized/solady/blob/main/src/utils/MerkleProofLib.sol)Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/MerkleProofLib.sol)Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/MerkleProof.sol)_
|
## MerkleProofLib
|
||||||
|
|
||||||
Gas optimized verification of proof of inclusion for a leaf in a Merkle tree.
|
Gas optimized verification of proof of inclusion for a leaf in a Merkle tree.
|
||||||
|
|
||||||
|
### verify
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
function verify(bytes32[] proof, bytes32 root, bytes32 leaf) internal pure returns (bool isValid)
|
||||||
|
```
|
||||||
|
|
||||||
|
_Returns whether `leaf` exists in the Merkle tree with `root`, given `proof`._
|
||||||
|
|
||||||
|
50
docs/lib/utils/Multicall.md
Normal file
50
docs/lib/utils/Multicall.md
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
# Solidity API
|
||||||
|
|
||||||
|
## Multicall
|
||||||
|
|
||||||
|
Contract that batches view function calls and aggregates their results.
|
||||||
|
|
||||||
|
### CallFailed
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
error CallFailed(string reason)
|
||||||
|
```
|
||||||
|
|
||||||
|
_0x_
|
||||||
|
|
||||||
|
### Call
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
struct Call {
|
||||||
|
address target;
|
||||||
|
bytes callData;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Result
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
struct Result {
|
||||||
|
bool success;
|
||||||
|
bytes returnData;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### constructor
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
constructor() public payable
|
||||||
|
```
|
||||||
|
|
||||||
|
### mtc1
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
function mtc1(struct Multicall.Call[] calls) external returns (uint256, bytes[])
|
||||||
|
```
|
||||||
|
|
||||||
|
### mtc2
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
function mtc2(struct Multicall.Call[] calls) external returns (uint256, bytes32, struct Multicall.Result[])
|
||||||
|
```
|
||||||
|
|
@ -1,13 +1,34 @@
|
|||||||
# ReentrancyGuard
|
# Solidity API
|
||||||
|
|
||||||
_z0r0z.ethModified from Seaport (https://github.com/ProjectOpenSea/seaport/blob/main/contracts/lib/ReentrancyGuard.sol)Modified from Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/ReentrancyGuard.sol)_
|
## ReentrancyGuard
|
||||||
|
|
||||||
Reentrancy protection for smart contracts.
|
Reentrancy protection for smart contracts.
|
||||||
|
|
||||||
## Errors
|
|
||||||
|
|
||||||
### Reentrancy
|
### Reentrancy
|
||||||
|
|
||||||
```solidity
|
```solidity
|
||||||
error Reentrancy()
|
error Reentrancy()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### nonReentrant
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
modifier nonReentrant()
|
||||||
|
```
|
||||||
|
|
||||||
|
### setReentrancyGuard
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
function setReentrancyGuard() internal virtual
|
||||||
|
```
|
||||||
|
|
||||||
|
_Check guard sentinel value and set it._
|
||||||
|
|
||||||
|
### clearReentrancyGuard
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
function clearReentrancyGuard() internal virtual
|
||||||
|
```
|
||||||
|
|
||||||
|
_Unset sentinel value._
|
||||||
|
|
||||||
|
@ -1,7 +1,62 @@
|
|||||||
# SafeTransferLib
|
# Solidity API
|
||||||
|
|
||||||
_Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol)_
|
## SafeTransferLib
|
||||||
|
|
||||||
Safe ETH and ERC20 transfer library that gracefully handles missing return values.
|
Safe ETH and ERC20 transfer library that gracefully handles missing return values.
|
||||||
|
|
||||||
_Caution! This library won't check that a token has code, responsibility is delegated to the caller._
|
_Caution! This library won't check that a token has code, responsibility is delegated to the caller._
|
||||||
|
|
||||||
|
### ETHTransferFailed
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
error ETHTransferFailed()
|
||||||
|
```
|
||||||
|
|
||||||
|
_The ETH transfer has failed._
|
||||||
|
|
||||||
|
### TransferFromFailed
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
error TransferFromFailed()
|
||||||
|
```
|
||||||
|
|
||||||
|
_The ERC20 `transferFrom` has failed._
|
||||||
|
|
||||||
|
### TransferFailed
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
error TransferFailed()
|
||||||
|
```
|
||||||
|
|
||||||
|
_The ERC20 `transfer` has failed._
|
||||||
|
|
||||||
|
### safeTransferETH
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
function safeTransferETH(address to, uint256 amount) internal
|
||||||
|
```
|
||||||
|
|
||||||
|
_Sends `amount` (in wei) ETH to `to`.
|
||||||
|
Reverts upon failure._
|
||||||
|
|
||||||
|
### safeTransferFrom
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
function safeTransferFrom(contract ERC20 token, address from, address to, uint256 amount) internal
|
||||||
|
```
|
||||||
|
|
||||||
|
_Sends `amount` of ERC20 `token` from `from` to `to`.
|
||||||
|
Reverts upon failure.
|
||||||
|
|
||||||
|
The `from` account must have at least `amount` approved for
|
||||||
|
the current contract to manage._
|
||||||
|
|
||||||
|
### safeTransfer
|
||||||
|
|
||||||
|
```solidity
|
||||||
|
function safeTransfer(contract ERC20 token, address to, uint256 amount) internal
|
||||||
|
```
|
||||||
|
|
||||||
|
_Sends `amount` of ERC20 `token` from the current contract to `to`.
|
||||||
|
Reverts upon failure._
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import { HardhatUserConfig } from "hardhat/config";
|
|||||||
import { NetworkUserConfig } from "hardhat/types";
|
import { NetworkUserConfig } from "hardhat/types";
|
||||||
import "hardhat-contract-sizer";
|
import "hardhat-contract-sizer";
|
||||||
import { resolve } from "path";
|
import { resolve } from "path";
|
||||||
|
import "solidity-docgen";
|
||||||
|
|
||||||
dotenvConfig({ path: resolve(__dirname, "./.env") });
|
dotenvConfig({ path: resolve(__dirname, "./.env") });
|
||||||
|
|
||||||
@ -146,6 +147,9 @@ const config: HardhatUserConfig = {
|
|||||||
outDir: "src/types",
|
outDir: "src/types",
|
||||||
target: "ethers-v5",
|
target: "ethers-v5",
|
||||||
},
|
},
|
||||||
|
docgen: {
|
||||||
|
pages: "files",
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
@ -79,6 +79,7 @@
|
|||||||
"solhint": "^3.3.7",
|
"solhint": "^3.3.7",
|
||||||
"solhint-plugin-prettier": "^0.0.5",
|
"solhint-plugin-prettier": "^0.0.5",
|
||||||
"solidity-coverage": "^0.8.2",
|
"solidity-coverage": "^0.8.2",
|
||||||
|
"solidity-docgen": "^0.6.0-beta.36",
|
||||||
"ts-generator": "^0.1.1",
|
"ts-generator": "^0.1.1",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"typechain": "^8.1.1",
|
"typechain": "^8.1.1",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user