emojity-website

emojidity

The Emoji language for the Ethereum Virtual Machine.

Run the web compiler

npm i -g lite-server
lite-server

Emojidity by Example

Counter Contract

0οΈβƒ£πŸ€—0️⃣

πŸ”’πŸ‡

πŸ‡πŸ”ΌπŸ“’β†©οΈπŸ”’
🏁
  πŸ‡πŸ“₯πŸ‡βž•1️⃣
  β†©οΈπŸ‡
πŸ”š

πŸ‡β“πŸ‘€β†©οΈπŸ”’
🏁
  β†©οΈπŸ‡
πŸ”š

Calculator

0οΈβƒ£πŸ€—0️⃣

πŸŠβž•πŸ‘€πŸ”’πŸ‡πŸ”’πŸ“β†©οΈπŸ”’
🏁
  πŸ”’πŸŠ
  🍊πŸ“₯πŸ‡βž•πŸ“
  β†©οΈπŸŠ
πŸ”š

πŸŠβž–πŸ‘€πŸ”’πŸ‡πŸ”’πŸ“β†©οΈπŸ”’
🏁
  πŸ”’πŸŠ
  🍊πŸ“₯πŸ‡βž–πŸ“
  β†©οΈπŸŠ
πŸ”š

Staking

0οΈβƒ£πŸ€—0️⃣

πŸ—ΊοΈπŸ‡

πŸ‡πŸ”ΌπŸ“’β†©οΈπŸ”’
🏁
  πŸ‡πŸ‘€πŸ“₯πŸ‡πŸ‘€βž•πŸ’°
  ↩️1️⃣
πŸ”š

πŸ‡πŸ”½πŸ“’β†©οΈπŸ”’
🏁
  πŸ”’πŸ“
  πŸ“πŸ“₯πŸ‡πŸ‘€
  πŸ‡πŸ‘€πŸ“₯0️⃣
  πŸ“‘πŸ‘€πŸ“0οΈβƒ£πŸ’ΈπŸ“β›½0️⃣
  ↩️1️⃣
πŸ”š

πŸ‡β“πŸ‘€#οΈβƒ£πŸ“β†©οΈπŸ”’
🏁
  β†©οΈπŸ‡πŸ“
πŸ”š

ERC20 Token

0οΈβƒ£πŸ€—0️⃣

πŸ—ΊοΈπŸ’°
πŸ—ΊοΈπŸ›‚
πŸ”’πŸ“

πŸ‘·
🏁
  πŸ“πŸ“₯1️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣
  πŸ’°πŸ‘€πŸ“₯πŸ“
  πŸ“‘πŸͺ™πŸššπŸ“‘0οΈβƒ£πŸ“‘πŸ‘€πŸ“‘πŸ“
πŸ”š

πŸͺ™πŸ’°πŸ‘€β†©οΈπŸ”’
🏁
  β†©οΈπŸ“
πŸ”š

πŸͺ™πŸ€‘πŸ‘€#οΈβƒ£πŸ“β†©οΈπŸ”’
🏁
  β†©οΈπŸ’°πŸ“
πŸ”š

πŸͺ™πŸ’ΈπŸ“’#οΈβƒ£πŸ“πŸ”’πŸ‡β†©οΈβ˜―οΈ
🏁
  πŸ’°πŸ‘€πŸ“₯πŸ’°πŸ‘€βž–πŸ‡
  πŸ’°πŸ“πŸ“₯πŸ’°πŸ“βž•πŸ‡
  πŸ“‘πŸͺ™πŸššπŸ“‘πŸ‘€πŸ“‘πŸ“πŸ“‘πŸ‡
  ↩️1️⃣
πŸ”š

πŸͺ™πŸ›‚πŸ‘€#οΈβƒ£πŸ“#οΈβƒ£πŸ‡β†©οΈπŸ”’
🏁
  β†©οΈπŸ›‚πŸ“πŸ‡
πŸ”š

πŸͺ™βœ…πŸ“’#οΈβƒ£πŸ“πŸ”’πŸ‡β†©οΈβ˜―οΈ
🏁
  πŸ›‚πŸ‘€πŸ“πŸ“₯πŸ‡
  ↩️1️⃣
πŸ”š

πŸͺ™πŸ§πŸ“’#οΈβƒ£πŸ“#οΈβƒ£πŸ‡πŸ”’πŸŠβ†©οΈβ˜―οΈ
🏁
  πŸ›‚πŸ“πŸ‘€πŸ“₯πŸ›‚πŸ“πŸ‘€βž–πŸŠ
  πŸ’°πŸ“πŸ“₯πŸ’°πŸ“βž–πŸŠ
  πŸ’°πŸ‡πŸ“₯πŸ’°πŸ‡βž•πŸŠ
  πŸ“‘πŸͺ™πŸššπŸ“‘πŸ“πŸ“‘πŸ‡πŸ“‘πŸŠ
  ↩️1️⃣
πŸ”š

πŸͺ™πŸ“›πŸ‘€β†©οΈπŸ”‘
🏁
  ↩️8️⃣3️⃣9️⃣3️⃣2️⃣6️⃣7️⃣4️⃣7️⃣5️⃣6️⃣3️⃣2️⃣9️⃣7️⃣7️⃣3️⃣7️⃣3️⃣6️⃣8️⃣7️⃣9️⃣4️⃣7️⃣0️⃣
πŸ”š

πŸͺ™πŸ†”πŸ‘€β†©οΈπŸ”‘
🏁
  ↩️2️⃣9️⃣7️⃣6️⃣4️⃣9️⃣7️⃣8️⃣5️⃣4️⃣1️⃣7️⃣
πŸ”š

πŸͺ™πŸ₯§πŸ‘€β†©οΈπŸ”’8️⃣
🏁
  ↩️1️⃣8️⃣
πŸ”š

1 to 1 Pegswap

0οΈβƒ£πŸ€—0️⃣

πŸ…°οΈπŸ…±οΈπŸ“’πŸ”’πŸ‡β†©οΈβ˜―οΈ
🏁
  πŸ“‘6️⃣1️⃣7️⃣4️⃣1️⃣9️⃣2️⃣5️⃣4️⃣7️⃣7️⃣1️⃣2️⃣7️⃣2️⃣1️⃣0️⃣2️⃣2️⃣5️⃣8️⃣6️⃣7️⃣2️⃣0️⃣2️⃣1️⃣4️⃣8️⃣5️⃣4️⃣5️⃣2️⃣4️⃣8️⃣1️⃣9️⃣7️⃣0️⃣2️⃣1️⃣6️⃣4️⃣2️⃣7️⃣4️⃣9️⃣5οΈβƒ£πŸ“5️⃣9️⃣9️⃣2️⃣9️⃣0️⃣5️⃣8️⃣9οΈβƒ£πŸ’Έ0️⃣⛽1️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣#οΈβƒ£πŸ‘€#οΈβƒ£πŸ‘‡πŸ”’πŸ‡
  πŸ“‘9️⃣4️⃣6️⃣6️⃣7️⃣6️⃣1️⃣4️⃣9️⃣1️⃣4️⃣2️⃣9️⃣0️⃣8️⃣5️⃣2️⃣3️⃣2️⃣0️⃣4️⃣1️⃣6️⃣5️⃣5️⃣2️⃣7️⃣8️⃣1️⃣5️⃣3️⃣3️⃣6️⃣7️⃣7️⃣5️⃣7️⃣3️⃣9️⃣4️⃣2️⃣5️⃣4️⃣5️⃣4️⃣6️⃣6️⃣8οΈβƒ£πŸ“2️⃣8️⃣3️⃣5️⃣7️⃣1️⃣7️⃣3️⃣0️⃣7️⃣⛽1️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣#οΈβƒ£πŸ‘€πŸ”’πŸ‡
  ↩️1️⃣
πŸ”š

πŸ…±οΈπŸ…°οΈπŸ“’πŸ”’πŸ‡β†©οΈβ˜―οΈ
🏁
  πŸ“‘9️⃣4️⃣6️⃣6️⃣7️⃣6️⃣1️⃣4️⃣9️⃣1️⃣4️⃣2️⃣9️⃣0️⃣8️⃣5️⃣2️⃣3️⃣2️⃣0️⃣4️⃣1️⃣6️⃣5️⃣5️⃣2️⃣7️⃣8️⃣1️⃣5️⃣3️⃣3️⃣6️⃣7️⃣7️⃣5️⃣7️⃣3️⃣9️⃣4️⃣2️⃣5️⃣4️⃣5️⃣4️⃣6️⃣6️⃣8οΈβƒ£πŸ“5️⃣9️⃣9️⃣2️⃣9️⃣0️⃣5️⃣8️⃣9οΈβƒ£πŸ’Έ0️⃣⛽1️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣#οΈβƒ£πŸ‘€#οΈβƒ£πŸ‘‡πŸ”’πŸ‡
  πŸ“‘6️⃣1️⃣7️⃣4️⃣1️⃣9️⃣2️⃣5️⃣4️⃣7️⃣7️⃣1️⃣2️⃣7️⃣2️⃣1️⃣0️⃣2️⃣2️⃣5️⃣8️⃣6️⃣7️⃣2️⃣0️⃣2️⃣1️⃣4️⃣8️⃣5️⃣4️⃣5️⃣2️⃣4️⃣8️⃣1️⃣9️⃣7️⃣0️⃣2️⃣1️⃣6️⃣4️⃣2️⃣7️⃣4️⃣9️⃣5οΈβƒ£πŸ“2️⃣8️⃣3️⃣5️⃣7️⃣1️⃣7️⃣3️⃣0️⃣7οΈβƒ£πŸ’Έ0️⃣⛽1️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣#οΈβƒ£πŸ‘€πŸ”’πŸ‡
  ↩️1️⃣
πŸ”š

Structure of a Contract

The following is the structure of a contract.

STATE_VARIABLES

CONSTRUCTOR (Optional)

FUNCTION_1

FUNCTION_2

FUNCTION_3

...

State variables

State variables are variables whose values are permanently stored in contract storage.

πŸ”’πŸ“ // Uint variable declared on the stack
πŸ—ΊοΈπŸ’° // This is hashmap

Constructor

The costructor code will be executed only once, when the contract is deployed.

πŸ‘·
🏁
  πŸ’°πŸ‘€πŸ“₯1️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣
  πŸ“‘πŸͺ™πŸššπŸ“‘0οΈβƒ£πŸ“‘πŸ‘€πŸ“‘1️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣0️⃣
πŸ”š

Functions

Functions are the executable units of code.

πŸͺ™πŸ₯§πŸ‘€β†©οΈπŸ”’8️⃣
🏁
  ↩️1️⃣8️⃣
πŸ”š

Function Calls can either be πŸ‘€ view or πŸ“’ public. Functions accept parameters and return variables to pass parameters and values between them.

Functions are composed by:

The following is the syntaxis of a function:

NAME VISIBILITY PARAMS ↩️ RETURN_TYPE
🏁
  INSTRUCTIONS
πŸ”š

Types

Emoji Type
πŸ”’ unsigned intenger
πŸ”‘ string
#️⃣ address
πŸ—ΊοΈ mapping
☯️ boolean

Special emojis

Emoji Type
πŸ‘€ The caller address, msg.sender on solidity
πŸ‘‡ Current contract address, this on solidity
πŸ’° Ether amount sent, msg.value on solidity

Instructions

Return

Gracefully stops the function execution and returns a value.

↩️ VALUE

Example:

β†©οΈπŸ“

Assignment

Assigns a value to a variable. Notice function parameters are not assignable.

VARIABLE πŸ“₯ VALUE

Example:

πŸ“πŸ“₯πŸ‡

Addition

Sums two values and assign the result to a variable.

VARIABLE πŸ“₯ VALUE βž• VALUE

Example:

πŸ“πŸ“₯πŸ‡βž•πŸŠ

Subtraction

Subtracts a value to another and assign the result to a variable.

VARIABLE πŸ“₯ VALUE βž– VALUE

Example:

πŸ“πŸ“₯πŸ‡βž–πŸŠ

If Statement

Executes a set of instructions if a variable value is different than 0.

❓VARIABLE
🏁
  INSTRUCTIONS
πŸ”š

Example:

β“πŸ“
🏁
  πŸ“πŸ“₯πŸ‡
πŸ”š

Loop

Executes repeatedly a set of instructions as long as a variable value is different than 0.

πŸ”„VARIABLE
🏁
  INSTRUCTIONS
πŸ”š

Example:

πŸ”„πŸ“
🏁
  πŸ“πŸ“₯πŸ“βž–1️⃣
  πŸ‡πŸ“₯πŸ‡βž•5️⃣
πŸ”š

Logs (Events)

Logs an event to the blockchain. Notice the name is a 2 emoji signature. Up to 4 topics are supported.

πŸ“‘ NAME πŸ“‘ TOPIC1 πŸ“‘ TOPIC2 πŸ“‘ TOPIC3

Example:

πŸ“‘πŸͺ™πŸššπŸ“‘πŸ‘€πŸ“‘πŸ“πŸ“‘πŸ‡

External calls

Makes a call to an external account. Use this to call a function to an external smart contract or to send eth.

πŸ“‘ EXTERNAL_ACCOUNT_ADDRESS πŸ“ SELECTOR πŸ’Έ ETHER_SENT β›½ MAXIMUM_GAS_USED

Example:

πŸ“‘πŸ‘€πŸ“0οΈβƒ£πŸ’ΈπŸ“β›½0️⃣