P2PIX
Methods
_castAddrToKey
Public method that handles address to uint256 safe type casting.
Function sighash: 0x4b2ae980.
Parameters
| Name |
Type |
Description |
| _addr |
address |
undefined |
Returns
| Name |
Type |
Description |
| _key |
uint256 |
undefined |
allowedERC20s
Tokens allowed to serve as the underlying amount of a deposit.
Parameters
| Name |
Type |
Description |
| _0 |
contract ERC20 |
undefined |
Returns
| Name |
Type |
Description |
| _0 |
bool |
undefined |
cancelDeposit
Enables seller to invalidate future locks made to his/her token offering order.
This function does not affect any ongoing active locks.Function sighash: 0x72fada5c.
Parameters
| Name |
Type |
Description |
| depositID |
uint256 |
undefined |
defaultLockBlocks
Default blocks that lock will hold tokens.
Returns
| Name |
Type |
Description |
| _0 |
uint256 |
undefined |
deposit
Creates a deposit order based on a seller's offer of an amount of ERC20 tokens.
Seller needs to send his tokens to the P2PIX smart contract.Function sighash: 0xbfe07da6.
Parameters
| Name |
Type |
Description |
| _token |
address |
undefined |
| _amount |
uint256 |
undefined |
| _pixTarget |
string |
Pix key destination provided by the offer's seller. |
| allowlistRoot |
bytes32 |
Optional allow list merkleRoot update bytes32 value. |
Returns
| Name |
Type |
Description |
| depositID |
uint256 |
The uint256 return value provided as the deposit identifier. |
depositCount
Returns
| Name |
Type |
Description |
| _val |
uint256 |
undefined |
lock
Public method designed to lock an remaining amount of the deposit order of a seller.
This method can be performed either by: - An user allowed via the seller's allowlist; - An user with enough userRecord to lock the wished amount; There can only exist a lock per each _amount partitioned from the total remaining value.Locks can only be performed in valid orders.Function sighash: 0x03aaf306.
Parameters
| Name |
Type |
Description |
| _depositID |
uint256 |
undefined |
| _buyerAddress |
address |
The address of the buyer of a _depositID. |
| _relayerTarget |
address |
Target address entitled to the relayerPremim. |
| _relayerPremium |
uint256 |
The refund/premium owed to a relayer. |
| _amount |
uint256 |
The deposit's remaining amount wished to be locked. |
| merkleProof |
bytes32[] |
This value should be: - Provided as a pass if the msg.sender is in the seller's allowlist; - Left empty otherwise; |
| expiredLocks |
bytes32[] |
An array of bytes32 identifiers to be provided so to unexpire locks using this transaction gas push. |
Returns
| Name |
Type |
Description |
| lockID |
bytes32 |
The bytes32 value returned as the lock identifier. |
mapDeposits
Seller list of deposits
Parameters
| Name |
Type |
Description |
| _0 |
uint256 |
undefined |
Returns
| Name |
Type |
Description |
| remaining |
uint256 |
undefined |
| pixTarget |
string |
undefined |
| seller |
address |
undefined |
| token |
address |
undefined |
| valid |
bool |
undefined |
mapLocks
List of Locks.
Parameters
| Name |
Type |
Description |
| _0 |
bytes32 |
undefined |
Returns
| Name |
Type |
Description |
| depositID |
uint256 |
undefined |
| relayerPremium |
uint256 |
undefined |
| amount |
uint256 |
undefined |
| expirationBlock |
uint256 |
undefined |
| buyerAddress |
address |
undefined |
| relayerTarget |
address |
undefined |
| relayerAddress |
address |
undefined |
owner
Returns
| Name |
Type |
Description |
| _0 |
address |
undefined |
release
Lock release method that liquidate lock orders and distributes relayer fees.
This method can be called by any public actor as long the signature provided is valid.relayerPremium gets splitted equaly if relayerTarget addresses differ.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. In case of they differing: - lock caller gets accrued with l.amount as userRecord credit; - release caller gets accrued with l.relayerPremium as userRecord credit; Function sighash: 0x4e1389ed.
Parameters
| Name |
Type |
Description |
| lockID |
bytes32 |
undefined |
| _relayerTarget |
address |
Target address entitled to the relayerPremim. |
| pixTimestamp |
uint256 |
undefined |
| r |
bytes32 |
undefined |
| s |
bytes32 |
undefined |
| v |
uint8 |
undefined |
reputation
███ Storage ████████████████████████████████████████████████████████████
Returns
| Name |
Type |
Description |
| _0 |
contract IReputation |
undefined |
sellerAllowList
Seller casted to key => Seller's allowlist merkleroot.
Parameters
| Name |
Type |
Description |
| _0 |
uint256 |
undefined |
Returns
| Name |
Type |
Description |
| _0 |
bytes32 |
undefined |
setDefaultLockBlocks
Parameters
| Name |
Type |
Description |
| _blocks |
uint256 |
undefined |
setOwner
Parameters
| Name |
Type |
Description |
| newOwner |
address |
undefined |
setReputation
Parameters
| Name |
Type |
Description |
| _reputation |
contract IReputation |
undefined |
setRoot
Parameters
| Name |
Type |
Description |
| addr |
address |
undefined |
| merkleroot |
bytes32 |
undefined |
setValidSigners
Parameters
| Name |
Type |
Description |
| _validSigners |
address[] |
undefined |
tokenSettings
Parameters
| Name |
Type |
Description |
| _tokens |
address[] |
undefined |
| _states |
bool[] |
undefined |
unlockExpired
Unlocks expired locks.
Triggered in the callgraph by both lock and withdraw functions.This method can also have any public actor as its tx.origin.For each successfull unexpired lock recovered, userRecord[_castAddrToKey(l.relayerAddress)] is decreased by half of its value.Function sighash: 0x8e2749d6.
Parameters
| Name |
Type |
Description |
| lockIDs |
bytes32[] |
undefined |
userRecord
Stores an relayer's last computed credit.
Parameters
| Name |
Type |
Description |
| _0 |
uint256 |
undefined |
Returns
| Name |
Type |
Description |
| _0 |
uint256 |
undefined |
validBacenSigners
List of valid Bacen signature addresses
Parameters
| Name |
Type |
Description |
| _0 |
uint256 |
undefined |
Returns
| Name |
Type |
Description |
| _0 |
bool |
undefined |
withdraw
Seller's expired deposit fund sweeper.
A seller may use this method to recover tokens from expired deposits.Function sighash: 0x36317972.
Parameters
| Name |
Type |
Description |
| depositID |
uint256 |
undefined |
| expiredLocks |
bytes32[] |
undefined |
withdrawBalance
Contract's underlying balance withdraw method.Function sighash: 0x5fd8c710.
Events
AllowedERC20Updated
Parameters
| Name |
Type |
Description |
token indexed |
address |
undefined |
state indexed |
bool |
undefined |
DepositAdded
███ Events ████████████████████████████████████████████████████████████
Parameters
| Name |
Type |
Description |
seller indexed |
address |
undefined |
| depositID |
uint256 |
undefined |
| token |
address |
undefined |
| amount |
uint256 |
undefined |
DepositClosed
Parameters
| Name |
Type |
Description |
seller indexed |
address |
undefined |
| depositID |
uint256 |
undefined |
DepositWithdrawn
Parameters
| Name |
Type |
Description |
seller indexed |
address |
undefined |
| depositID |
uint256 |
undefined |
| amount |
uint256 |
undefined |
FundsWithdrawn
Parameters
| Name |
Type |
Description |
| owner |
address |
undefined |
| amount |
uint256 |
undefined |
LockAdded
Parameters
| Name |
Type |
Description |
buyer indexed |
address |
undefined |
lockID indexed |
bytes32 |
undefined |
| depositID |
uint256 |
undefined |
| amount |
uint256 |
undefined |
LockBlocksUpdated
Parameters
| Name |
Type |
Description |
| blocks |
uint256 |
undefined |
LockReleased
Parameters
| Name |
Type |
Description |
buyer indexed |
address |
undefined |
| lockId |
bytes32 |
undefined |
LockReturned
Parameters
| Name |
Type |
Description |
buyer indexed |
address |
undefined |
| lockId |
bytes32 |
undefined |
OwnerUpdated
Parameters
| Name |
Type |
Description |
user indexed |
address |
undefined |
newOwner indexed |
address |
undefined |
ReputationUpdated
Parameters
| Name |
Type |
Description |
| reputation |
address |
undefined |
ValidSignersUpdated
Parameters
| Name |
Type |
Description |
| signers |
address[] |
undefined |
Errors
AddressDenied
Address doesn't exist in a MerkleTree.Address not allowed as relayer.0x3b8474be
AlreadyReleased
Lock already released or returned.0x63b4904e
AmountNotAllowed
Wished amount to be locked exceeds the limit allowed.0x1c18f846
DepositAlreadyExists
Deposit already exist and it is still valid.0xc44bd765
InvalidDeposit
Deposit not valid anymore.0xb2e532de
InvalidSigner
Signer is not a valid signer.0x815e1d64
LengthMismatch
Arrays' length don't match.0xff633a38
LoopOverflow
Loop bounds have overflowed.0xdfb035c9
NoTokens
No tokens array provided as argument.0xdf957883
NotEnoughTokens
Not enough token remaining on deposit.0x22bbb43c
NotExpired
Lock not expired or already released.Another lock with same ID is not expired yet.0xd0404f85
OnlySeller
Only seller could call this function.msg.sender and the seller differ.0x85d1f726
Reentrancy
TokenDenied
Token address not allowed to be deposited.0x1578328e
TxAlreadyUsed
Transaction already used to unlock payment.0xf490a6ea