Skip to content

Commit

Permalink
Feature/new bridge (#234)
Browse files Browse the repository at this point in the history
* i18n - hebrew

* added support to the new AMB bridge

* bump v

* final fixs for new bridge

* update wallet_core
  • Loading branch information
LiorAgnin authored Oct 4, 2020
1 parent 9a40d11 commit 56ead48
Show file tree
Hide file tree
Showing 24 changed files with 497 additions and 166 deletions.
1 change: 0 additions & 1 deletion environment/.env_example
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ INTERVAL_SECONDS=5
FUSE_CHAIN_ID=122
FOREIGN_NETWORK_ID=1
FOREIGN_PROVIDER_URL=https://mainnet.infura.io/v3/<INFURA_API_KEY>
DAI_TOKEN=0x6B175474E89094C44Da98b954EedeAC495271d0F
DEFAULT_COMMUNITY_CONTRACT_ADDRESS=0x25887cbBBB04Da00A2eB715393342606e6B5d413
COMMUNITY_MANAGER_CONTRACT_ADDRESS=0x0D4926876ba1ada6E9b542e018eBeD517FFc8050
DAI_POINTS_MANAGER_CONTRACT_ADDRESS=0x602C6FbF83f5B758365DB51f38D311B09657f72c
Expand Down
1 change: 0 additions & 1 deletion environment/.env_prod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ INTERVAL_SECONDS=5
FUSE_CHAIN_ID=122
FOREIGN_NETWORK_ID=1
FOREIGN_PROVIDER_URL=https://mainnet.infura.io/v3/<INFURA_API_KEY>
DAI_TOKEN=0x6B175474E89094C44Da98b954EedeAC495271d0F
DEFAULT_COMMUNITY_CONTRACT_ADDRESS=0x25887cbBBB04Da00A2eB715393342606e6B5d413
COMMUNITY_MANAGER_CONTRACT_ADDRESS=0x0D4926876ba1ada6E9b542e018eBeD517FFc8050
DAI_POINTS_MANAGER_CONTRACT_ADDRESS=0x602C6FbF83f5B758365DB51f38D311B09657f72c
Expand Down
2 changes: 0 additions & 2 deletions environment/.env_qa
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ INTERVAL_SECONDS=5
FUSE_CHAIN_ID=122
FOREIGN_NETWORK_ID=3
FOREIGN_PROVIDER_URL=https://ropsten.infura.io/v3/<INFURA_API_KEY>
DAI_TOKEN=0x1CAf0Ed93dD34152000ACec9441D4D9ed0f55D7B
DEFAULT_COMMUNITY_CONTRACT_ADDRESS=0x0fA2De2AB74d41a2046FbD433eeb3D963f5EBacb
COMMUNITY_MANAGER_CONTRACT_ADDRESS=0x3Ae358554CEAD619C93E653F1dE52c0895AA07e2
TRANSFER_MANAGER_CONTRACT_ADDRESS=0x7c9bC18C1B1a3D75f1be5DB5722fd406a36DB791
Expand All @@ -17,7 +16,6 @@ SENTRY_DSN=https://00ab5d09590f4967b44a05b218d45844@sentry.io/4042209
DAI_POINTS=https://daipoints-oracle.fuse.io/draw-info
ETHERSCAN_API_KEY=<ETHERSCAN_API_KEY>
ETHERSCAN_BASE_URL=http://api-ropsten.etherscan.io/api
FUSE_RPC_URL=https://explorer.fuse.io/api
TOTLE_APPROVAL_CONTRACT_ADDRESS=0x74758AcFcE059f503a7E6B0fC2c8737600f9F2c4
TOTLE_API_KEY=
FUSE_RPC_URL=https://explorer.fuse.io/api
Expand Down
4 changes: 3 additions & 1 deletion i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,7 @@
"no_activity": "No activity",
"bridge_to": "Bridge to",
"move_to": "Move to",
"invalid_number": "Invalid number"
"invalid_number": "Invalid number",
"copy_to_clipboard": "Copy to clipboard",
"copied_to_clipboard": "Copied to clipboard"
}
13 changes: 11 additions & 2 deletions lib/constans/exchangable_tokens.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import 'package:fusecash/screens/home/widgets/assets_list.dart';
import 'package:fusecash/utils/addresses.dart';

final Token daiToken = Token.initial().copyWith(
address: daiTokenAddress,
address: '0x6B175474E89094C44Da98b954EedeAC495271d0F',
decimals: 18,
imageUrl: getTokenUrl(daiTokenAddress),
imageUrl: getTokenUrl('0x6B175474E89094C44Da98b954EedeAC495271d0F'),
name: "Dai Stablecoin",
subtitle: 'US dollar',
amount: BigInt.zero,
Expand Down Expand Up @@ -72,6 +72,14 @@ final _etherToken = Token.initial().copyWith(
imageUrl: getTokenUrl(zeroAddress),
address: zeroAddress);

// final Token _wbtcToken = Token.initial().copyWith(
// address: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
// decimals: 8,
// imageUrl: getTokenUrl('0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'),
// name: "Wrapped BTC",
// amount: BigInt.zero,
// symbol: "WBTC");

final Map<String, Token> exchangableTokens = new Map<String, Token>.from({
_etherToken.address: _etherToken,
daiToken.address: daiToken,
Expand All @@ -81,6 +89,7 @@ final Map<String, Token> exchangableTokens = new Map<String, Token>.from({
_eursToken.address: _eursToken,
_dzarToken.address: _dzarToken,
_rupiahToken.address: _rupiahToken,
// _wbtcToken.address: _wbtcToken,
});

final dollarPeggedToken = [
Expand Down
4 changes: 4 additions & 0 deletions lib/generated/i18n.dart
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,10 @@ class I18n implements WidgetsLocalizations {
String get move_to => "Move to";
/// "Invalid number"
String get invalid_number => "Invalid number";
/// "Copy to clipboard"
String get copy_to_clipboard => "Copy to clipboard";
/// "Copied to clipboard"
String get copied_to_clipboard => "Copied to clipboard";
}

class _I18n_en_US extends I18n {
Expand Down
28 changes: 16 additions & 12 deletions lib/models/community/community.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ class Community extends Equatable {
final String webUrl;
final String foreignTokenAddress;
final String description;
final bool isMultiBridge;

@override
List<Object> get props =>
[name, address, isMember, token, plugins, metadata, webUrl, description];

Community(
{this.name,
this.isMultiBridge,
this.isClosed,
this.isMember,
this.address,
Expand All @@ -44,17 +46,17 @@ class Community extends Equatable {

factory Community.initial() {
return new Community(
name: null,
isClosed: false,
metadata: CommunityMetadata.initial(),
address: null,
foreignBridgeAddress: null,
homeBridgeAddress: null,
token: Token.initial(),
isMember: false,
businesses: new List<Business>(),
plugins: new Plugins(),
);
name: null,
isClosed: false,
metadata: CommunityMetadata.initial(),
address: null,
foreignBridgeAddress: null,
homeBridgeAddress: null,
token: Token.initial(),
isMember: false,
businesses: new List<Business>(),
plugins: new Plugins(),
isMultiBridge: false);
}

Community copyWith(
Expand All @@ -70,8 +72,10 @@ class Community extends Equatable {
bool isClosed,
String webUrl,
String foreignTokenAddress,
String description}) {
String description,
bool isMultiBridge}) {
return Community(
isMultiBridge: isMultiBridge ?? this.isMultiBridge,
description: description ?? this.description,
isClosed: isClosed ?? this.isClosed,
webUrl: webUrl,
Expand Down
2 changes: 2 additions & 0 deletions lib/models/community/community.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 64 additions & 11 deletions lib/models/views/send_amount.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,22 @@ class SendAmountViewModel extends Equatable {
final String myCountryCode;
final List<Token> tokens;
final List<Community> communities;
final Function(
Token token,
String recieverAddress,
num amount,
String receiverName,
VoidCallback sendSuccessCallback,
VoidCallback sendFailureCallback,
) sendToForeignMultiBridge;
final Function(
Token token,
String recieverAddress,
num amount,
String receiverName,
VoidCallback sendSuccessCallback,
VoidCallback sendFailureCallback,
) sendToHomeMultiBridge;
final Function(
Token token,
String name,
Expand Down Expand Up @@ -56,17 +72,18 @@ class SendAmountViewModel extends Equatable {
@override
List<Object> get props => [tokens, myCountryCode, communities];

SendAmountViewModel({
this.tokens,
this.communities,
this.myCountryCode,
this.sendToContact,
this.sendToAccountAddress,
this.trackTransferCall,
this.idenyifyCall,
this.sendToErc20Token,
this.sendERC20ToContact,
});
SendAmountViewModel(
{this.tokens,
this.communities,
this.myCountryCode,
this.sendToContact,
this.sendToAccountAddress,
this.trackTransferCall,
this.idenyifyCall,
this.sendToErc20Token,
this.sendERC20ToContact,
this.sendToForeignMultiBridge,
this.sendToHomeMultiBridge});

static SendAmountViewModel fromStore(Store<AppState> store) {
List<Community> communities =
Expand Down Expand Up @@ -134,6 +151,7 @@ class SendAmountViewModel extends Equatable {
sendSuccessCallback,
sendFailureCallback,
receiverName: receiverName,
transferNote: transferNote
));
},
sendToErc20Token: (
Expand All @@ -152,6 +170,41 @@ class SendAmountViewModel extends Equatable {
sendSuccessCallback,
sendFailureCallback,
receiverName: receiverName,
transferNote: transferNote
));
},
sendToForeignMultiBridge: (
Token token,
String recieverAddress,
num amount,
String receiverName,
VoidCallback sendSuccessCallback,
VoidCallback sendFailureCallback,
) {
store.dispatch(sendTokenToForeignMultiBridge(
token,
recieverAddress,
amount,
sendSuccessCallback,
sendFailureCallback,
receiverName: receiverName,
));
},
sendToHomeMultiBridge: (
Token token,
String recieverAddress,
num amount,
String receiverName,
VoidCallback sendSuccessCallback,
VoidCallback sendFailureCallback,
) {
store.dispatch(sendTokenToHomeMultiBridge(
token,
recieverAddress,
amount,
sendSuccessCallback,
sendFailureCallback,
receiverName: receiverName,
));
},
trackTransferCall: (String eventName,
Expand Down
Loading

0 comments on commit 56ead48

Please sign in to comment.