Skip to content

Commit 4a7bb30

Browse files
dkent600orenyodfat
authored andcommitted
* mods for [email protected] * fix tests * update dates and kovan DAO * fix rinkeby DAO address * add left/right padding to landing countdown * remove unused variable
1 parent 9dfc657 commit 4a7bb30

File tree

12 files changed

+266
-262
lines changed

12 files changed

+266
-262
lines changed

package-lock.json

Lines changed: 215 additions & 199 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
"webpack-dev-server": "^2.11.1"
117117
},
118118
"dependencies": {
119-
"@daostack/arc.js": "0.0.0-alpha.105",
119+
"@daostack/arc.js": "0.0.0-alpha.106",
120120
"arrive": "^2.4.1",
121121
"aurelia-animator-css": "^1.0.4",
122122
"aurelia-bootstrapper": "^2.1.1",

src/app.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@ import { autoinject } from 'aurelia-framework';
22
import { Router, RouterConfiguration } from 'aurelia-router';
33
import { PLATFORM } from 'aurelia-pal';
44
import { Web3Service } from "./services/Web3Service";
5-
import { ArcService } from "./services/ArcService";
65
import '../static/styles.scss';
76
import { AureliaConfiguration } from 'aurelia-configuration';
87
import { BindingSignaler } from "aurelia-templating-resources";
9-
import { runInThisContext } from "vm";
108
import { EventAggregator } from "aurelia-event-aggregator";
119
import { Utils } from "services/utils";
12-
import { DateService } from "services/DateService";
1310

1411
@autoinject
1512
export class App {
@@ -20,19 +17,18 @@ export class App {
2017
private intervalId: any;
2118

2219
constructor(
23-
private web3: Web3Service
20+
private web3Service: Web3Service
2421
, private signaler: BindingSignaler
2522
, private eventAggregator: EventAggregator
2623
, appConfig: AureliaConfiguration
27-
, private web3Service: Web3Service
2824
) {
2925
App.timezone = appConfig.get("rootTimezone");
3026
}
3127

3228
activate() {
3329
this.intervalId = setInterval(async () => {
3430
this.signaler.signal('secondPassed');
35-
if (this.web3.isConnected) {
31+
if (this.web3Service.isConnected) {
3632
const blockDate = await Utils.lastBlockDate(this.web3Service.web3);
3733
this.eventAggregator.publish("secondPassed", blockDate);
3834
}

src/resources/customElements/TokenBalance/TokenBalance.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class TokenBalance {
5050

5151
if (this.token) {
5252

53-
const token = await this.tokenService.getStandardToken(this.token);
53+
const token = await this.tokenService.getErc20Token(this.token);
5454

5555
if (token) {
5656
this.getBalance(token);
@@ -69,7 +69,7 @@ export class TokenBalance {
6969
}
7070
async getBalance(token) {
7171
try {
72-
this.balance = (await this.tokenService.getUserStandardTokenBalance(token, true)).toFixed(2);
72+
this.balance = (await this.tokenService.getUserErc20TokenBalance(token, true)).toFixed(2);
7373
this.text = this.balance.toString();
7474
} catch {
7575
}

src/schemeDashboards/Auction4Reputation.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { autoinject } from 'aurelia-framework';
22
import { DaoSchemeDashboard } from "./schemeDashboard"
33
import { EventAggregator } from 'aurelia-event-aggregator';
4-
import { WrapperService, Address, Auction4ReputationWrapper, StandardTokenWrapper, Auction4ReputationBidEventResult } from "../services/ArcService";
4+
import { WrapperService, Address, Auction4ReputationWrapper, Erc20Wrapper, Auction4ReputationBidEventResult } from "../services/ArcService";
55
import { BigNumber, Web3Service } from '../services/Web3Service';
66
import { SchemeDashboardModel } from 'schemeDashboards/schemeDashboardModel';
77
import { EventConfigTransaction, EventConfigException, EventConfigFailure } from 'entities/GeneralEvents';
@@ -15,8 +15,7 @@ export class Auction4Reputation extends DaoSchemeDashboard {
1515
protected wrapper: Auction4ReputationWrapper;
1616
auctionsStartTime: Date;
1717
auctionsEndTime: Date;
18-
token: StandardTokenWrapper;
19-
auctionId: number = -1;
18+
token: Erc20Wrapper;
2019
auctionIsOver: boolean;
2120
auctionNotBegun: boolean;
2221
refreshing: boolean = false;
@@ -185,17 +184,4 @@ export class Auction4Reputation extends DaoSchemeDashboard {
185184

186185
this.bidding = false;
187186
}
188-
189-
// async _userHasBid(auctionId: number): Promise<void> {
190-
// this.userHasBid = (await this.wrapper.getBid(this.web3Service.defaultAccount, auctionId)).gt(0);
191-
// }
192-
193-
// async _totalBids(auctionId: number): Promise<BigNumber> {
194-
// let totalBids = new BigNumber(0);
195-
// const numAuctions = await this.wrapper.getNumberOfAuctions();
196-
// for (let auctionId = 0; auctionId < numAuctions; ++auctionId) {
197-
// totalBids.add(await this.wrapper.getAuctionTotalBid(auctionId));
198-
// }
199-
// return totalBids;
200-
// }
201187
}

src/schemeDashboards/LockingToken4Reputation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { autoinject } from 'aurelia-framework';
2-
import { LockingToken4ReputationWrapper, StandardTokenFactory, StandardTokenWrapper, TokenLockingOptions, LockInfo, Address } from "../services/ArcService";
2+
import { LockingToken4ReputationWrapper, Erc20Factory, Erc20Wrapper, TokenLockingOptions, LockInfo, Address } from "../services/ArcService";
33
import { Locking4Reputation } from 'schemeDashboards/Locking4Reputation';
44
import { EventAggregator } from "aurelia-event-aggregator";
55
import { Web3Service } from "services/Web3Service";
@@ -49,7 +49,7 @@ export class LockingToken4Reputation extends Locking4Reputation {
4949

5050
if (!(await this.getLockBlocker())) {
5151

52-
const token = (await StandardTokenFactory.at(this.selectedToken.address)) as StandardTokenWrapper;
52+
const token = (await Erc20Factory.at(this.selectedToken.address)) as Erc20Wrapper;
5353

5454
await (await token.approve({
5555
owner: this.lockModel.lockerAddress,

src/services/TokenService.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { autoinject } from "aurelia-framework";
22
import { Web3Service, BigNumber } from "./Web3Service";
3-
import { ArcService, Address, StandardTokenWrapper, Utils, DaoTokenWrapper, WrapperService } from './ArcService';
3+
import { ArcService, Address, Erc20Wrapper, Utils, DaoTokenWrapper, WrapperService } from './ArcService';
44

55
@autoinject
66
export class TokenService {
@@ -22,12 +22,12 @@ export class TokenService {
2222
* in Wei by default
2323
* @param tokenAddress
2424
*/
25-
public async getUserStandardTokenBalance(
26-
token: StandardTokenWrapper,
25+
public async getUserErc20TokenBalance(
26+
token: Erc20Wrapper,
2727
inEth: boolean = false): Promise<BigNumber> {
2828

2929
let userAddress = this.web3.defaultAccount;
30-
return this.getStandardTokenBalance(token, userAddress, inEth);
30+
return this.getErc20TokenBalance(token, userAddress, inEth);
3131
}
3232

3333
public async getUserTokenBalance(
@@ -39,8 +39,8 @@ export class TokenService {
3939
return this.getTokenBalance(tokenAddress, userAddress, inEth);
4040
}
4141

42-
public async getStandardTokenBalance(
43-
token: StandardTokenWrapper,
42+
public async getErc20TokenBalance(
43+
token: Erc20Wrapper,
4444
accountAddress: Address,
4545
inEth: boolean = false): Promise<BigNumber> {
4646

@@ -56,13 +56,13 @@ export class TokenService {
5656
accountAddress: Address,
5757
inEth: boolean = false): Promise<BigNumber> {
5858

59-
const token = await this.getStandardToken(tokenAddress);
59+
const token = await this.getErc20Token(tokenAddress);
6060

6161
if (!token) {
6262
return new BigNumber(0);
6363
}
6464

65-
return this.getStandardTokenBalance(token, accountAddress, inEth);
65+
return this.getErc20TokenBalance(token, accountAddress, inEth);
6666
}
6767

6868
public getGenTokenBalance(): Promise<BigNumber | undefined> {
@@ -75,13 +75,13 @@ export class TokenService {
7575
}
7676
}
7777

78-
public async getGlobalGenToken(): Promise<StandardTokenWrapper | undefined> {
78+
public async getGlobalGenToken(): Promise<Erc20Wrapper | undefined> {
7979
const address = await Utils.getGenTokenAddress();
80-
return this.getStandardToken(address);
80+
return this.getErc20Token(address);
8181
}
8282

8383

84-
public getStandardToken(address: Address): Promise<StandardTokenWrapper> {
85-
return WrapperService.factories.StandardToken.at(address);
84+
public getErc20Token(address: Address): Promise<Erc20Wrapper> {
85+
return WrapperService.factories.Erc20.at(address);
8686
}
8787
}

src/services/lockServices.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Locking4ReputationWrapper, Address, LockerInfo, LockInfo } from "services/ArcService";
2-
import { LockingToken4ReputationWrapper, StandardTokenWrapper } from "@daostack/arc.js";
2+
import { LockingToken4ReputationWrapper, Erc20Wrapper } from "@daostack/arc.js";
33
import { AureliaConfiguration } from "aurelia-configuration";
44
import { BigNumber } from "bignumber.js";
55

@@ -25,9 +25,9 @@ export class LockService {
2525
return fetcher.get();
2626
}
2727

28-
public async getUserLockedTokens(): Promise<Array<StandardTokenWrapper>> {
28+
public async getUserLockedTokens(): Promise<Array<Erc20Wrapper>> {
2929
const locks = await this.getUserLocks();
30-
const tokens = new Array<StandardTokenWrapper>();
30+
const tokens = new Array<Erc20Wrapper>();
3131
const tokenWrapper = (this.wrapper as LockingToken4ReputationWrapper);
3232
for (const lock of locks) {
3333
const token = await tokenWrapper.getTokenForLock(lock.lockId);

static/_landing.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
}
88

99
.landing-page .countdown {
10+
padding-left: 1rem;
11+
padding-right: 1rem;
1012
font-size:3rem;
1113
text-align: center;
1214
margin-bottom: 4rem;

static/app-config.json

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"rootTimezone": "Asia/Tel_Aviv",
3-
"lockingPeriodStartDate": "2019-02-18T00:00:00.000",
4-
"lockingPeriodEndDate": "2019-03-21T00:00:00.000",
5-
"governanceStartDate": "2019-04-04T00:00:00.000",
3+
"lockingPeriodStartDate": "2019-02-18T12:00:00.000",
4+
"lockingPeriodEndDate": "2019-03-20T12:00:00.000",
5+
"governanceStartDate": "2019-04-04T12:00:00.000",
66
"Landing": {
7-
"lockingPeriodStartDate": "2019-02-18T00:00:00.000",
8-
"lockingPeriodEndDate": "2019-03-21T00:00:00.000",
9-
"governanceStartDate": "2019-04-04T00:00:00.000"
7+
"lockingPeriodStartDate": "2019-02-18T12:00:00.000",
8+
"lockingPeriodEndDate": "2019-03-20T12:00:00.000",
9+
"governanceStartDate": "2019-04-04T12:00:00.000"
1010
},
1111
"Ganache": {
1212
"daoAddress": "0xcb4e66eca663fdb61818d52a152601ca6afef74f",
@@ -23,10 +23,10 @@
2323
]
2424
},
2525
"Kovan": {
26-
"lockingPeriodStartDate": "2018-11-01T00:00:00.000",
27-
"lockingPeriodEndDate": "2019-03-21T00:00:00.000",
28-
"governanceStartDate": "2019-04-04T00:00:00.000",
29-
"daoAddress": "0x9b055567ae152cf14e19b285d4cdd35ff6b58260",
26+
"lockingPeriodStartDate": "2019-01-09T12:00:00.000",
27+
"lockingPeriodEndDate": "2019-01-10T18:00:00.000",
28+
"governanceStartDate": "2019-01-11T12:00:00.000",
29+
"daoAddress": "0xc0e7580aba695453f3a18b7deb9b1e0d52da8265",
3030
"gnoTokenAddress": "0x6018bf616ec9db02f90c8c8529ddadc10a5c29dc",
3131
"lockableTokens": [
3232
{
@@ -44,7 +44,10 @@
4444
]
4545
},
4646
"Rinkeby": {
47-
"daoAddress": "0x4Ceb1d7C144E06b8cD36225A7559897Cb0c6D64c",
47+
"lockingPeriodStartDate": "2019-01-09T12:00:00.000",
48+
"lockingPeriodEndDate": "2019-01-10T18:00:00.000",
49+
"governanceStartDate": "2019-01-11T12:00:00.000",
50+
"daoAddress": "0xbb491d151ff2ae050a24357a3916bb04a3e07d44",
4851
"gnoTokenAddress": "0xd0dab4e640d95e9e8a47545598c33e31bdb53c7c",
4952
"lockableTokens": [
5053
{

test/unit/app.spec.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { App } from '../../src/app';
22
import { PLATFORM } from 'aurelia-pal';
3+
import { BindingSignaler } from "aurelia-templating-resources";
4+
import { EventAggregator } from "aurelia-event-aggregator";
35

46
class RouterStub {
57
routes;
@@ -27,26 +29,25 @@ describe('the App module', () => {
2729
defaultAccount: {}
2830
};
2931

30-
let fakeArcService = {
31-
arcContracts: []
32-
};
33-
3432
let fakeAppConfigService = {
3533
get: (name: string): string => { return ""; }
3634
};
3735

38-
app = new App(fakeWeb3Service as any, fakeArcService as any, fakeAppConfigService as any);
36+
app = new App(
37+
fakeWeb3Service as any,
38+
{} as BindingSignaler,
39+
{} as EventAggregator,
40+
fakeAppConfigService as any);
3941
app.configureRouter(mockedRouter, mockedRouter);
4042
});
4143

4244
it('contains a router property', () => {
4345
expect(app.router).toBeDefined();
4446
});
4547

46-
// commented-out until Aurelia fixes its d.ts to reference title:
47-
// it('configures the router title', () => {
48-
// expect(app.router.title).toEqual('DAOstack DxBootStrapper');
49-
// });
48+
it('configures the router title', () => {
49+
expect(app.router.title).toEqual('DutchX Initializer');
50+
});
5051

5152
it('should have a dashboard route', () => {
5253
expect(app.router.routes).toContainEqual({ route: ['dashboard/:address?'], name: 'dashboard', moduleId: PLATFORM.moduleName('./organizations/dashboard'), nav: false, title: 'Dashboard' });

webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ module.exports = ({ production, server, extractCss, coverage } = {}) => {
191191
// filter ABI contract files
192192
new webpack.ContextReplacementPlugin(
193193
/@daostack[/\\]arc.js[/\\]migrated_contracts$/,
194-
/Controller.json|Avatar.json|DAOToken.json|Reputation.json|StandardToken.json|Auction4Reputation.json|ExternalLocking4Reputation.json|Locking4Reputation.json|LockingEth4Reputation.json|LockingToken4Reputation.json|BasicToken.json/),
194+
/Controller.json|Avatar.json|DAOToken.json|Reputation.json|ERC20.json|Auction4Reputation.json|ExternalLocking4Reputation.json|Locking4Reputation.json|LockingEth4Reputation.json|LockingToken4Reputation.json/),
195195
...when(extractCss, new ExtractTextPlugin({
196196
filename: production ? '[contenthash].css' : '[id].css',
197197
allChunks: true,

0 commit comments

Comments
 (0)