-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
121 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: 👷♂️ CI | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
clean: false | ||
|
||
- name: Use pnpm | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8.4.0 | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20.9.0 | ||
cache: 'pnpm' | ||
|
||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: Run CI Checks | ||
run: pnpm run checks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: 🦄 PR Name | ||
on: | ||
pull_request: | ||
types: [opened, edited, synchronize, reopened] | ||
permissions: | ||
pull-requests: read | ||
jobs: | ||
emoji: | ||
name: Starts with emoji | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: deepakputhraya/action-pr-title@v1.0.2 | ||
with: | ||
# Check if first character is an emoji, regex borrowed from https://medium.com/reactnative/emojis-in-javascript-f693d0eb79fb#.enomgcu63 | ||
regex: '^(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|[\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|[\ud83c[\ude32-\ude3a]|[\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])' | ||
github_token: ${{ github.token }} | ||
capitalised: | ||
name: Starts with space and capital letter | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: deepakputhraya/action-pr-title@v1.0.2 | ||
with: | ||
regex: '^[^a-zA-Z0-9\s]+ [A-Z]' | ||
github_token: ${{ github.token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v20.9.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,60 @@ | ||
import { OpCodeBuilder } from "./OpCodeBuilder" | ||
import { OpCodeBuilder } from './OpCodeBuilder' | ||
|
||
export function createDataForBytecode(bytecode: string, callData: string) { | ||
bytecode.startsWith('0x') ? (bytecode = bytecode.slice(2)) : bytecode | ||
callData.startsWith('0x') ? (callData = callData.slice(2)) : callData | ||
const dat = bytecode + callData | ||
const opCodeBuilder = new OpCodeBuilder() | ||
const callDataMemPos = bytecode.length / 2 | ||
opCodeBuilder | ||
.pushBytesSizeToStack(dat) | ||
.pushBytesSizeToStack(dat) | ||
.addOpCode('CODESIZE') | ||
.addOpCode('SUB') | ||
.pushToStack('00') | ||
.addOpCode('CODECOPY') | ||
// retSize | ||
.pushToStack('00') | ||
// retOffset | ||
.pushToStack('00') | ||
// argsSize | ||
.pushBytesSizeToStack(callData) | ||
// argsOffset | ||
.pushToStack(callDataMemPos) | ||
// value | ||
.pushToStack('00') | ||
// size for create opcode | ||
.pushBytesSizeToStack(bytecode) | ||
// offset for create opcode | ||
.pushToStack('00') | ||
//value for create opcode | ||
.pushToStack('00') | ||
.addOpCode('CREATE') | ||
.pushToStack('FF'.repeat(32)) | ||
.addOpCode('CALL') | ||
// get return data size | ||
.addOpCode('RETURNDATASIZE') | ||
// dup return data size | ||
.addOpCode('DUP1') | ||
.pushToStack('00') | ||
.pushToStack('00') | ||
.addOpCode('RETURNDATACOPY') | ||
.pushToStack('00') | ||
.addOpCode('RETURN') | ||
.addBytes(dat) | ||
return opCodeBuilder.toString() | ||
} | ||
bytecode.startsWith('0x') ? (bytecode = bytecode.slice(2)) : bytecode | ||
callData.startsWith('0x') ? (callData = callData.slice(2)) : callData | ||
|
||
const dat = bytecode + callData | ||
|
||
const opCodeBuilder = new OpCodeBuilder() | ||
|
||
const callDataMemPos = bytecode.length / 2 | ||
|
||
opCodeBuilder | ||
.pushBytesSizeToStack(dat) | ||
.pushBytesSizeToStack(dat) | ||
.addOpCode('CODESIZE') | ||
.addOpCode('SUB') | ||
.pushToStack('00') | ||
.addOpCode('CODECOPY') | ||
// retSize | ||
.pushToStack('00') | ||
// retOffset | ||
.pushToStack('00') | ||
|
||
// argsSize | ||
.pushBytesSizeToStack(callData) | ||
|
||
// argsOffset | ||
.pushToStack(callDataMemPos) | ||
|
||
// value | ||
.pushToStack('00') | ||
|
||
// size for create opcode | ||
.pushBytesSizeToStack(bytecode) | ||
|
||
// offset for create opcode | ||
.pushToStack('00') | ||
|
||
//value for create opcode | ||
.pushToStack('00') | ||
.addOpCode('CREATE') | ||
|
||
.pushToStack('FF'.repeat(32)) | ||
|
||
.addOpCode('CALL') | ||
// get return data size | ||
.addOpCode('RETURNDATASIZE') | ||
// dup return data size | ||
.addOpCode('DUP1') | ||
|
||
.pushToStack('00') | ||
.pushToStack('00') | ||
.addOpCode('RETURNDATACOPY') | ||
|
||
.pushToStack('00') | ||
.addOpCode('RETURN') | ||
.addBytes(dat) | ||
return opCodeBuilder.toString() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters