Skip to content

Commit

Permalink
Merge pull request #1 from thepiwo/feature/update-iris
Browse files Browse the repository at this point in the history
update for iris
  • Loading branch information
thepiwo authored Jun 4, 2021
2 parents 37c7250 + 3600958 commit 982b11d
Show file tree
Hide file tree
Showing 14 changed files with 1,564 additions and 147 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@master
- name: Use Node.js 12.x
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- run: npm install -g aeproject
node-version: 14.x
- run: npm install -g @aeternity/aeproject
- run: npm install
- run: aeproject env
- run: aeproject test
17 changes: 17 additions & 0 deletions config/network.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"testnet": {
"nodeUrl": "https://testnet.aeternity.io",
"compilerUrl": "https://latest.compiler.aepps.com",
"middlewareUrl": "https://testnet.aeternity.io/mdw"
},
"mainnet": {
"nodeUrl": "https://mainnet.aeternity.io",
"compilerUrl": "https://latest.compiler.aepps.com",
"middlewareUrl": "https://mainnet.aeternity.io/mdw"
},
"local": {
"nodeUrl": "http://localhost:3001",
"compilerUrl": "http://localhost:3080",
"middlewareUrl": null
}
}
44 changes: 44 additions & 0 deletions config/wallets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"defaultWallets": [
{
"publicKey": "ak_fUq2NesPXcYZ1CcqBcGC3StpdnQw3iVxMA3YSeCNAwfN4myQk",
"secretKey": "7c6e602a94f30e4ea7edabe4376314f69ba7eaa2f355ecedb339df847b6f0d80575f81ffb0a297b7725dc671da0b1769b1fc5cbe45385c7b5ad1fc2eaf1d609d"
},
{
"publicKey": "ak_tWZrf8ehmY7CyB1JAoBmWJEeThwWnDpU4NadUdzxVSbzDgKjP",
"secretKey": "7fa7934d142c8c1c944e1585ec700f671cbc71fb035dc9e54ee4fb880edfe8d974f58feba752ae0426ecbee3a31414d8e6b3335d64ec416f3e574e106c7e5412"
},
{
"publicKey": "ak_FHZrEbRmanKUe9ECPXVNTLLpRP2SeQCLCT6Vnvs9JuVu78J7V",
"secretKey": "1509d7d0e113528528b7ce4bf72c3a027bcc98656e46ceafcfa63e56597ec0d8206ff07f99ea517b7a028da8884fb399a2e3f85792fe418966991ba09b192c91"
},
{
"publicKey": "ak_RYkcTuYcyxQ6fWZsL2G3Kj3K5WCRUEXsi76bPUNkEsoHc52Wp",
"secretKey": "58bd39ded1e3907f0b9c1fbaa4456493519995d524d168e0b04e86400f4aa13937bcec56026494dcf9b19061559255d78deea3281ac649ca307ead34346fa621"
},
{
"publicKey": "ak_2VvB4fFu7BQHaSuW5EkQ7GCaM5qiA5BsFUHjJ7dYpAaBoeFCZi",
"secretKey": "50458d629ae7109a98e098c51c29ec39c9aea9444526692b1924660b5e2309c7c55aeddd5ebddbd4c6970e91f56e8aaa04eb52a1224c6c783196802e136b9459"
},
{
"publicKey": "ak_286tvbfP6xe4GY9sEbuN2ftx1LpavQwFVcPor9H4GxBtq5fXws",
"secretKey": "707881878eacacce4db463de9c7bf858b95c3144d52fafed4a41ffd666597d0393d23cf31fcd12324cd45d4784d08953e8df8283d129f357463e6795b40e88aa"
},
{
"publicKey": "ak_f9bmi44rdvUGKDsTLp3vMCMLMvvqsMQVWyc3XDAYECmCXEbzy",
"secretKey": "9262701814da8149615d025377e2a08b5f10a6d33d1acaf2f5e703e87fe19c83569ecc7803d297fde01758f1bdc9e0c2eb666865284dff8fa39edb2267de70db"
},
{
"publicKey": "ak_23p6pT7bajYMJRbnJ5BsbFUuYGX2PBoZAiiYcsrRHZ1BUY2zSF",
"secretKey": "e15908673cda8a171ea31333538437460d9ca1d8ba2e61c31a9a3d01a8158c398a14cd12266e480f85cc1dc3239ed5cfa99f3d6955082446bebfe961449dc48b"
},
{
"publicKey": "ak_gLYH5tAexTCvvQA6NpXksrkPJKCkLnB9MTDFTVCBuHNDJ3uZv",
"secretKey": "6eb127925aa10d6d468630a0ca28ff5e1b8ad00db151fdcc4878362514d6ae865951b78cf5ef047cab42218e0d5a4020ad34821ca043c0f1febd27aaa87d5ed7"
},
{
"publicKey": "ak_zPoY7cSHy2wBKFsdWJGXM7LnSjVt6cn1TWBDdRBUMC7Tur2NQ",
"secretKey": "36595b50bf097cd19423c40ee66b117ed15fc5ec03d8676796bdf32bc8fe367d82517293a0f82362eb4f93d0de77af5724fba64cbcf55542328bc173dbe13d33"
}
]
}
4 changes: 2 additions & 2 deletions contracts/token-registry-interface.aes
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
contract Token =
contract interface Token =
record meta_info =
{ name : string
, symbol : string
, decimals : int }

contract TokenRegistry =
main contract TokenRegistry =
type state = map(Token, Token.meta_info)
stateful entrypoint add_token : (Token) => unit
entrypoint get_state : () => state
6 changes: 4 additions & 2 deletions contracts/token-registry.aes
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
contract Token =
@compiler >= 6

contract interface Token =
record meta_info =
{ name : string
, symbol : string
, decimals : int }

entrypoint meta_info : () => meta_info

contract TokenRegistry =
main contract TokenRegistry =
type state = map(Token, Token.meta_info)

stateful entrypoint init() : state = {}
Expand Down
35 changes: 31 additions & 4 deletions deployment/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,39 @@
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
const Deployer = require('forgae-lib').Deployer;
const { Universal, MemoryAccount, Node, Crypto } = require('@aeternity/aepp-sdk');
const contractUtils = require('../utils/contract-utils');

const deploy = async (network, privateKey, compiler) => {
let deployer = new Deployer(network, privateKey, compiler)
const NETWORKS = require('../config/network.json');
const DEFAULT_NETWORK_NAME = 'local';

await deployer.deploy("./contracts/token-registry.aes")
const EXAMPLE_CONTRACT_SOURCE = './contracts/token-registry.aes';

const deploy = async (secretKey, network, compiler) => {
if(!secretKey) {
throw new Error(`Required option missing: secretKey`);
}
const KEYPAIR = {
secretKey: secretKey,
publicKey: Crypto.getAddressFromPriv(secretKey)
}
const NETWORK_NAME = network ? network : DEFAULT_NETWORK_NAME;

const client = await Universal({
nodes: [
{ name: NETWORK_NAME, instance: await Node({ url: NETWORKS[NETWORK_NAME].nodeUrl }) },
],
compilerUrl: compiler ? compiler : NETWORKS[NETWORK_NAME].compilerUrl,
accounts: [MemoryAccount({ keypair: KEYPAIR })],
address: KEYPAIR.publicKey
});
// a filesystem object must be passed to the compiler if the contract uses custom includes
const filesystem = contractUtils.getFilesystem(EXAMPLE_CONTRACT_SOURCE);
// get content of contract
const contract_content = contractUtils.getContractContent(EXAMPLE_CONTRACT_SOURCE);
contract = await client.getContractInstance(contract_content, {filesystem});
const deployment_result = await contract.deploy([]);
console.log(deployment_result);
};

module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.compiler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ version: '3'
services:
compiler:
hostname: compiler
image: 'aeternity/aesophia_http:v4.3.2'
image: 'aeternity/aesophia_http:${COMPILER_TAG}'
ports:
- '3080:3080'
18 changes: 8 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
version: '3'
services:
node1:
image: aeternity/aeternity:v5.5.4
hostname: node1
node:
image: 'aeternity/aeternity:${NODE_TAG}'
hostname: node
environment:
AETERNITY_CONFIG: /home/aeternity/aeternity.yaml
command: |
bin/aeternity console -noinput -aehttp enable_debug_endpoints true
volumes:
- ./docker/aeternity_node1_mean15.yaml:/home/aeternity/aeternity.yaml

- './docker/aeternity.yaml:/home/aeternity/aeternity.yaml'
proxy:
image: 'library/nginx:1.17.9'
image: 'nginx:1.13.8'
hostname: proxy
ports:
- '3001:3001'
volumes:
- './docker/nginx-default.conf:/etc/nginx/conf.d/default.conf'

volumes:
node1_db:
- './docker/nginx.conf:/etc/nginx/conf.d/default.conf'
28 changes: 12 additions & 16 deletions docker/aeternity_node1_mean15.yaml → docker/aeternity.yaml
Original file line number Diff line number Diff line change
@@ -1,38 +1,34 @@
peers: []

http:
external:
port: 3013
internal:
debug_endpoints: true
port: 3113
listen_address: 0.0.0.0
endpoints:
dry-run: true

chain:
persist: true

websocket:
channel:
listen_address: 0.0.0.0
port: 3014

chain:
persist: true
hard_forks:
"1": 0
"2": 1
"3": 2
"4": 3

logging:
level: info

mining:
autostart: true
beneficiary: "ak_2mwRmUeYmfuW93ti9HMSUJzCk1EYcQEfikVSzgo6k2VghsWhgU"
beneficiary_reward_delay: 2
expected_mine_rate: 4000
micro_block_cycle: 1000
cuckoo:
edge_bits: 15
miners:
- executable: mean15-generic
extra_args: "-t 1"
miner:
executable: mean15-generic
extra_args: ""
edge_bits: 15

fork_management:
network_id: "ae_devnet"
network_id: ae_devnet
26 changes: 0 additions & 26 deletions docker/nginx-default.conf

This file was deleted.

19 changes: 19 additions & 0 deletions docker/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
server {
listen 3001;

location / {
proxy_pass http://node:3013;
}

location /v2/debug {
proxy_pass http://node:3113;
}

location /v3/debug {
proxy_pass http://node:3113;
}

location /channel {
proxy_pass http://node:3014;
}
}
Loading

0 comments on commit 982b11d

Please sign in to comment.