The StarklaneEscrow contract in Escrow.sol
does not verify the supply of ERC1155 tokens being transferred in or out of escrow. This could lead to unexpected behavior when dealing with ERC1155 tokens that have a supply other than 1.
The contract assumes that each ERC1155 token has a supply of exactly 1, but it doesn't verify this assumption. This is evident in two key functions:
Both functions transfer exactly 1 token, regardless of the actual supply. The contract also includes a TODO comment acknowledging this issue:
If an ERC1155 token has a supply greater than 1, the contract will only escrow and return a single token, potentially leaving additional tokens unaccounted for. It also doesn't handle cases where the supply might be 0, which could lead to failed transactions or inconsistent state and users cannot escrow or withdraw multiple copies of the same ERC1155 token ID.
Manual code review
Add a function to check the supply of ERC1155 tokens before escrowing them. You can use the balanceOf
function from the ERC1155 interface:
Also modify the _depositIntoEscrow
and _withdrawFromEscrow
functions to handle variable supplies:
```compatibilities: Blockchains: - Ethereum/Starknet Tokens: - [ERC721](www.tokenstandard.com) ``` ``` function depositTokens( uint256 salt, address collectionL1, snaddress ownerL2, uint256[] calldata ids, bool useAutoBurn ) external payable { if (!Cairo.isFelt252(snaddress.unwrap(ownerL2))) { revert CairoWrapError(); } if (!_enabled) { revert BridgeNotEnabledError(); } CollectionType ctype = TokenUtil.detectInterface(collectionL1); if (ctype == CollectionType.ERC1155) { @> revert NotSupportedYetError(); } … } ```
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.