Skip to content

Commit

Permalink
Add symbol macro
Browse files Browse the repository at this point in the history
  • Loading branch information
kadenzipfel committed Sep 12, 2022
1 parent 854941a commit ecef08e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/tokens/ERC721.huff
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#define constant APPROVAL_FOR_ALL_EVENT_SIGNATURE = 0x17307EAB39AB6107E8899845AD3D59BD9653F200F220920489CA2B5937696C31

/* Storage Slots */
#define constant SYMBOL_LOCATION = FREE_STORAGE_POINTER()
#define constant OWNER_LOCATION = FREE_STORAGE_POINTER() // ownerOf
#define constant BALANCE_LOCATION = FREE_STORAGE_POINTER() // balanceOf
#define constant SINGLE_APPROVAL_LOCATION = FREE_STORAGE_POINTER() // getApproved
Expand All @@ -41,6 +40,11 @@
NAME_OVERRIDE()
}

#define macro SYMBOL() = takes (0) returns (0) {
// Must setup override
SYMBOL_OVERRIDE()
}

#define macro BALANCE_OF() = takes (0) returns (0) {
0x04 calldataload // [account]
[BALANCE_LOCATION] LOAD_ELEMENT_FROM_KEYS(0x00) // [balance]
Expand Down Expand Up @@ -325,9 +329,9 @@
setApprovalForAll:
SET_APPROVAL_FOR_ALL()
name:
NAME() // not implemented yet
NAME()
symbol:
SYMBOL() // not implemented yet
SYMBOL()
tokenURI:
TOKEN_URI() // not implemented yet
supportsInterface:
Expand Down
7 changes: 7 additions & 0 deletions test/tokens/mocks/MockERC721.huff
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

// Constants
#define constant META_NAME = 0x05546f6b656e // "Token"
#define constant META_SYMBOL = 0x03544B4E // "TKN"

/// >>>>>>>>>>>>>>>>>>>>> OVERRIDES <<<<<<<<<<<<<<<<<<<<<< ///

Expand All @@ -12,6 +13,12 @@
0x60 0x20 return
}

#define macro SYMBOL_OVERRIDE() = takes (0) returns (0) {
0x20 0x20 mstore
[META_SYMBOL] 0x43 mstore
0x60 0x20 return
}

/// >>>>>>>>>>>>>>>>>>>>> EXTERNAL FUNCTIONS <<<<<<<<<<<<<<<<<<<<<< ///

#define macro MINT() = takes (0) returns (0) {
Expand Down

0 comments on commit ecef08e

Please sign in to comment.