Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truffle <> relay compatibility #379

Merged
merged 6 commits into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/truffle-compatibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Truffle Compatibility

on:
pull_request:
branches: [ main, release/** ]
push:
branches: [ main, release/** ]
tags: [ v* ]

jobs:
setup-local-hedera:
name: Truffle Compatibility
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: 16

- name: Checkout repo
uses: actions/checkout@v2

- name: Install packages
run: npm ci

- name: Create .env file
run: |
cp ./tools/truffle-example/.env.example ./tools/truffle-example/.env
cp ./packages/server/tests/localAcceptance.env .env

- name: Lerna Bootstrap
run: npm run setup

- name: Install pnpm
run: npm install -g pnpm

- name: Build Typescript
run: npx lerna run build

- name: Run RPC Server
run: npm run integration:prerequisite &

- name: Install truffle dependencies
run: cd ./tools/truffle-example/ && npm ci

- name: Run the truffle tests
uses: nick-fields/retry@v2
with:
max_attempts: 10
timeout_minutes: 10
retry_wait_seconds: 45
command: cd ./tools/truffle-example/ && npx truffle test
5 changes: 5 additions & 0 deletions tools/truffle-example/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# all available private keys and addresses can be found here https://github.com/hashgraph/hedera-local-node#commands
OPERATOR_PRIVATE_KEY=0x105d050185ccb907fba04dd92d8de9e32c18305e097ab41dadda21489a211524
RECEIVER_PRIVATE_KEY=0x2e1d968b041d84dd120a5860cee60cd83f9374ef527ca86996317ada3d0d03e7
RELAY_URL='http://localhost'
RELAY_PORT=7546
9 changes: 9 additions & 0 deletions tools/truffle-example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules
.env
coverage
coverage.json
typechain
typechain-types

#Truffle files
build
18 changes: 18 additions & 0 deletions tools/truffle-example/contracts/Greeter.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;

contract Greeter {
string private greeting;

constructor(string memory _greeting) {
greeting = _greeting;
}

function greet() public view returns (string memory) {
return greeting;
}

function setGreeting(string memory _greeting) public {
greeting = _greeting;
}
}
25 changes: 25 additions & 0 deletions tools/truffle-example/migrations/1_deploy_greeter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*-
*
* Hedera JSON RPC Relay - Truffle Example
*
* Copyright (C) 2022 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

const Greeter = artifacts.require('Greeter');

module.exports = function (deployer) {
Nana-EC marked this conversation as resolved.
Show resolved Hide resolved
deployer.deploy(Greeter, 'initial_msg');
};
Loading