Skip to content

Commit ac0dfc0

Browse files
committed
Remove IsProfitable
1 parent 01f5a94 commit ac0dfc0

File tree

32 files changed

+9
-117
lines changed

32 files changed

+9
-117
lines changed

contract/AElf.Contracts.CrossChain/CrossChainContract_Helper.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,7 @@ private void CreateSideChainToken(SideChainCreationRequest sideChainCreationRequ
188188
Symbol = sideChainCreationRequest.SideChainTokenSymbol,
189189
TotalSupply = sideChainCreationRequest.SideChainTokenTotalSupply,
190190
Decimals = sideChainCreationRequest.SideChainTokenDecimals,
191-
IsBurnable = sideChainCreationRequest.IsSideChainTokenBurnable,
192-
IsProfitable = sideChainCreationRequest.IsSideChainTokenProfitable
191+
IsBurnable = sideChainCreationRequest.IsSideChainTokenBurnable
193192
};
194193
SetContractStateRequired(State.TokenContract, SmartContractConstants.TokenContractSystemName);
195194
State.TokenContract.Create.Send(new CreateInput
@@ -201,7 +200,6 @@ private void CreateSideChainToken(SideChainCreationRequest sideChainCreationRequ
201200
IssueChainId = chainId,
202201
Symbol = sideChainTokenInfo.Symbol,
203202
TotalSupply = sideChainTokenInfo.TotalSupply,
204-
IsProfitable = sideChainTokenInfo.IsProfitable,
205203
MetaData = {sideChainTokenInfo.MetaData}
206204
});
207205
}

contract/AElf.Contracts.Economic/EconomicContract.cs

-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ private void CreateNativeToken(InitialEconomicSystemInput input)
4949
Decimals = input.NativeTokenDecimals,
5050
IsBurnable = input.IsNativeTokenBurnable,
5151
Issuer = Context.Self,
52-
IsProfitable = true,
5352
LockWhiteList =
5453
{
5554
Context.GetContractAddressByName(SmartContractConstants.VoteContractSystemName),
@@ -80,7 +79,6 @@ private void CreateResourceTokens()
8079
TotalSupply = EconomicContractConstants.ResourceTokenTotalSupply,
8180
Decimals = EconomicContractConstants.ResourceTokenDecimals,
8281
Issuer = Context.Self,
83-
IsProfitable = true,
8482
LockWhiteList =
8583
{
8684
Context.GetContractAddressByName(SmartContractConstants.TreasuryContractSystemName),

contract/AElf.Contracts.MultiToken/TokenContractConstants.cs

-8
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,5 @@ public static class TokenContractConstants
1212

1313
public const string PayTxFeeSymbolListName = "SymbolListToPayTxFee";
1414
public const string PayRentalSymbolListName = "SymbolListToPayRental";
15-
16-
public const string IsProfitable = "IsProfitable";
17-
18-
public static readonly ReadOnlyCollection<string> TokenMetaDataKeys = new ReadOnlyCollection<string>(
19-
new List<string>
20-
{
21-
TokenContractConstants.IsProfitable
22-
});
2315
}
2416
}

contract/AElf.Contracts.MultiToken/TokenContract_ACS1_MethodFeeProvider.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Collections.Generic;
2-
using System.Linq;
32
using AElf.Standards.ACS1;
43
using AElf.Standards.ACS3;
54
using AElf.Sdk.CSharp;
@@ -128,8 +127,7 @@ private void AssertValidFeeToken(string symbol, long amount)
128127
AssertValidSymbolAndAmount(symbol, amount);
129128
if (State.TokenInfos[symbol] == null)
130129
throw new AssertionException("Token is not found");
131-
Assert(State.TokenInfos[symbol].IsBurnable && IsTokenProfitable(symbol),
132-
$"Token {symbol} cannot set as method fee.");
130+
Assert(State.TokenInfos[symbol].IsBurnable, $"Token {symbol} cannot set as method fee.");
133131
}
134132

135133
#endregion

contract/AElf.Contracts.MultiToken/TokenContract_Actions.cs

+1-7
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public override Empty Create(CreateInput input)
5151
IsBurnable = input.IsBurnable,
5252
IssueChainId = input.IssueChainId == 0 ? Context.ChainId : input.IssueChainId
5353
};
54-
tokenInfo.MetaData.Add(TokenContractConstants.IsProfitable, input.IsProfitable.ToString());
5554
RegisterTokenInfo(tokenInfo);
5655
if (string.IsNullOrEmpty(State.NativeTokenSymbol.Value))
5756
{
@@ -157,8 +156,6 @@ public override Empty CrossChainCreateToken(CrossChainCreateTokenInput input)
157156
IsBurnable = validateTokenInfoExistsInput.IsBurnable,
158157
IssueChainId = validateTokenInfoExistsInput.IssueChainId
159158
};
160-
tokenInfo.MetaData.Add(TokenContractConstants.IsProfitable,
161-
validateTokenInfoExistsInput.IsProfitable.ToString());
162159
RegisterTokenInfo(tokenInfo);
163160
return new Empty();
164161
}
@@ -334,8 +331,6 @@ public override Empty TransferFrom(TransferFromInput input)
334331
/// <returns></returns>
335332
private bool IsContributingProfits(TransferFromInput input)
336333
{
337-
if (!IsTokenProfitable(input.Symbol)) return false;
338-
339334
if (Context.Sender == Context.GetContractAddressByName(SmartContractConstants.ProfitContractSystemName) ||
340335
Context.Sender ==
341336
Context.GetContractAddressByName(SmartContractConstants.TreasuryContractSystemName) // For main chain.
@@ -502,8 +497,7 @@ public override Empty ValidateTokenInfoExists(ValidateTokenInfoExistsInput input
502497
bool validationResult = tokenInfo != null && tokenInfo.TokenName == input.TokenName &&
503498
tokenInfo.IsBurnable == input.IsBurnable && tokenInfo.Decimals == input.Decimals &&
504499
tokenInfo.Issuer == input.Issuer && tokenInfo.TotalSupply == input.TotalSupply &&
505-
tokenInfo.IssueChainId == input.IssueChainId &&
506-
IsTokenProfitable(tokenInfo) == input.IsProfitable;
500+
tokenInfo.IssueChainId == input.IssueChainId;
507501
Assert(validationResult, "Token validation failed.");
508502
return new Empty();
509503
}

contract/AElf.Contracts.MultiToken/TokenContract_Fees.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ private void TransferTransactionFeesToFeeReceiver(string symbol, long totalAmoun
623623
if (totalAmount <= 0) return;
624624

625625
var tokenInfo = State.TokenInfos[symbol];
626-
if (!tokenInfo.IsBurnable || !IsTokenProfitable(symbol))
626+
if (!tokenInfo.IsBurnable)
627627
{
628628
return;
629629
}

contract/AElf.Contracts.MultiToken/TokenContract_Views.cs

+1-20
Original file line numberDiff line numberDiff line change
@@ -213,27 +213,8 @@ public override BoolValue IsTokenAvailableForMethodFee(StringValue input)
213213
if (tokenInfo == null) throw new AssertionException("Token is not found.");
214214
return new BoolValue
215215
{
216-
Value = IsTokenProfitable(tokenInfo) && tokenInfo.IsBurnable
216+
Value = tokenInfo.IsBurnable
217217
};
218218
}
219-
220-
private bool IsTokenProfitable(string symbol)
221-
{
222-
var tokenInfo = State.TokenInfos[symbol];
223-
if (tokenInfo == null ||
224-
!tokenInfo.MetaData.TryGetValue(TokenContractConstants.IsProfitable, out var isProfitable))
225-
return false;
226-
return isProfitable == true.ToString();
227-
}
228-
229-
private bool IsTokenProfitable(TokenInfo tokenInfo)
230-
{
231-
if (tokenInfo.MetaData.TryGetValue(TokenContractConstants.IsProfitable, out var isProfitable))
232-
{
233-
return isProfitable == true.ToString();
234-
}
235-
236-
return false;
237-
}
238219
}
239220
}

protobuf/acs7.proto

-2
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ message SideChainCreationRequest {
151151
int64 side_chain_token_total_supply = 6;
152152
int32 side_chain_token_decimals = 7;
153153
bool is_side_chain_token_burnable = 8;
154-
bool is_side_chain_token_profitable = 9;
155154
repeated SideChainTokenInitialIssue side_chain_token_initial_issue_list = 10;
156155
map<string, int32> initial_resource_amount = 11;
157156
}
@@ -168,7 +167,6 @@ message SideChainTokenInfo {
168167
int32 decimals = 4;
169168
aelf.Address issuer = 5;
170169
bool is_burnable = 6;
171-
bool is_profitable = 7;
172170
map<string, string> meta_data = 8;
173171
}
174172

protobuf/token_contract.proto

-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ message CreateInput {
146146
aelf.Address issuer = 5;
147147
bool is_burnable = 6;
148148
repeated aelf.Address lock_white_list = 7;
149-
bool is_profitable = 8;
150149
int32 issue_chain_id = 9;
151150
map<string, string> meta_data = 10;
152151
}

protobuf/token_contract_impl.proto

-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ message ValidateTokenInfoExistsInput{
123123
aelf.Address issuer = 5;
124124
bool is_burnable = 6;
125125
int32 issue_chain_id = 7;
126-
bool is_profitable = 8;
127126
}
128127

129128
message UpdateRentalInput {

test/AElf.Contracts.Association.Tests/AssociationContractTests.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,6 @@ await TokenContractStub.Create.SendAsync(new CreateInput
10261026
TokenName = "name",
10271027
Issuer = DefaultSender,
10281028
TotalSupply = 1000_000,
1029-
IsProfitable = false
10301029
});
10311030
var ret = await AssociationContractStub.SetMethodFee.SendWithExceptionAsync(invalidMethodFees);
10321031
ret.TransactionResult.Error.ShouldContain($"Token {tokenSymbol} cannot set as method fee.");

test/AElf.Contracts.Association.Tests/UnitTestTokenContractInitializationProvider.cs

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ public override List<ContractInitializationMethodCall> GetInitializeMethodList(b
4242
Symbol = _economicOptions.Symbol,
4343
TokenName = _economicOptions.TokenName,
4444
TotalSupply = _economicOptions.TotalSupply,
45-
IsProfitable = true
4645
}.ToByteString(),
4746
},
4847
new ContractInitializationMethodCall

test/AElf.Contracts.Configuration.Tests/ConfigurationContractTest.cs

-1
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,6 @@ await Tester.ExecuteContractWithMiningAsync(TokenContractAddress,
347347
TokenName = "name",
348348
Issuer = TokenContractAddress,
349349
TotalSupply = 1000_000,
350-
IsProfitable = false
351350
});
352351

353352
var result = await Tester.ExecuteContractWithMiningAsync(ConfigurationContractAddress,

test/AElf.Contracts.CrossChain.Tests/CrossChainContractTestBase.cs

-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ await MineAsync(new List<Transaction>
193193
TokenName = "elf token",
194194
TotalSupply = totalSupply,
195195
Issuer = DefaultSender,
196-
IsProfitable = true
197196
}),
198197
TokenContractStub.Issue.GetTransaction(new IssueInput
199198
{

test/AElf.Contracts.EconomicSystem.Tests/BVT/TreasuryBasicTests.cs

-16
Original file line numberDiff line numberDiff line change
@@ -300,21 +300,6 @@ await ExecuteProposalForParliamentTransactionWithException(Tester, TreasuryContr
300300
setSymbolRet.Error.ShouldContain("Need to contain native symbol");
301301
}
302302

303-
// without profitable and treasury contract is not in whitelist
304-
{
305-
var newSymbolList = new SymbolList
306-
{
307-
Value =
308-
{
309-
nativeTokenSymbol, tokenSymbol
310-
}
311-
};
312-
var setSymbolRet =
313-
await ExecuteProposalForParliamentTransactionWithException(Tester, TreasuryContractAddress, methodName,
314-
newSymbolList);
315-
setSymbolRet.Error.ShouldContain("Symbol need to be profitable");
316-
}
317-
318303
//not valid connector
319304
{
320305
var newSymbolList = new SymbolList
@@ -343,7 +328,6 @@ public async Task Treasury_SetSymbolList_Success_Test()
343328
TokenName = "CWJ name",
344329
TotalSupply = 1_0000_0000,
345330
Issuer = BootMinerAddress,
346-
IsProfitable = true,
347331
IsBurnable = true
348332
};
349333
await TokenContractStub.Create.SendAsync(tokenCreateInput);

test/AElf.Contracts.MultiToken.Tests/BVT/ACS1_ImplementTest.cs

-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ await TokenContractStub.Create.SendAsync(new CreateInput
218218
TokenName = "name",
219219
Issuer = DefaultAddress,
220220
TotalSupply = 1000_000,
221-
IsProfitable = false
222221
});
223222
var methodFees = new MethodFees
224223
{

test/AElf.Contracts.MultiToken.Tests/BVT/TokenManagementTests.cs

+1-8
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,7 @@ public partial class MultiTokenContractTests : MultiTokenContractTestBase
5757
IsBurnable = true,
5858
Issuer = Accounts[0].Address,
5959
Supply = 0,
60-
IssueChainId = _chainId,
61-
MetaData =
62-
{
63-
{"IsProfitable", false.ToString()}
64-
}
60+
IssueChainId = _chainId
6561
};
6662

6763
/// <summary>
@@ -126,7 +122,6 @@ await TokenContractStub.Create.SendAsync(new CreateInput
126122
Decimals = NativeTokenInfo.Decimals,
127123
Issuer = NativeTokenInfo.Issuer,
128124
IsBurnable = NativeTokenInfo.IsBurnable,
129-
IsProfitable = true,
130125
LockWhiteList =
131126
{
132127
BasicFunctionContractAddress,
@@ -147,10 +142,8 @@ await TokenContractStub.Create.SendAsync(new CreateInput
147142
Decimals = NativeTokenInfo.Decimals,
148143
Issuer = NativeTokenInfo.Issuer,
149144
IsBurnable = NativeTokenInfo.IsBurnable,
150-
IsProfitable = true
151145
});
152146

153-
154147
await TokenContractStub.Create.SendAsync(new CreateInput
155148
{
156149
Decimals = PrimaryTokenInfo.Decimals,

test/AElf.Contracts.MultiToken.Tests/UnitTestTokenContractInitializationProvider.cs

-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ public override List<ContractInitializationMethodCall> GetInitializeMethodList(b
4343
Symbol = _economicOptions.Symbol,
4444
TokenName = _economicOptions.TokenName,
4545
TotalSupply = _economicOptions.TotalSupply,
46-
IsProfitable = true
4746
}.ToByteString(),
4847
},
4948
new ContractInitializationMethodCall

test/AElf.Contracts.MultiTokenCrossChainTransfer.Tests/MultiTokenContractReferenceFeeTest.cs

-3
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,6 @@ await TokenContractStub.Create.SendAsync(new CreateInput
491491
TokenName = "name",
492492
Issuer = TokenContractAddress,
493493
TotalSupply = 100_000,
494-
IsProfitable = true,
495494
IsBurnable = true
496495
});
497496
var newSymbolList = new SymbolListToPayTxSizeFee();
@@ -587,7 +586,6 @@ await TokenContractStub.Create.SendAsync(new CreateInput
587586
TokenName = "name",
588587
Issuer = TokenContractAddress,
589588
TotalSupply = 100_000,
590-
IsProfitable = false
591589
});
592590
var newSymbolList = new SymbolListToPayTxSizeFee
593591
{
@@ -633,7 +631,6 @@ await TokenContractStub.Create.SendAsync(new CreateInput
633631
TokenName = "name",
634632
Issuer = TokenContractAddress,
635633
TotalSupply = newTokenTotalSupply,
636-
IsProfitable = true,
637634
IsBurnable = true
638635
});
639636
var invalidBaseTokenWeight = (int)long.MaxValue.Div(newTokenTotalSupply).Add(1);

test/AElf.Contracts.MultiTokenCrossChainTransfer.Tests/UnitTestTokenContractInitializationProvider.cs

-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ public override List<ContractInitializationMethodCall> GetInitializeMethodList(b
4343
Symbol = _economicOptions.Symbol,
4444
TokenName = _economicOptions.TokenName,
4545
TotalSupply = _economicOptions.TotalSupply,
46-
IsProfitable = true
4746
}.ToByteString(),
4847
},
4948
new ContractInitializationMethodCall

test/AElf.Contracts.Parliament.Tests/ParliamentContractTestBase.cs

-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ await TokenContractStub.Create.SendAsync(new CreateInput
121121
TokenName = "elf token",
122122
TotalSupply = totalSupply,
123123
Issuer = DefaultSender,
124-
IsProfitable = true
125124
});
126125
await TokenContractStub.Issue.SendAsync(new IssueInput
127126
{

test/AElf.Contracts.Profit.Tests/ProfitContractTestBase.cs

-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ private SystemContractDeploymentInput.Types.SystemTransactionMethodCallList
149149
TokenName = "elf token",
150150
TotalSupply = ProfitContractTestConstants.NativeTokenTotalSupply,
151151
Issuer = Starter,
152-
IsProfitable = true,
153152
LockWhiteList =
154153
{
155154
ProfitContractAddress

test/AElf.Contracts.Referendum.Tests/ReferendumContractTestBase.cs

-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ private SystemContractDeploymentInput.Types.SystemTransactionMethodCallList
140140
TokenName = "elf token",
141141
TotalSupply = totalSupply,
142142
Issuer = DefaultSender,
143-
IsProfitable = true
144143
});
145144

146145
//issue default user

test/AElf.Contracts.TestBase/ContractTester.cs

-1
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,6 @@ public Action<List<GenesisSmartContractDto>> GetDefaultContractTypes(Address iss
724724
Decimals = 8,
725725
Issuer = issuer,
726726
IsBurnable = true,
727-
IsProfitable = true
728727
});
729728
tokenContractCallList.Add(nameof(TokenContractContainer.TokenContractStub.SetPrimaryTokenSymbol),
730729
new SetPrimaryTokenSymbolInput {Symbol = "ELF"});

test/AElf.Contracts.TestContract.DApp/DAppContract.cs

-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ private void CreateToken(Address profitReceiver, bool isLockWhiteListIncludingSe
196196
Decimals = DAppConstants.Decimal,
197197
Issuer = Context.Self,
198198
IsBurnable = true,
199-
IsProfitable = true,
200199
TotalSupply = DAppConstants.TotalSupply,
201200
LockWhiteList =
202201
{

test/AElf.Contracts.TestContract.TransactionFeeCharging/TransactionFeeChargingContract.cs

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public override Empty InitializeTransactionFeeChargingContract(
2121
Decimals = 2,
2222
Issuer = Context.Self,
2323
IsBurnable = true,
24-
IsProfitable = true,
2524
TotalSupply = TransactionFeeChargingContractConstants.TotalSupply,
2625
LockWhiteList =
2726
{

0 commit comments

Comments
 (0)