Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Commit

Permalink
add github action
Browse files Browse the repository at this point in the history
  • Loading branch information
refcell committed Jun 25, 2022
1 parent 387ee37 commit 4dbc18b
Show file tree
Hide file tree
Showing 5 changed files with 240 additions and 0 deletions.
Empty file added .env.example
Empty file.
23 changes: 23 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Tests

on: [push]

jobs:
tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Install Huff
run: node ./dist/index.js
with:
version: nightly

- name: Install Dependencies
run: huffc examples/test.huff
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ yarn-debug.log*
yarn-error.log*
lerna-debug.log*

tmp

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

Expand Down
38 changes: 38 additions & 0 deletions examples/test.huff
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* Interface */
#define function setNumber(uint256) nonpayable returns ()
#define function getNumber() view returns (uint256)

/* Storage Slots */
#define constant NUMBER_LOCATION = FREE_STORAGE_POINTER()

/* Methods */
#define macro SET_NUMBER() = takes (0) returns (0) {
0x04 calldataload // [number]
[NUMBER_LOCATION] // [ptr, number]
sstore // []
}

#define macro GET_NUMBER() = takes (0) returns (0) {
// Load number from storage.
[NUMBER_LOCATION] // [ptr]
sload // [number]

// Store number in memory.
0x00 mstore

// Return number
0x20 0x00 return
}

#define macro MAIN() = takes (0) returns (0) {
// Identify which function is being called.
0x00 calldataload 0xE0 shr
dup1 0x3fb5c1cb eq set jumpi
dup1 0xf2c9ecd8 eq get jumpi

set:
SET_NUMBER()
get:
GET_NUMBER()

}
177 changes: 177 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4dbc18b

Please sign in to comment.