Skip to content

Commit

Permalink
adjustments for iris update
Browse files Browse the repository at this point in the history
  • Loading branch information
thepiwo committed Jun 3, 2021
1 parent d05c8b6 commit 6f55b25
Show file tree
Hide file tree
Showing 21 changed files with 250 additions and 106 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: npm 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"
}
]
}
9 changes: 5 additions & 4 deletions contracts/FungibleTokenCustom.aes
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@
// THIS IS NOT SECURITY AUDITED
// DO NEVER USE THIS WITHOUT SECURITY AUDIT FIRST

@compiler >= 4
@compiler >= 6

contract TokenSale =
contract interface TokenSale =
stateful entrypoint set_token : () => unit

contract WordRegistry =
contract interface WordRegistry =
stateful entrypoint add_token : (TokenSale, string) => unit

include "Option.aes"
include "String.aes"

/// @title - Fungible token with all the extensions - burn, mint, allowances
contract FungibleTokenFull =
main contract FungibleTokenFull =

// This defines the state of type record encapsulating the contract's mutable state
record state =
Expand Down
10 changes: 6 additions & 4 deletions contracts/TokenSale.aes
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
// THIS IS NOT SECURITY AUDITED
// DO NEVER USE THIS WITHOUT SECURITY AUDIT FIRST

contract Token =
@compiler >= 6

contract interface Token =
stateful entrypoint mint : (address, int) => unit
stateful entrypoint transfer_allowance : (address, address, int) => unit
stateful entrypoint burn : (int) => unit
stateful entrypoint total_supply : () => int

contract Vote =
contract interface Vote =
type vote_option = bool
type amount = int
type vote_state = map(vote_option, amount)
Expand All @@ -34,13 +36,13 @@ contract Vote =
entrypoint subject_workaround : () => (string * address)
entrypoint close_height : () => int

contract BondingCurve =
contract interface BondingCurve =
entrypoint buy_price : (int) => int
entrypoint sell_price : (int) => int
entrypoint calculate_buy_price : (int, int) => int
entrypoint calculate_sell_return : (int, int) => int

contract TokenSale =
main contract TokenSale =

record state =
{ token : option(Token)
Expand Down
8 changes: 6 additions & 2 deletions contracts/TokenVoting.aes
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
// THIS IS NOT SECURITY AUDITED
// DO NEVER USE THIS WITHOUT SECURITY AUDIT FIRST

contract Token =
@compiler >= 6

include "String.aes"

contract interface Token =
stateful entrypoint transfer_allowance : (address, address, int) => unit
stateful entrypoint transfer : (address, int) => unit

Expand All @@ -29,7 +33,7 @@ contract Token =
// when closing height is reached voters can withdraw tokens without affecting state
// vote state keeps track if changing state with token balance being locked
// vote accounts keeps track of each voters balance for later withdrawl
contract Voting =
main contract Voting =

datatype subject =
VotePayout(address)
Expand Down
8 changes: 5 additions & 3 deletions contracts/WordRegistry.aes
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@
// THIS IS NOT SECURITY AUDITED
// DO NEVER USE THIS WITHOUT SECURITY AUDIT FIRST

contract Token =
@compiler >= 6

contract interface Token =
record meta_info = { name : string, symbol : string, decimals : int }
entrypoint meta_info : () => meta_info

contract TokenSale =
contract interface TokenSale =
entrypoint get_token : () => Token

contract WordRegistry =
main contract WordRegistry =
record state = { tokens: map(string, TokenSale)
, owner : address }

Expand Down
12 changes: 8 additions & 4 deletions contracts/interfaces/TokenSaleInterface.aes
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
@compiler >= 6

// dummy for remote contract as not needed in more detail for interface use
contract Token =
contract interface Token =
type dummy = int

contract Vote =
// dummy for remote contract as not needed in more detail for interface use
contract interface Vote =
type dummy = int

contract BondingCurve =
// dummy for remote contract as not needed in more detail for interface use
contract interface BondingCurve =
type dummy = int

contract TokenSale =
main contract TokenSale =

record state =
{ token : option(Token)
Expand Down
6 changes: 4 additions & 2 deletions contracts/interfaces/TokenVotingInterface.aes
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
@compiler >= 6

// dummy for remote contract as not needed in more detail for interface use
contract Token =
contract interface Token =
type dummy = int

contract Voting =
main contract Voting =

datatype subject =
VotePayout(address)
Expand Down
6 changes: 4 additions & 2 deletions contracts/interfaces/WordRegistryInterface.aes
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
@compiler >= 6

// dummy for remote contract as not needed in more detail for interface use
contract TokenSale =
contract interface TokenSale =
type dummy = int

contract WordRegistry =
main contract WordRegistry =
record state = { tokens: map(string, TokenSale)
, owner : address }

Expand Down
4 changes: 2 additions & 2 deletions deployment/deploy-testnet.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const deploy = async () => {
};

const keypair = {
secretKey: '',
publicKey: ''
secretKey: '8fe6f2b3eaee2cc675de41cc8f5c22fad204b740611e8b8593524ce356eb2ab5c5127b909da4e7eddec87a2f22dea0cd56e9168fdb9f98cccd0adda77e741dd2',
publicKey: 'ak_2VnwoJPQgrXvreUx2L9BVvd9BidWwpu1ASKK1AMre21soEgpRT'
};

const client = await Universal({
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('aeproject-lib').Deployer;
const { Universal, MemoryAccount, Node, Crypto } = require('@aeternity/aepp-sdk');
const contractUtils = require('../utils/contract-utils');

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

await deployer.deploy("./contracts/ExampleContract.aes")
const EXAMPLE_CONTRACT_SOURCE = './contracts/ExampleContract.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.7.1
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:latest'
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.

Loading

0 comments on commit 6f55b25

Please sign in to comment.