-
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
1 parent
551a57e
commit 6226b97
Showing
5 changed files
with
625 additions
and
3 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
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 @@ | ||
import fs from 'node:fs' | ||
import { compileSol } from 'solc-typed-ast' | ||
|
||
type Hex = `0x${string}` | ||
|
||
interface TestContracts { | ||
Array: Hex | ||
} | ||
|
||
let contracts: TestContracts | undefined = undefined | ||
|
||
async function getContracts() { | ||
const files = fs.readdirSync('test/contracts') | ||
|
||
const result = await compileSol( | ||
files.map((file) => `test/contracts/${file}`), | ||
'auto' | ||
) | ||
|
||
const resultData: Record<string, Hex> = {} | ||
for (const file in result.data.contracts) { | ||
const contractFile = result.data.contracts[file] | ||
for (const contract in contractFile) { | ||
const contractData = contractFile[contract] | ||
resultData[contract] = contractData.evm.bytecode.object | ||
} | ||
} | ||
|
||
contracts = resultData as any as TestContracts | ||
|
||
return contracts | ||
} | ||
|
||
getContracts() |
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 @@ | ||
6080604052348015600e575f80fd5b505f6001908060018154018082558091505060019003905f5260205f20015f90919091909150555f6002908060018154018082558091505060019003905f5260205f20015f90919091909150555f6003908060018154018082558091505060019003905f5260205f20015f90919091909150556101fc8061008e5f395ff3fe608060405234801561000f575f80fd5b506004361061003f575f3560e01c80631f7b6d321461004357806371e5ee5f146100615780639507d39a14610091575b5f80fd5b61004b6100c1565b6040516100589190610127565b60405180910390f35b61007b6004803603810190610076919061016e565b6100cc565b6040516100889190610127565b60405180910390f35b6100ab60048036038101906100a6919061016e565b6100eb565b6040516100b89190610127565b60405180910390f35b5f8080549050905090565b5f81815481106100da575f80fd5b905f5260205f20015f915090505481565b5f8082815481106100ff576100fe610199565b5b905f5260205f2001549050919050565b5f819050919050565b6101218161010f565b82525050565b5f60208201905061013a5f830184610118565b92915050565b5f80fd5b61014d8161010f565b8114610157575f80fd5b50565b5f8135905061016881610144565b92915050565b5f6020828403121561018357610182610140565b5b5f6101908482850161015a565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffdfea2646970667358221220cfa922f1de4784cf84b2a5d8df78092ab05d20e96e739a792cf5fd742beb886e64736f6c63430008190033 |
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,20 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
contract Array { | ||
uint256[] public arr; | ||
|
||
constructor() { | ||
arr.push(1); | ||
arr.push(2); | ||
arr.push(3); | ||
} | ||
|
||
function get(uint256 _index) public view returns (uint256) { | ||
return arr[_index]; | ||
} | ||
|
||
function length() public view returns (uint256) { | ||
return arr.length; | ||
} | ||
} |
Oops, something went wrong.