Skip to content
This repository was archived by the owner on Apr 21, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/app/modules/languages/cn.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ function ChineseProvider($translateProvider) {
MOSAIC_DEFINITION_REQUIRES_LEVY: '需要征费',
MOSAIC_DEFINITION_LEVY_LIMITATION: 'UI限制: 当前仅允许已拥有的马赛克作为征费。',
MOSAIC_DEFINITION_LEVY_SELECT_MOSAIC: '选择征费马赛克',
MOSAIC_DEFINITION_LEVY_IS_NEW_MOSAIC: '使用新的马赛克征税',
MOSAIC_DEFINITION_LEVY_ADDRESS: '征费地址',
MOSAIC_DEFINITION_LEVY_FEE_TYPE: '征费类型',
MOSAIC_DEFINITION_LEVY_FEE_TYPE_1: '绝对值',
Expand Down
1 change: 1 addition & 0 deletions src/app/modules/languages/de.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ function GermanProvider($translateProvider) {
MOSAIC_DEFINITION_REQUIRES_LEVY: 'Benötigt Levy',
MOSAIC_DEFINITION_LEVY_LIMITATION: 'Einschränkung der UI: Momentan können nur Mosaike als Levy verwendet werden die sich im eigenen Besitz befinden.',
MOSAIC_DEFINITION_LEVY_SELECT_MOSAIC: 'Levy Mosaik auswählen',
MOSAIC_DEFINITION_LEVY_IS_NEW_MOSAIC: 'Das neue Mosaik benutzen',
MOSAIC_DEFINITION_LEVY_ADDRESS: 'Levy Adresse',
MOSAIC_DEFINITION_LEVY_FEE_TYPE: 'Gebührentyp',
MOSAIC_DEFINITION_LEVY_FEE_TYPE_1: 'Absolut',
Expand Down
1 change: 1 addition & 0 deletions src/app/modules/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ function EnglishProvider($translateProvider) {
MOSAIC_DEFINITION_REQUIRES_LEVY: 'Requires levy',
MOSAIC_DEFINITION_LEVY_LIMITATION: 'UI-limitation: right now, only owned mosaics can be used as a levy.',
MOSAIC_DEFINITION_LEVY_SELECT_MOSAIC: 'Select levy mosaic',
MOSAIC_DEFINITION_LEVY_IS_NEW_MOSAIC: 'Use the new mosaic for levy',
MOSAIC_DEFINITION_LEVY_ADDRESS: 'Levy address',
MOSAIC_DEFINITION_LEVY_FEE_TYPE: 'Fee type',
MOSAIC_DEFINITION_LEVY_FEE_TYPE_1: 'Absolute',
Expand Down
1 change: 1 addition & 0 deletions src/app/modules/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ function SpanishProvider($translateProvider) {
MOSAIC_DEFINITION_REQUIRES_LEVY: 'Impuesto requerido',
MOSAIC_DEFINITION_LEVY_LIMITATION: 'Limitación de la interfaz de usuario: en este momento, solo los mosaicos en propiedad pueden ser usados como un impuesto.',
MOSAIC_DEFINITION_LEVY_SELECT_MOSAIC: 'Seleccionar el mosaico del impuesto',
MOSAIC_DEFINITION_LEVY_IS_NEW_MOSAIC: 'Usar el mosaico nuevo',
MOSAIC_DEFINITION_LEVY_ADDRESS: 'Dirección de impuesto',
MOSAIC_DEFINITION_LEVY_FEE_TYPE: 'Tipo de tarifa',
MOSAIC_DEFINITION_LEVY_FEE_TYPE_1: 'Fija',
Expand Down
1 change: 1 addition & 0 deletions src/app/modules/languages/pl.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ function PolishProvider($translateProvider) {
MOSAIC_DEFINITION_REQUIRES_LEVY: 'Wymaga specjalnej opłaty',
MOSAIC_DEFINITION_LEVY_LIMITATION: 'Ogranieczenie UI: obecnie tylko posiadane mozaiki mogą zostać użyte do specjalnej opłaty.',
MOSAIC_DEFINITION_LEVY_SELECT_MOSAIC: 'Wybierz mozaikę do specjalnej opłaty',
MOSAIC_DEFINITION_LEVY_IS_NEW_MOSAIC: 'Użyj nowej mozaiki do opłaty specjalnej',
MOSAIC_DEFINITION_LEVY_ADDRESS: 'Adres specjalej opłaty',
MOSAIC_DEFINITION_LEVY_FEE_TYPE: 'Typ opłaty',
MOSAIC_DEFINITION_LEVY_FEE_TYPE_1: 'Stała',
Expand Down
1 change: 1 addition & 0 deletions src/app/modules/languages/ru.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ function RussianProvider($translateProvider) {
MOSAIC_DEFINITION_REQUIRES_LEVY: 'Требовать налог',
MOSAIC_DEFINITION_LEVY_LIMITATION: 'UI-ограничение: в настоящее время в качестве налога допускается только мозайка.',
MOSAIC_DEFINITION_LEVY_SELECT_MOSAIC: 'Выберите облагаемую налогом мозайку',
MOSAIC_DEFINITION_LEVY_IS_NEW_MOSAIC: 'Используйте новую мозайку для комиссий',
MOSAIC_DEFINITION_LEVY_ADDRESS: 'Номер счёта налоговой',
MOSAIC_DEFINITION_LEVY_FEE_TYPE: 'Тип сбора',
MOSAIC_DEFINITION_LEVY_FEE_TYPE_1: 'Фиксированный',
Expand Down
43 changes: 37 additions & 6 deletions src/app/modules/mosaics/create/createMosaic.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ class createMosaicCtrl {

//// End dependencies region ////

// Export Math into template
this.Math = Math;

// Initialization
this.init();
}
Expand All @@ -40,6 +43,8 @@ class createMosaicCtrl {
this.formData.multisigAccount = this._DataStore.account.metaData.meta.cosignatoryOf.length == 0 ? '' : this._DataStore.account.metaData.meta.cosignatoryOf[0];
// Has no levy by default
this.hasLevy = false;
// Levy will be in the newly created mosaic
this.levyInNewlyCreatedMosaic = false;
// Mosaics owned names for current account
this.currentAccountMosaicNames = '';
// Selected mosaic from view
Expand All @@ -65,14 +70,15 @@ class createMosaicCtrl {
/**
* Set name to lowercase and check it
*/
processMosaicName(){
processMosaicName() {
// Lowercase mosaic name
this.formData.mosaicName = this._$filter('lowercase')(this.formData.mosaicName);
// Check mosaic name validity
if(!this.mosaicIsValid(this.formData.mosaicName)) {
this._Alert.invalidMosaicName();
return;
}
this.updateLevyMosaic(this.hasLevy, this.levyInNewlyCreatedMosaic);
this.prepareTransaction();
}

Expand All @@ -99,18 +105,43 @@ class createMosaicCtrl {
/**
* Update levy mosaic data
*
* @note: Used in view (ng-update) on hasLevy and selectedMosaic changes
* @note: Used in view (ng-update) on hasLevy, selectedMosaic and levyInNewlyCreatedMosaic changes
*
* @param {boolean} val - true or false
* @param {boolean} _hasLevy - true or false
* @param {boolean} _levyInNewlyCreatedMosaic - true or false
*/
updateLevyMosaic(val) {
if (val) {
this.formData.levy.mosaic = this.mosaicOwned[this.selectedMosaic].mosaicId;
updateLevyMosaic(_hasLevy, _levyInNewlyCreatedMosaic) {
if (_hasLevy) {
if (_levyInNewlyCreatedMosaic) {
this.formData.levy.mosaic = {
// create mosaicId structure by hand
"namespaceId": this.formData.namespaceParent.fqn,
"name": this.formData.mosaicName
};
} else {
this.formData.levy.mosaic = this.mosaicOwned[this.selectedMosaic].mosaicId;
}
} else {
this.formData.levy.mosaic = null;
}
}

/**
* Gets divisibility of selectedMosaic
*
* @note: used in view in output formatting and calculations for levy examples
*/
selectedMosaicDivisibility() {
var props = this._DataStore.mosaic.metaData[this.selectedMosaic].mosaicDefinition.properties;
var proplen = props.length;
for(var i=0;i<proplen;i++) {
if (props[i].name === 'divisibility') {
return props[i].value;
}
}
return 0;
}

/**
* Get current account namespaces & mosaic names
*
Expand Down
59 changes: 47 additions & 12 deletions src/app/modules/mosaics/create/createMosaic.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ <h5 data-toggle="modal" data-target="#mosaicHelp"><i class="fa fa-question-circl
<span class="input-group-btn">
<label for="namespaceParent" class="control-label">{{ 'MOSAIC_DEFINITION_PARENT' | translate }}:</label>
</span>
<select class="form-control" ng-options="namespace.fqn for namespace in $ctrl.namespaceOwned track by namespace.fqn" ng-model="$ctrl.formData.namespaceParent">
<select class="form-control" ng-options="namespace.fqn for namespace in $ctrl.namespaceOwned track by namespace.fqn" ng-model="$ctrl.formData.namespaceParent" ng-change="$ctrl.updateLevyMosaic($ctrl.hasLevy, $ctrl.levyInNewlyCreatedMosaic)">
</select>
</div>
</div>
Expand Down Expand Up @@ -144,7 +144,7 @@ <h3>{{ 'MOSAIC_DEFINITION_MOSAIC_PROPERTIES' | translate }}</h3>
<label for="box3" class="col-md-12 control-label">{{ 'MOSAIC_DEFINITION_TRANSFERABLE' | translate }}</label>
<input id="box4" type="checkbox" ng-model="$ctrl.formData.properties.supplyMutable">
<label for="box4" class="col-md-12 control-label">{{ 'MOSAIC_DEFINITION_MUTABLE_SUPPLY' | translate }}</label>
<input id="box5" type="checkbox" ng-model="$ctrl.hasLevy" ng-change="$ctrl.updateLevyMosaic($ctrl.hasLevy)">
<input id="box5" type="checkbox" ng-model="$ctrl.hasLevy" ng-change="$ctrl.updateLevyMosaic($ctrl.hasLevy, $ctrl.levyInNewlyCreatedMosaic)">
<label for="box5" class="col-md-12 control-label">{{ 'MOSAIC_DEFINITION_REQUIRES_LEVY' | translate }}</label>
</fieldset>
</div>
Expand Down Expand Up @@ -190,13 +190,21 @@ <h3>{{ 'GENERAL_LEVY' | translate }}</h3>
<div class="panel-body">
<div class="row">

<!-- Levy in newly created mosaic -->
<div class="col-md-12">
<fieldset class="form-group row mosaicCheckboxes">
<input id="box6" type="checkbox" ng-model="$ctrl.levyInNewlyCreatedMosaic" ng-change="$ctrl.updateLevyMosaic(true, $ctrl.levyInNewlyCreatedMosaic)">
<label for="box6" class="col-md-12 control-label">{{ 'MOSAIC_DEFINITION_LEVY_IS_NEW_MOSAIC' | translate }}</label>
</fieldset>
</div>
<div class="col-md-12">
<fieldset class="form-group">
<div class="input-group">
<span class="input-group-btn">
<label>{{ 'MOSAIC_DEFINITION_LEVY_SELECT_MOSAIC' | translate }}: </label>
</span>
<select class="form-control" ng-options="mosaicName for mosaicName in $ctrl.currentAccountMosaicNames" ng-model="$ctrl.selectedMosaic" ng-change="$ctrl.updateLevyMosaic(true)"></select>
<span class="form-control" readOnly ng-show="$ctrl.levyInNewlyCreatedMosaic">{{ $ctrl.formData.namespaceParent.fqn }}:{{ $ctrl.formData.mosaicName }}</span>
<select class="form-control" ng-hide="$ctrl.levyInNewlyCreatedMosaic" ng-options="mosaicName for mosaicName in $ctrl.currentAccountMosaicNames" ng-model="$ctrl.selectedMosaic" ng-change="$ctrl.updateLevyMosaic(true, false)"></select>
</div>
</fieldset>
</div>
Expand All @@ -220,7 +228,16 @@ <h3>{{ 'GENERAL_LEVY' | translate }}</h3>
</span>
<div class="form-control formFloat">
<input class="levy" type="number" ng-model="$ctrl.formData.levy.fee" min="0" max="9000000000">
<label class="floatRight">{{ $ctrl.selectedMosaic }} (μ)</label>
<span class="floatRight" ng-show="! $ctrl.levyInNewlyCreatedMosaic">
<label>{{ $ctrl.selectedMosaic }}</label>
<label ng-show="$ctrl.formData.levy.feeType===1">{{['','(×0.1)','(×0.01)','(×0.001)','(×0.0001)','(×0.00001)','(μ)'][$ctrl.selectedMosaicDivisibility()]}}</label>
<label ng-show="$ctrl.formData.levy.feeType===2">(×0.01 %)</label>
</span>
<span class="floatRight" ng-show="$ctrl.levyInNewlyCreatedMosaic">
<label>{{ $ctrl.formData.namespaceParent.fqn }}:{{ $ctrl.formData.mosaicName }}</label>
<label ng-show="$ctrl.formData.levy.feeType===1">{{['','(×0.1)','(×0.01)','(×0.001)','(×0.0001)','(×0.00001)','(μ)'][$ctrl.formData.properties.divisibility]}}</label>
<label ng-show="$ctrl.formData.levy.feeType===2">(×0.01 %)</label>
</span>
</div>
</div>
</fieldset>
Expand All @@ -245,22 +262,40 @@ <h3>{{ 'GENERAL_LEVY' | translate }}</h3>

<!-- Levy fee examples -->
<div class="panel-footer bg-info">
<div ng-show="$ctrl.formData.levy.feeType === 1">
<div ng-show="$ctrl.formData.levy.feeType === 1 && ! $ctrl.levyInNewlyCreatedMosaic">
{{ 'MOSAIC_DEFINITION_LEVY_FEE_TYPE_1_NOTE' | translate }}
<strong>{{($ctrl.formData.levy.fee | fmtSupply:$ctrl.mosaicOwned[$ctrl.selectedMosaic].mosaicId:$ctrl._DataStore.mosaic.metaData)[0]}}</strong>
<span class="text-muted">.{{($ctrl.formData.levy.fee | fmtSupply:$ctrl.mosaicOwned[$ctrl.selectedMosaic].mosaicId:$ctrl._DataStore.mosaic.metaData)[1]}}</span> {{$ctrl.selectedMosaic}}
</div>
<div ng-show="$ctrl.formData.levy.feeType === 2">
<div ng-show="$ctrl.formData.levy.feeType === 1 && $ctrl.levyInNewlyCreatedMosaic">
{{ 'MOSAIC_DEFINITION_LEVY_FEE_TYPE_1_NOTE' | translate }}
<strong>{{($ctrl.formData.levy.fee | fmtSupplyRaw:$ctrl.formData.properties.divisibility)[0]}}</strong>
<span class="text-muted">.{{ ($ctrl.formData.levy.fee | fmtSupplyRaw:$ctrl.formData.properties.divisibility)[1]}}</span> {{$ctrl.formData.namespaceParent.fqn}}:{{$ctrl.formData.mosaicName}}
</div>
<div ng-show="$ctrl.formData.levy.feeType === 2 && ! $ctrl.levyInNewlyCreatedMosaic">
{{ 'MOSAIC_DEFINITION_LEVY_FEE_TYPE_2_NOTE' | translate }}
<ul style="list-style:none">
<li ng-repeat="amountSend in [100, 1000, 3145, 10000, $ctrl.formData.properties.initialSupply] track by $index">
<li ng-repeat="amountSend in [100, 1000, 3145, 10000, $ctrl.formData.properties.initialSupply] track by $index">
{{ 'MOSAIC_DEFINITION_LEVY_FEE_TYPE_2_NOTE_2' | translate }}
<strong>{{(amountSend | fmtSupplyRaw:$ctrl.formData.properties.divisibility)[0]}}</strong>
<span class="text-muted">.{{(amountSend | fmtSupplyRaw:$ctrl.formData.properties.divisibility)[1]}}</span>
<strong>{{(amountSend*$ctrl.Math.pow(10, $ctrl.selectedMosaicDivisibility()) | fmtSupplyRaw:$ctrl.selectedMosaicDivisibility())[0]}}</strong>
<span class="text-muted">.{{(amountSend*$ctrl.Math.pow(10, $ctrl.selectedMosaicDivisibility()) | fmtSupplyRaw:$ctrl.selectedMosaicDivisibility())[1]}}</span>
<span class="text-muted">{{$ctrl.formData.namespaceParent.fqn}}:</span>{{$ctrl.formData.mosaicName}} {{ 'MOSAIC_DEFINITION_LEVY_FEE_TYPE_2_NOTE_3' | translate }}
<strong>{{( (amountSend * $ctrl.formData.levy.fee / 10000) | fmtSupply:$ctrl.mosaicOwned[$ctrl.selectedMosaic].mosaicId:$ctrl._DataStore.mosaic.metaData)[0]}}</strong>
<span class="text-muted">.{{( (amountSend * $ctrl.formData.levy.fee / 10000) | fmtSupply:$ctrl.mosaicOwned[$ctrl.selectedMosaic].mosaicId:$ctrl._DataStore.mosaic.metaData)[1]}}</span> {{$ctrl.selectedMosaic}}
</li>
<strong>{{( (amountSend * $ctrl.Math.pow(10, $ctrl.selectedMosaicDivisibility()) * $ctrl.formData.levy.fee / 10000) | fmtSupply:$ctrl.mosaicOwned[$ctrl.selectedMosaic].mosaicId:$ctrl._DataStore.mosaic.metaData)[0]}}</strong>
<span class="text-muted">.{{((amountSend * $ctrl.Math.pow(10, $ctrl.selectedMosaicDivisibility()) * $ctrl.formData.levy.fee / 10000) | fmtSupply:$ctrl.mosaicOwned[$ctrl.selectedMosaic].mosaicId:$ctrl._DataStore.mosaic.metaData)[1]}}</span> {{$ctrl.selectedMosaic}}
</li>
</ul>
</div>
<div ng-show="$ctrl.formData.levy.feeType === 2 && $ctrl.levyInNewlyCreatedMosaic">
{{ 'MOSAIC_DEFINITION_LEVY_FEE_TYPE_2_NOTE' | translate }}
<ul style="list-style:none">
<li ng-repeat="amountSend in [100, 1000, 3145, 10000, $ctrl.formData.properties.initialSupply] track by $index">
{{ 'MOSAIC_DEFINITION_LEVY_FEE_TYPE_2_NOTE_2' | translate }}
<strong>{{(amountSend*$ctrl.Math.pow(10, $ctrl.formData.properties.divisibility) | fmtSupplyRaw:$ctrl.formData.properties.divisibility)[0]}}</strong>
<span class="text-muted">.{{(amountSend*$ctrl.Math.pow(10, $ctrl.formData.properties.divisibility) | fmtSupplyRaw:$ctrl.formData.properties.divisibility)[1]}}</span>
<span class="text-muted">{{$ctrl.formData.namespaceParent.fqn}}:</span>{{$ctrl.formData.mosaicName}} {{ 'MOSAIC_DEFINITION_LEVY_FEE_TYPE_2_NOTE_3' | translate }}
<strong>{{( (amountSend * $ctrl.Math.pow(10, $ctrl.formData.properties.divisibility) * $ctrl.formData.levy.fee / 10000) | fmtSupplyRaw:$ctrl.formData.properties.divisibility)[0]}}</strong>
<span class="text-muted">.{{((amountSend * $ctrl.Math.pow(10, $ctrl.formData.properties.divisibility) * $ctrl.formData.levy.fee / 10000) | fmtSupplyRaw:$ctrl.formData.properties.divisibility)[1]}}</span> {{$ctrl.formData.namespaceParent.fqn}}:{{$ctrl.formData.mosaicName}}
</li>
</ul>
</div>
</div>
Expand Down