Skip to content

Commit

Permalink
fix: build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
yongenaelf committed Jun 24, 2024
1 parent 1381744 commit c3dfc87
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/Architecture/Smart Contract/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ A smart contract consists of methods that interact with state variables. Transac

aelf defines Smart Contracts as micro-services, making them language-independent. For example, the Consensus Protocol is a service defined by a smart contract.

![Smart Contract Architecture](../../_images/sc-as-service.png)
<!-- ![Smart Contract Architecture](../../_images/sc-as-service.png) -->

### Chain Interactions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ When deploying new contract code, Nodes perform checks against a whitelist. If a
| Type | Member (Field / Method) | Allowed |
|-------------------------------|-------------------------|-----------|
| Array | AsReadOnly | Allowed |
| Func<T> | ALL | Allowed |
| Func<T,T> | ALL | Allowed |
| Func<T,T,T> | ALL | Allowed |
| Nullable<T> | ALL | Allowed |
| Func\<T\> | ALL | Allowed |
| Func\<T,T\> | ALL | Allowed |
| Func\<T,T,T\> | ALL | Allowed |
| Nullable\<T\> | ALL | Allowed |
| Environment | CurrentManagedThreadId | Allowed |
| BitConverter | GetBytes | Allowed |
| NotImplementedException | ALL | Allowed |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

If these rules are not followed, code deployment will fail.

![Contract Class Structure](../../_images/contract-class-structure.png)
<!-- ![Contract Class Structure](../../_images/contract-class-structure.png) -->

## Field Usage Limitations

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,14 @@ await tokenHolderContractStub.RegisterForProfits.SendAsync(new RegisterForProfit
```

- Implement Donate to reduce the account balance by another 10 ELF:

```cs
await acs10DemoContractStub.Donate.SendAsync(new DonateInput
{
Symbol = "ELF",
Amount = amount
});
```

- Test the GetUndistributedDividends and GetDividends:
```cs
Expand Down
8 changes: 4 additions & 4 deletions docs/Reference/ACS Introduction/ACS4 - Consensus Standard.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ ACS4 methods correspond to the IConsensusService interface in the AElf.Kernel.Co
| ACS4 Method | IConsensusService Method | Methodology | Timing |
|------------------------------------|-----------------------------------|--------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| GetConsensusCommand | Task TriggerConsensusAsync | When TriggerConsensusAsync is called, it will use the node's configured account to call the GetConsensusCommand method to obtain block information (ConsensusCommand) | When the node starts; When the BestChainFoundEventData event is thrown; When consensus data validation fails and needs to be triggered again (IsReTrigger field is true). |
| GetConsensusExtraData | Task<byte[]> GetConsensusExtraDataAsync | When a node produces a block, it generates block header info via IBlockExtraDataService, which calls GetConsensusExtraData in the consensus contract | When a node produces a new block. |
| GenerateConsensusTransactions | Task<List<Transaction>> GenerateConsensusTransactionsAsync | In the process of generating new blocks, a consensus transaction needs to be generated as one of the system transactions | When a node produces a new block. |
| ValidateConsensusBeforeExecution | Task<bool> ValidateConsensusBeforeExecutionAsync | The IBlockValidationProvider interface allows adding a new block validator. The consensus validator, ConsensusValidationProvider, calls ValidateConsensusBeforeExecution | When a node produces a new block. |
| ValidateConsensusAfterExecution | Task<bool> ValidateConsensusAfterExecutionAsync | The implementation of ValidateBlockAfterExecuteAsync in ConsensusValidationProvider calls ValidateConsensusAfterExecution in the consensus contract | When a node produces a new block. |
| GetConsensusExtraData | Task\<byte[]\> GetConsensusExtraDataAsync | When a node produces a block, it generates block header info via IBlockExtraDataService, which calls GetConsensusExtraData in the consensus contract | When a node produces a new block. |
| GenerateConsensusTransactions | Task\<List\<Transaction\>\> GenerateConsensusTransactionsAsync | In the process of generating new blocks, a consensus transaction needs to be generated as one of the system transactions | When a node produces a new block. |
| ValidateConsensusBeforeExecution | Task\<bool\> ValidateConsensusBeforeExecutionAsync | The IBlockValidationProvider interface allows adding a new block validator. The consensus validator, ConsensusValidationProvider, calls ValidateConsensusBeforeExecution | When a node produces a new block. |
| ValidateConsensusAfterExecution | Task\<bool\> ValidateConsensusAfterExecutionAsync | The implementation of ValidateBlockAfterExecuteAsync in ConsensusValidationProvider calls ValidateConsensusAfterExecution in the consensus contract | When a node produces a new block. |

### Example
Refer to the AEDPoS contract implementation.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ This involves methods for chain creation and indexing:
#### acs7.ChainIdAndHeightDict
| Field | Description | Label |
|--------------------------|-------------------------|-----------|
| `id_height_dict` (map<int32, int64>) | Chain IDs and heights | repeated |
| `id_height_dict` (map\<int32, int64\>) | Chain IDs and heights | repeated |

#### acs7.ChainInitializationData
| Field | Description | Label |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ACS9 includes several methods given below:
#### acs9.ProfitsMap
| Field | Type | Description | Label |
|---------------|------------------------------------|------------------------------------------|-----------|
| value | map<string, int64> | Profits accumulated, symbol -> amount. | repeated |
| value | map\<string, int64\> | Profits accumulated, symbol -\> amount. | repeated |

#### acs9.TakeContractProfitsInput
| Field | Type | Description | Label |
Expand Down
6 changes: 3 additions & 3 deletions docs/devtools/contract-sdk/aelf-sdk-csharp.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ The generated hash type id.
| Name | Type | Description |
|----------------|--------------------------------------------|------------------------------------------|
| contractAddress| AElf.Types.Address | The contract address for id generation. |
| bytes | System.Collections.Generic.IEnumerable<Byte>| The bytes for id generation. |
| bytes | System.Collections.Generic.IEnumerable\<Byte\>| The bytes for id generation. |

## GetContractAddressByName(hash) `method`
Get the address of a system contract by its name hash. These hashes are in the SmartContractConstants.cs file.
Expand Down Expand Up @@ -218,7 +218,7 @@ Logs information for debugging. Visible only when the node is in debug mode.
### Parameters
| Name | Type | Description |
|------|----------------------------|-----------------------------------------|
| func | System.Func<System.String> | The logic for logging purposes. |
| func | System.Func\<System.String\> | The logic for logging purposes. |

## RecoverPublicKey() `method`
Recovers the public key of the transaction sender.
Expand Down Expand Up @@ -543,7 +543,7 @@ Generates a hash type ID based on the current contract address and the bytes.
| Name | Type | Description |
|-------|---------------------------------------------------------|----------------------------------------------|
| this | AElf.Kernel.SmartContract.ISmartContractBridgeContext | An instance of ISmartContractBridgeContext. |
| bytes | System.Collections.Generic.IEnumerable{System.Byte} | The bytes for ID generation. |
| bytes | System.Collections.Generic.IEnumerable\{System.Byte\} | The bytes for ID generation. |

## GenerateId(this, token) `method`
Generates a hash type ID based on the current contract address and the token.
Expand Down

0 comments on commit c3dfc87

Please sign in to comment.