Skip to content

Commit

Permalink
EpicChain Core - EpicChain Lab's
Browse files Browse the repository at this point in the history
  • Loading branch information
xmoohad committed Sep 11, 2024
1 parent db13978 commit 42b5da9
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 31 deletions.
10 changes: 5 additions & 5 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<LangVersion>12.0</LangVersion>
<Authors>The EpicChain Lab's</Authors>
<IsPackable>true</IsPackable>
<PackageIcon>neo.png</PackageIcon>
<PackageProjectUrl>https://github.com/epicchainlabs/epiccha</PackageProjectUrl>
<PackageIcon>epicchain.png</PackageIcon>
<PackageProjectUrl>https://github.com/epicchainlabs/epicchain</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/epicchainlabs/epiccha.git</RepositoryUrl>
<RepositoryUrl>https://github.com/epicchainlabs/epicchain.git</RepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<Company>The EpicChain Lab's</Company>
Expand All @@ -20,8 +20,8 @@
</PropertyGroup>

<ItemGroup>
<None Include="$(SolutionDir)/.neo/neo.png" Pack="true" Visible="false" PackagePath=""/>
<None Include="$(SolutionDir)/.neo/README.md" Pack="true" Visible="false" PackagePath=""/>
<None Include="$(SolutionDir)/.epicchain/epicchain.png" Pack="true" Visible="false" PackagePath=""/>
<None Include="$(SolutionDir)/.epicchain/README.md" Pack="true" Visible="false" PackagePath=""/>
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions src/Neo/EpicChainSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
namespace Neo
{
/// <summary>
/// Represents the basic unit that contains all the components required for running of a NEO node.
/// Represents the basic unit that contains all the components required for running of a EpicChain node.
/// </summary>
public class EpicChainSystem : IDisposable
{
Expand All @@ -63,7 +63,7 @@ public class EpicChainSystem : IDisposable
$"remote-node-mailbox {{ mailbox-type: \"{typeof(RemoteNodeMailbox).AssemblyQualifiedName}\" }}");

/// <summary>
/// The genesis block of the NEO blockchain.
/// The genesis block of the EpicChain blockchain.
/// </summary>
public Block GenesisBlock { get; }

Expand Down Expand Up @@ -156,9 +156,9 @@ public EpicChainSystem(ProtocolSettings settings, IStoreProvider storageProvider
}

/// <summary>
/// Creates the genesis block for the NEO blockchain.
/// Creates the genesis block for the EpicChain blockchain.
/// </summary>
/// <param name="settings">The <see cref="ProtocolSettings"/> of the NEO system.</param>
/// <param name="settings">The <see cref="ProtocolSettings"/> of the EpicChain system.</param>
/// <returns>The genesis block.</returns>
public static Block CreateGenesisBlock(ProtocolSettings settings) => new()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Neo/SmartContract/ApplicationEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
namespace Neo.SmartContract
{
/// <summary>
/// A virtual machine used to execute smart contracts in the NEO system.
/// A virtual machine used to execute smart contracts in the EpicChain system.
/// </summary>
public partial class ApplicationEngine : ExecutionEngine
{
Expand Down Expand Up @@ -81,7 +81,7 @@ public partial class ApplicationEngine : ExecutionEngine
public static IApplicationEngineProvider Provider { get; set; }

/// <summary>
/// Gets the descriptors of all interoperable services available in NEO.
/// Gets the descriptors of all interoperable services available in EpicChain.
/// </summary>
public static IReadOnlyDictionary<uint, InteropDescriptor> Services => services;

Expand Down
6 changes: 3 additions & 3 deletions src/Neo/SmartContract/ContractBasicMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
namespace Neo.SmartContract
{
/// <summary>
/// This class provides a guideline for basic methods used in the Neo blockchain, offering
/// This class provides a guideline for basic methods used in the EpicChain blockchain, offering
/// a generalized interaction mechanism for smart contract deployment, verification, updates, and destruction.
/// </summary>
public record ContractBasicMethod
Expand Down Expand Up @@ -79,7 +79,7 @@ public record ContractBasicMethod

/// <summary>
/// The update method. Requires <see cref="NefFile"/> or <see cref="Manifest"/>, or both, and is passed to _deploy.
/// Should verify the signer's address using SYSCALL <code>Neo.Runtime.CheckWitness</code>.
/// Should verify the signer's address using SYSCALL <code>EpicChain.Runtime.CheckWitness</code>.
/// <code>
/// {
/// "name": "update",
Expand All @@ -106,7 +106,7 @@ public record ContractBasicMethod

/// <summary>
/// The destruction method. Deletes all the storage of the contract.
/// Should verify the signer's address using SYSCALL <code>Neo.Runtime.CheckWitness</code>.
/// Should verify the signer's address using SYSCALL <code>EpicChain.Runtime.CheckWitness</code>.
/// Any tokens in the contract must be transferred before destruction.
/// <code>
/// {
Expand Down
24 changes: 12 additions & 12 deletions src/Neo/SmartContract/Native/EpicChain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@
namespace Neo.SmartContract.Native
{
/// <summary>
/// Represents the NEO token in the NEO system.
/// Represents the EpicChain token in the EpicChain system.
/// </summary>
public sealed class EpicChain : FungibleToken<EpicChain.EpicChainAccountState>
{
public override string Symbol => "XPR";
public override byte Decimals => 0;

/// <summary>
/// Indicates the total amount of NEO.
/// Indicates the total amount of EpicChain.
/// </summary>
public BigInteger TotalAmount { get; }

/// <summary>
/// Indicates the effective voting turnout in NEO. The voted candidates will only be effective when the voting turnout exceeds this value.
/// Indicates the effective voting turnout in EpicChain. The voted candidates will only be effective when the voting turnout exceeds this value.
/// </summary>
public const decimal EffectiveVoterTurnout = 0.2M;

Expand All @@ -60,7 +60,7 @@ public sealed class EpicChain : FungibleToken<EpicChain.EpicChainAccountState>
private const byte Prefix_RegisterPrice = 13;
private const byte Prefix_VoterRewardPerCommittee = 23;

private const byte NeoHolderRewardRatio = 10;
private const byte epicchainHolderRewardRatio = 10;
private const byte CommitteeRewardRatio = 10;
private const byte VoterRewardRatio = 80;

Expand Down Expand Up @@ -142,17 +142,17 @@ private BigInteger CalculateBonus(DataCache snapshot, EpicChainAccountState stat
if (expectEnd != end) throw new ArgumentOutOfRangeException(nameof(end));
if (state.BalanceHeight >= end) return BigInteger.Zero;
// In the unit of datoshi, 1 datoshi = 1e-8 EpicPulse
BigInteger neoHolderReward = CalculateNeoHolderReward(snapshot, state.Balance, state.BalanceHeight, end);
if (state.VoteTo is null) return neoHolderReward;
BigInteger epicchainHolderReward = CalculateEpicChainHolderReward(snapshot, state.Balance, state.BalanceHeight, end);
if (state.VoteTo is null) return epicchainHolderReward;

var keyLastest = CreateStorageKey(Prefix_VoterRewardPerCommittee).Add(state.VoteTo);
var latestEpicPulsePerVote = snapshot.TryGet(keyLastest) ?? BigInteger.Zero;
var voteReward = state.Balance * (latestEpicPulsePerVote - state.LastEpicPulsePerVote) / 100000000L;

return neoHolderReward + voteReward;
return epicchainHolderReward + voteReward;
}

private BigInteger CalculateNeoHolderReward(DataCache snapshot, BigInteger value, uint start, uint end)
private BigInteger CalculateEpicChainHolderReward(DataCache snapshot, BigInteger value, uint start, uint end)
{
// In the unit of datoshi, 1 EpicPulse = 10^8 datoshi
BigInteger sum = 0;
Expand All @@ -169,7 +169,7 @@ private BigInteger CalculateNeoHolderReward(DataCache snapshot, BigInteger value
break;
}
}
return value * sum * NeoHolderRewardRatio / 100 / TotalAmount;
return value * sum * epicchainHolderRewardRatio / 100 / TotalAmount;
}

private void CheckCandidate(DataCache snapshot, ECPoint pubkey, CandidateState candidate)
Expand Down Expand Up @@ -259,10 +259,10 @@ internal override async ContractTask PostPersistAsync(ApplicationEngine engine)
var factor = index < n ? 2 : 1; // The `voter` rewards of validator will double than other committee's
if (Votes > 0)
{
BigInteger voterSumRewardPerNEO = factor * voterRewardOfEachCommittee / Votes;
BigInteger voterSumRewardPerEpicChain = factor * voterRewardOfEachCommittee / Votes;
StorageKey voterRewardKey = CreateStorageKey(Prefix_VoterRewardPerCommittee).Add(PublicKey);
StorageItem lastRewardPerNeo = engine.SnapshotCache.GetAndChange(voterRewardKey, () => new StorageItem(BigInteger.Zero));
lastRewardPerNeo.Add(voterSumRewardPerNEO);
StorageItem lastRewardPerEpicChain = engine.SnapshotCache.GetAndChange(voterRewardKey, () => new StorageItem(BigInteger.Zero));
lastRewardPerEpicChain.Add(voterSumRewardPerEpicChain);
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/Neo/SmartContract/NefFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace Neo.SmartContract
{
/*
┌───────────────────────────────────────────────────────────────────────┐
NEO Executable Format 3 (NEF3) │
EpicChain Executable Format 3 (NEF3) │
├──────────┬───────────────┬────────────────────────────────────────────┤
│ Field │ Type │ Comment │
├──────────┼───────────────┼────────────────────────────────────────────┤
Expand All @@ -49,17 +49,17 @@ namespace Neo.SmartContract
└──────────┴───────────────┴────────────────────────────────────────────┘
*/
/// <summary>
/// Represents the structure of NEO Executable Format.
/// Represents the structure of EpicChain Executable Format.
/// </summary>
public class NefFile : ISerializable
{
/// <summary>
/// NEO Executable Format 3 (NEF3)
/// EpicChain Executable Format 3 (NEF3)
/// </summary>
private const uint Magic = 0x3346454E;

/// <summary>
/// The name and version of the compiler that generated this nef file.
/// The name and version of the compiler that generated this xef file.
/// </summary>
public string Compiler { get; set; }

Expand Down
2 changes: 1 addition & 1 deletion src/Neo/TimeProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
namespace Neo
{
/// <summary>
/// The time provider for the NEO system.
/// The time provider for the EpicChain system.
/// </summary>
public class TimeProvider
{
Expand Down

0 comments on commit 42b5da9

Please sign in to comment.