Skip to content

Commit

Permalink
docs: add interface ID source comments and mark ERC20 as arbitrary
Browse files Browse the repository at this point in the history
- Added source comments for ERC721 and ERC1155 interface IDs linking to OpenZeppelin implementation
- Added note that ERC20 interface ID is arbitrary and incorrect since ERC20 does not implement introspection on Starknet
- This interface ID should be removed in a future PR since it's not used and could be misleading
  • Loading branch information
ametel01 committed Jan 24, 2025
1 parent 02b82af commit d78f0f2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
12 changes: 9 additions & 3 deletions src/hub/pwn_hub_tags.cairo
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
pub const ACTIVE_LOAN: felt252 = 0x0256ea094d7a53440eef11fa42b63159fbf703b4ee579494a6ae85afc5603594;
pub const LOAN_PROPOSAL: felt252 = 0xba7a416221f318a8087fd62f9ff407488b7f5501e79caf9b0666c2df326b9c;
pub const NONCE_MANAGER: felt252 = 0x1b33e4d1c538d376dd219215a123562fbb87b8c85fa2aa4ebbd8810c2454d9;
// poseidon hash of "ACTIVE_LOAN"
pub const ACTIVE_LOAN: felt252 = 0x2da9b57d658216ce2fa66b405ad5a2a11eac0998c648d4243d8dfb9e97919f1;
// poseidon hash of "LOAN_PROPOSAL"
pub const LOAN_PROPOSAL: felt252 =
0x13a6d5f3fcb779ea994158e2546ffacaf9aa91df747f4496791143eec4aa3a7;
// poseidon hash of "NONCE_MANAGER"
pub const NONCE_MANAGER: felt252 =
0x1f46107c5dc94152b3311a2730f7ec7aebc3a62932fb0d4c5ea2f2db9b35154;

5 changes: 3 additions & 2 deletions src/multitoken/library.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@ pub mod MultiToken {
use starknet::ContractAddress;
use super::{CategoryIntoU8, CategoryEq};

// NOTE: tokens standard interface id are pretty inconsistent on Starknet at the moment due to frequent updates
// the interface_id below are based on the full OpenZeppelin interfaces (named as ABI)
// The below interface is WRONG, ERC20 does not implement introspection on Starknet
const ERC20_INTERFACE_ID: felt252 =
0x3d21dcd478803698af065a01681e1f1801a5b80c367ecb5561fbf10b416756e;
// Source: https://github.com/OpenZeppelin/cairo-contracts/blob/82d77bec96889d8c830647812e53259710c72151/packages/token/src/erc721/interface.cairo#L6
const ERC721_INTERFACE_ID: felt252 =
0x2c8b9553a387f54d6021766166528967ac9bb9393acf1c47678b9eea63dda07;
// Source: https://github.com/OpenZeppelin/cairo-contracts/blob/82d77bec96889d8c830647812e53259710c72151/packages/token/src/erc1155/interface.cairo#L6
const ERC1155_INTERFACE_ID: felt252 =
0xcd38fd6bb8f64dd3988ff3ae65d0cd040c95aaad81b509a1f4f0b3e40adf88;

Expand Down

0 comments on commit d78f0f2

Please sign in to comment.