-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates 151 ENS Usernames to Embark 3.1 (#21)
* fix run error * transfer to zero should decerease supply (burn action) * dont increment address 0 balance * fix warning * Update bootstrap to Embark 3.1 (#10) * update configs to .js * update tests * better test abstraction * undo changes after test * small fixes
- Loading branch information
Showing
19 changed files
with
309 additions
and
256 deletions.
There are no files selected for viewing
File renamed without changes.
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,62 @@ | ||
module.exports = { | ||
development: { | ||
enabled: true, | ||
networkType: "custom", // Can be: testnet, rinkeby, livenet or custom, in which case, it will use the specified networkId | ||
networkId: "1337", // Network id used when networkType is custom | ||
isDev: true, // Uses and ephemeral proof-of-authority network with a pre-funded developer account, mining enabled | ||
genesisBlock: "config/development/genesis.json", // Genesis block to initiate on first creation of a development node | ||
datadir: ".embark/development/datadir", // Data directory for the databases and keystore | ||
mineWhenNeeded: true, // Uses our custom script (if isDev is false) to mine only when needed | ||
nodiscover: true, // Disables the peer discovery mechanism (manual peer addition) | ||
maxpeers: 0, // Maximum number of network peers (network disabled if set to 0) (default: 25) | ||
rpcHost: "localhost", // HTTP-RPC server listening interface (default: "localhost") | ||
rpcPort: 8545, // HTTP-RPC server listening port (default: 8545) | ||
rpcCorsDomain: "auto", // Comma separated list of domains from which to accept cross origin requests (browser enforced) | ||
// When set to "auto", Embark will automatically set the cors to the address of the webserver | ||
proxy: true, // Proxy is used to present meaningful information about transactions | ||
account: { | ||
// "address": "", // When specified, uses that address instead of the default one for the network | ||
password: "config/development/password" // Password to unlock the account | ||
}, | ||
targetGasLimit: 8000000, // Target gas limit sets the artificial target gas floor for the blocks to mine | ||
wsRPC: true, // Enable the WS-RPC server | ||
wsOrigins: "auto", // Origins from which to accept websockets requests | ||
// When set to "auto", Embark will automatically set the cors to the address of the webserver | ||
wsHost: "localhost", // WS-RPC server listening interface (default: "localhost") | ||
wsPort: 8546, // WS-RPC server listening port (default: 8546) | ||
simulatorMnemonic: "example exile argue silk regular smile grass bomb merge arm assist farm", // Mnemonic used by the simulator to generate a wallet | ||
simulatorBlocktime: 0 // Specify blockTime in seconds for automatic mining. Default is 0 and no auto-mining. | ||
}, | ||
testnet: { | ||
enabled: true, | ||
networkType: "testnet", | ||
light: true, | ||
rpcHost: "localhost", | ||
rpcPort: 8545, | ||
rpcCorsDomain: "http://localhost:8000", | ||
account: { | ||
password: "config/testnet/password" | ||
} | ||
}, | ||
livenet: { | ||
enabled: true, | ||
networkType: "livenet", | ||
light: true, | ||
rpcHost: "localhost", | ||
rpcPort: 8545, | ||
rpcCorsDomain: "http://localhost:8000", | ||
account: { | ||
password: "config/livenet/password" | ||
} | ||
}, | ||
privatenet: { | ||
enabled: true, | ||
networkType: "custom", | ||
rpcHost: "localhost", | ||
rpcPort: 8545, | ||
rpcCorsDomain: "http://localhost:8000", | ||
datadir: "yourdatadir", | ||
networkId: "123", | ||
bootnodes: "" | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
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,12 @@ | ||
module.exports = { | ||
default: { | ||
enabled: true, | ||
provider: "whisper", // Communication provider. Currently, Embark only supports whisper | ||
available_providers: ["whisper"], // Array of available providers | ||
connection: { | ||
host: "localhost", // Host of the blockchain node | ||
port: 8546, // Port of the blockchain node | ||
type: "ws" // Type of connection (ws or rpc) | ||
} | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
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,6 @@ | ||
module.exports = { | ||
default: { | ||
available_providers: ["ens"], | ||
provider: "ens" | ||
} | ||
}; |
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,35 @@ | ||
module.exports = { | ||
default: { | ||
enabled: true, | ||
ipfs_bin: "ipfs", | ||
provider: "ipfs", | ||
available_providers: ["ipfs"], | ||
upload: { | ||
host: "localhost", | ||
port: 5001 | ||
}, | ||
dappConnection: [ | ||
{ | ||
provider:"ipfs", | ||
host: "localhost", | ||
port: 5001, | ||
getUrl: "http://localhost:8080/ipfs/" | ||
} | ||
] | ||
// Configuration to start Swarm in the same terminal as `embark run` | ||
/*,account: { | ||
address: "YOUR_ACCOUNT_ADDRESS", // Address of account accessing Swarm | ||
password: "PATH/TO/PASSWORD/FILE" // File containing the password of the account | ||
}, | ||
swarmPath: "PATH/TO/SWARM/EXECUTABLE" // Path to swarm executable (default: swarm)*/ | ||
}, | ||
development: { | ||
enabled: true, | ||
provider: "ipfs", | ||
upload: { | ||
host: "localhost", | ||
port: 5001, | ||
getUrl: "http://localhost:8080/ipfs/" | ||
} | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
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,5 @@ | ||
module.exports = { | ||
enabled: true, | ||
host: "localhost", | ||
port: 8000 | ||
}; |
This file was deleted.
Oops, something went wrong.
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
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,31 @@ | ||
|
||
exports.Test = (Controlled) => { | ||
describe("Controlled", async function() { | ||
this.timeout(0); | ||
var accounts; | ||
before(function(done) { | ||
web3.eth.getAccounts().then(function (res) { | ||
accounts = res; | ||
done(); | ||
}); | ||
}); | ||
|
||
|
||
it("should start with msg.sender as controller", async function() { | ||
var controller = await Controlled.methods.controller().call(); | ||
assert(controller, accounts[0]); | ||
}); | ||
|
||
it("should allow controller to set new controller", async function() { | ||
await Controlled.methods.changeController(accounts[1]).send({from: accounts[0]}); | ||
var controller = await Controlled.methods.controller().call(); | ||
assert(controller, accounts[1]); | ||
}); | ||
|
||
it("should set back to original controller", async function() { | ||
await Controlled.methods.changeController(accounts[0]).send({from: accounts[1]}); | ||
var controller = await Controlled.methods.controller().call(); | ||
assert(controller, accounts[0]); | ||
}); | ||
}); | ||
} |
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,85 @@ | ||
|
||
const ERC20Receiver = require('Embark/contracts/ERC20Receiver'); | ||
|
||
exports.config = { | ||
contracts : { | ||
"ERC20Receiver": { | ||
} | ||
} | ||
} | ||
|
||
exports.Test = (ERC20Token) => { | ||
describe("ERC20Token", function() { | ||
|
||
var accounts; | ||
before(function(done) { | ||
web3.eth.getAccounts().then(function (res) { | ||
accounts = res; | ||
done(); | ||
}); | ||
}); | ||
|
||
it("should transfer 1 token", async function() { | ||
let initialBalance0 = await ERC20Token.methods.balanceOf(accounts[0]).call(); | ||
let initialBalance1 = await ERC20Token.methods.balanceOf(accounts[1]).call(); | ||
await ERC20Token.methods.transfer(accounts[1],1).send({from: accounts[0]}); | ||
let result0 = await ERC20Token.methods.balanceOf(accounts[0]).call(); | ||
let result1 = await ERC20Token.methods.balanceOf(accounts[1]).call(); | ||
|
||
assert.equal(result0, +initialBalance0-1, "account 0 balance unexpected"); | ||
assert.equal(result1, +initialBalance1+1, "account 1 balance unexpected"); | ||
}); | ||
|
||
it("should set approved amount", async function() { | ||
await ERC20Token.methods.approve(accounts[2],10000000).send({from: accounts[0]}); | ||
let result = await ERC20Token.methods.allowance(accounts[0], accounts[2]).call(); | ||
assert.equal(result, 10000000); | ||
}); | ||
|
||
it("should consume allowance amount", async function() { | ||
let initialAllowance = await ERC20Token.methods.allowance(accounts[0], accounts[2]).call(); | ||
await ERC20Token.methods.transferFrom(accounts[0], accounts[0],1).send({from: accounts[2]}); | ||
let result = await ERC20Token.methods.allowance(accounts[0], accounts[2]).call(); | ||
|
||
assert.equal(result, +initialAllowance-1); | ||
}); | ||
|
||
it("should transfer approved amount", async function() { | ||
let initialBalance0 = await ERC20Token.methods.balanceOf(accounts[0]).call(); | ||
let initialBalance1 = await ERC20Token.methods.balanceOf(accounts[1]).call(); | ||
await ERC20Token.methods.transferFrom(accounts[0], accounts[1],1).send({from: accounts[2]}); | ||
let result0 = await ERC20Token.methods.balanceOf(accounts[0]).call(); | ||
let result1 = await ERC20Token.methods.balanceOf(accounts[1]).call(); | ||
|
||
assert.equal(result0, +initialBalance0-1); | ||
assert.equal(result1, +initialBalance1+1); | ||
}); | ||
|
||
|
||
it("should unset approved amount", async function() { | ||
await ERC20Token.methods.approve(accounts[2],0).send({from: accounts[0]}); | ||
let result = await ERC20Token.methods.allowance(accounts[0], accounts[2]).call(); | ||
assert.equal(result, 0); | ||
}); | ||
|
||
it("should deposit approved amount to contract ERC20Receiver", async function() { | ||
//ERC20Receiver = await ERC20Receiver.deploy().send(); | ||
//console.log(ERC20Receiver.address); | ||
await ERC20Token.methods.approve(ERC20Receiver.address, 10).send({from: accounts[0]}); | ||
await ERC20Receiver.methods.depositToken(ERC20Token.address, 10).send({from: accounts[0]}); | ||
let result = await ERC20Receiver.methods.tokenBalanceOf(ERC20Token.address, accounts[0]).call(); | ||
assert.equal(result, 10, "ERC20Receiver.tokenBalanceOf("+ERC20Token.address+","+accounts[0]+") wrong"); | ||
}); | ||
|
||
it("should witdraw approved amount from contract ERC20Receiver", async function() { | ||
let tokenBalance = await ERC20Receiver.methods.tokenBalanceOf(ERC20Token.address, accounts[0]).call(); | ||
await ERC20Receiver.methods.withdrawToken(ERC20Token.address, tokenBalance).send({from: accounts[0]}); | ||
tokenBalance = await ERC20Receiver.methods.tokenBalanceOf(ERC20Token.address, accounts[0]).call(); | ||
assert.equal(tokenBalance, 0, "ERC20Receiver.tokenBalanceOf("+ERC20Token.address+","+accounts[0]+") wrong"); | ||
}); | ||
|
||
//TODO: include checks for expected events fired | ||
|
||
|
||
}); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.