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

application-demo #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file added applications/application-demo/.DS_Store
Binary file not shown.
56 changes: 56 additions & 0 deletions applications/application-demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Acala x PolkaWorld Dapp Hackathon 2022

- Project Name: Name of your project (e.g. RiverSwap)
- Team Name: Legal name of your team (e.g. River)
- Project online usage link: https://
- Payment Address: Acala(aUSD) payment address.

## Project Overview 📄

### Overview

Please provide the following:

- If the name of your project is not descriptive, a tag line (one sentence summary).
- A brief description of your project.
- An indication of how your project relates to / integrates into Acala / Karura EVM+.
- An indication of why your team is interested in creating this project.

### Project Details

- Detailed description of the core functiona of the project.
- Project deployment step instructions.
- If necessary, please provide relevant test usage documentation.

### Ecosystem Fit

Help us locate your project in the Polkadot/Substrate/Kusama landscape and what problems it tries to solve by answering each of these questions:

- Where and how does your project fit into the ecosystem?
- What need(s) does your project meet?
- What makes your project unique?


## Team 👥

### Team members

- Name of team leader
- Names of team members

### Contact

- Contact Name: Full name of the contact person in your team
- Contact Email: Contact email (e.g. john@river.io)
- Website:

### Team's experience

Please describe the team's relevant experience. If your project involves development work, we would appreciate it if you singled out a few interesting projects or contributions made by team members in the past.

### Future Plans

Please include here

- how you intend to use, enhance, promote and support your project in the short term, and
- the team's long-term plans and intentions in relation to it.
9 changes: 9 additions & 0 deletions applications/application-demo/contracts/HelloWorld.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// SPDX-License-Identifier: MIT
pragma solidity =0.8.9;

contract HelloWorld {
string public helloWorld = 'Hello World!';

constructor() public {
}
}
19 changes: 19 additions & 0 deletions applications/application-demo/contracts/Migrations.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;

contract Migrations {
address public owner = msg.sender;
uint public last_completed_migration;

modifier restricted() {
require(
msg.sender == owner,
"This function is restricted to the contract's owner"
);
_;
}
function setCompleted(uint completed) public restricted {
last_completed_migration = completed;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const HelloWorld = artifacts.require("HelloWorld");

module.exports = async function (deployer) {
console.log("Deploying HelloWorld");

await deployer.deploy(HelloWorld);

console.log("HelloWorld deployed at:", HelloWorld.address);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const Migrations = artifacts.require("Migrations");

module.exports = function (deployer) {
deployer.deploy(Migrations);
};
24 changes: 24 additions & 0 deletions applications/application-demo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "truffle-tutorial-hello-world",
"version": "1.0.0",
"main": "index.js",
"author": "Jan Turk",
"license": "MIT",
"dependencies": {
"truffle": "^5.4.19"
},
"devDependencies": {
"@truffle/hdwallet-provider": "^1.6.0"
},
"scripts": {
"build": "truffle compile",
"test": "truffle test",
"test-mandala": "truffle test --network mandala",
"test-mandala:pubDev": "truffle test --network mandalaPublicDev",
"test-mandala:CI": "truffle test --network mandalaCI",
"deploy": "truffle migrate",
"deploy-mandala": "truffle migrate --network mandala",
"deploy-mandala:pubDev": "truffle migrate --network mandalaPublicDev",
"deploy-mandala:CI": "truffle migrate --network mandalaCI"
}
}
Empty file.
25 changes: 25 additions & 0 deletions applications/application-demo/test/hello_world.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const HelloWorld = artifacts.require("HelloWorld");

/*
* uncomment accounts to access the test accounts made available by the
* Ethereum client
* See docs: https://www.trufflesuite.com/docs/truffle/testing/writing-tests-in-javascript
*/
contract("HelloWorld", function (/* accounts */) {
let instance;

before("setup development environment", async function () {
instance = await HelloWorld.deployed();
return assert.isTrue(true);
});

it("should assert true", async function () {
console.log(instance.address);
});

it("returns the right value after the contract is deployed", async function() {
const hello_world = await instance.helloWorld();

expect(hello_world).to.equal("Hello World!");
});
});
119 changes: 119 additions & 0 deletions applications/application-demo/truffle-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
/**
* Use this file to configure your truffle project. It's seeded with some
* common settings for different networks and features like migrations,
* compilation and testing. Uncomment the ones you need or modify
* them to suit your project as necessary.
*
* More information about configuration can be found at:
*
* trufflesuite.com/docs/advanced/configuration
*
* To deploy via Infura you'll need a wallet provider (like @truffle/hdwallet-provider)
* to sign your transactions before they're sent to a remote public node. Infura accounts
* are available for free at: infura.io/register.
*
* You'll also need a mnemonic - the twelve word phrase the wallet uses to generate
* public/private key pairs. If you're publishing your code to GitHub make sure you load this
* phrase from a file you've .gitignored so it doesn't accidentally become public.
*
*/

const HDWalletProvider = require('@truffle/hdwallet-provider');
//
// const fs = require('fs');
// const mnemonic = fs.readFileSync(".secret").toString().trim();
const mnemonicPhrase = 'fox sight canyon orphan hotel grow hedgehog build bless august weather swarm';

const mandalaConfig = (endpointUrl) => ({
provider: () =>
new HDWalletProvider(mnemonicPhrase, endpointUrl),
network_id: 595,
gasPrice: 0x2f955803e9,
gas: 0x3293440,
timeoutBlocks: 25,
confirmations: 0
});

module.exports = {
/**
* Networks define how you connect to your ethereum client and let you set the
* defaults web3 uses to send transactions. If you don't specify one truffle
* will spin up a development blockchain for you on port 9545 when you
* run `develop` or `test`. You can ask a truffle command to use a specific
* network from the command line, e.g
*
* $ truffle test --network <network-name>
*/

networks: {
mandala: mandalaConfig("http://127.0.0.1:8545"),
mandalaPublicDev: mandalaConfig("https://tc7-eth.aca-dev.network"),
mandalaCI: mandalaConfig("http://eth-rpc-adapter-server:8545"),
// Useful for testing. The `development` name is special - truffle uses it by default
// if it's defined here and no other network is specified at the command line.
// You should run a client (like ganache-cli, geth or parity) in a separate terminal
// tab if you use this network and you must also set the `host`, `port` and `network_id`
// options below to some value.
//
development: {
host: "127.0.0.1", // Localhost (default: none)
port: 8545, // Standard Ethereum port (default: none)
network_id: "*", // Any network (default: none)
},
// Another network with more advanced options...
// advanced: {
// port: 8777, // Custom port
// network_id: 1342, // Custom network
// gas: 8500000, // Gas sent with each transaction (default: ~6700000)
// gasPrice: 20000000000, // 20 gwei (in wei) (default: 100 gwei)
// from: <address>, // Account to send txs from (default: accounts[0])
// websocket: true // Enable EventEmitter interface for web3 (default: false)
// },
// Useful for deploying to a public network.
// NB: It's important to wrap the provider as a function.
// ropsten: {
// provider: () => new HDWalletProvider(mnemonic, `https://ropsten.infura.io/v3/YOUR-PROJECT-ID`),
// network_id: 3, // Ropsten's id
// gas: 5500000, // Ropsten has a lower block limit than mainnet
// confirmations: 2, // # of confs to wait between deployments. (default: 0)
// timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50)
// skipDryRun: true // Skip dry run before migrations? (default: false for public nets )
// },
// Useful for private networks
// private: {
// provider: () => new HDWalletProvider(mnemonic, `https://network.io`),
// network_id: 2111, // This network is yours, in the cloud.
// production: true // Treats this network as if it was a public net. (default: false)
// }
},

// Set default mocha options here, use special reporters etc.
mocha: {
timeout: 100000
},

// Configure your compilers
compilers: {
solc: {
version: "0.8.9", // Fetch exact version from solc-bin (default: truffle's version)
// docker: true, // Use "0.5.1" you've installed locally with docker (default: false)
// settings: { // See the solidity docs for advice about optimization and evmVersion
// optimizer: {
// enabled: false,
// runs: 200
// },
// evmVersion: "byzantium"
// }
}
},

// Truffle DB is currently disabled by default; to enable it, change enabled: false to enabled: true
//
// Note: if you migrated your contracts prior to enabling this field in your Truffle project and want
// those previously migrated contracts available in the .db directory, you will need to run the following:
// $ truffle migrate --reset --compile-all

db: {
enabled: false
}
};