Skip to content

Commit

Permalink
Epoch Manager algorithm (#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
pahor167 authored Sep 26, 2024
1 parent f5e0101 commit 7400467
Show file tree
Hide file tree
Showing 80 changed files with 2,252 additions and 1,053 deletions.
5 changes: 5 additions & 0 deletions .changeset/fuzzy-walls-give.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@celo/contractkit': minor
---

Adds support for EpochManager and ScoreManager contracts
5 changes: 5 additions & 0 deletions .changeset/mean-mayflies-agree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@celo/celocli': minor
---

Adds epochs:start epochs:switch & epochs:finish commands
92 changes: 92 additions & 0 deletions docs/command-line-interface/epochs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
`celocli epochs`
================

Finishes next epoch process.

* [`celocli epochs:finish`](#celocli-epochsfinish)
* [`celocli epochs:start`](#celocli-epochsstart)
* [`celocli epochs:switch`](#celocli-epochsswitch)

## `celocli epochs:finish`

Finishes next epoch process.

```
USAGE
$ celocli epochs:finish --from 0xc1912fEE45d61C87Cc5EA59DaE31190FFFFf232d
[--gasCurrency 0x1234567890123456789012345678901234567890] [--globalHelp]
FLAGS
--from=0xc1912fEE45d61C87Cc5EA59DaE31190FFFFf232d (required) Account Address
--gasCurrency=0x1234567890123456789012345678901234567890 Use a specific gas currency
for transaction fees
(defaults to CELO if no gas
currency is supplied). It
must be a whitelisted token.
--globalHelp View all available global
flags
DESCRIPTION
Finishes next epoch process.
EXAMPLES
finish --from 0x47e172F6CfB6c7D01C1574fa3E2Be7CC73269D95
```

_See code: [src/commands/epochs/finish.ts](https://github.com/celo-org/developer-tooling/tree/master/packages/cli/src/commands/epochs/finish.ts)_

## `celocli epochs:start`

Starts next epoch process.

```
USAGE
$ celocli epochs:start --from 0xc1912fEE45d61C87Cc5EA59DaE31190FFFFf232d
[--gasCurrency 0x1234567890123456789012345678901234567890] [--globalHelp]
FLAGS
--from=0xc1912fEE45d61C87Cc5EA59DaE31190FFFFf232d (required) Account Address
--gasCurrency=0x1234567890123456789012345678901234567890 Use a specific gas currency
for transaction fees
(defaults to CELO if no gas
currency is supplied). It
must be a whitelisted token.
--globalHelp View all available global
flags
DESCRIPTION
Starts next epoch process.
EXAMPLES
start --from 0x47e172F6CfB6c7D01C1574fa3E2Be7CC73269D95
```

_See code: [src/commands/epochs/start.ts](https://github.com/celo-org/developer-tooling/tree/master/packages/cli/src/commands/epochs/start.ts)_

## `celocli epochs:switch`

Finishes current epoch and starts a new one.

```
USAGE
$ celocli epochs:switch --from 0xc1912fEE45d61C87Cc5EA59DaE31190FFFFf232d
[--gasCurrency 0x1234567890123456789012345678901234567890] [--globalHelp]
FLAGS
--from=0xc1912fEE45d61C87Cc5EA59DaE31190FFFFf232d (required) Account Address
--gasCurrency=0x1234567890123456789012345678901234567890 Use a specific gas currency
for transaction fees
(defaults to CELO if no gas
currency is supplied). It
must be a whitelisted token.
--globalHelp View all available global
flags
DESCRIPTION
Finishes current epoch and starts a new one.
EXAMPLES
switch --from 0x47e172F6CfB6c7D01C1574fa3E2Be7CC73269D95
```

_See code: [src/commands/epochs/switch.ts](https://github.com/celo-org/developer-tooling/tree/master/packages/cli/src/commands/epochs/switch.ts)_
93 changes: 54 additions & 39 deletions docs/sdk/contractkit/classes/contract_cache.WrapperCache.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ Consider Using MiniWrapperCache, building your own, or if you only need one Wrap
- [getAccounts](contract_cache.WrapperCache.md#getaccounts)
- [getAttestations](contract_cache.WrapperCache.md#getattestations)
- [getBlockchainParameters](contract_cache.WrapperCache.md#getblockchainparameters)
- [getCeloDistributionSchedule](contract_cache.WrapperCache.md#getcelodistributionschedule)
- [getContract](contract_cache.WrapperCache.md#getcontract)
- [getDoubleSigningSlasher](contract_cache.WrapperCache.md#getdoublesigningslasher)
- [getDowntimeSlasher](contract_cache.WrapperCache.md#getdowntimeslasher)
- [getElection](contract_cache.WrapperCache.md#getelection)
- [getEpochManager](contract_cache.WrapperCache.md#getepochmanager)
- [getEpochRewards](contract_cache.WrapperCache.md#getepochrewards)
- [getErc20](contract_cache.WrapperCache.md#geterc20)
- [getEscrow](contract_cache.WrapperCache.md#getescrow)
Expand All @@ -53,6 +53,7 @@ Consider Using MiniWrapperCache, building your own, or if you only need one Wrap
- [getMultiSig](contract_cache.WrapperCache.md#getmultisig)
- [getOdisPayments](contract_cache.WrapperCache.md#getodispayments)
- [getReserve](contract_cache.WrapperCache.md#getreserve)
- [getScoreManager](contract_cache.WrapperCache.md#getscoremanager)
- [getSortedOracles](contract_cache.WrapperCache.md#getsortedoracles)
- [getStableToken](contract_cache.WrapperCache.md#getstabletoken)
- [getValidators](contract_cache.WrapperCache.md#getvalidators)
Expand All @@ -78,7 +79,7 @@ Consider Using MiniWrapperCache, building your own, or if you only need one Wrap

#### Defined in

[packages/sdk/contractkit/src/contract-cache.ts:124](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L124)
[packages/sdk/contractkit/src/contract-cache.ts:127](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L127)

## Properties

Expand All @@ -88,7 +89,7 @@ Consider Using MiniWrapperCache, building your own, or if you only need one Wrap

#### Defined in

[packages/sdk/contractkit/src/contract-cache.ts:126](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L126)
[packages/sdk/contractkit/src/contract-cache.ts:129](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L129)

___

Expand All @@ -98,7 +99,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/contract-cache.ts:125](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L125)
[packages/sdk/contractkit/src/contract-cache.ts:128](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L128)

___

Expand All @@ -108,7 +109,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/contract-cache.ts:127](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L127)
[packages/sdk/contractkit/src/contract-cache.ts:130](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L130)

## Methods

Expand All @@ -126,7 +127,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/contract-cache.ts:130](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L130)
[packages/sdk/contractkit/src/contract-cache.ts:133](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L133)

___

Expand All @@ -140,7 +141,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/contract-cache.ts:133](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L133)
[packages/sdk/contractkit/src/contract-cache.ts:136](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L136)

___

Expand All @@ -154,20 +155,6 @@ ___

#### Defined in

[packages/sdk/contractkit/src/contract-cache.ts:136](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L136)

___

### getCeloDistributionSchedule

**getCeloDistributionSchedule**(): `Promise`\<[`CeloDistributionScheduleWrapper`](wrappers_CeloDistributionScheduleWrapper.CeloDistributionScheduleWrapper.md)\>

#### Returns

`Promise`\<[`CeloDistributionScheduleWrapper`](wrappers_CeloDistributionScheduleWrapper.CeloDistributionScheduleWrapper.md)\>

#### Defined in

[packages/sdk/contractkit/src/contract-cache.ts:139](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L139)

___
Expand Down Expand Up @@ -201,7 +188,7 @@ Get Contract wrapper

#### Defined in

[packages/sdk/contractkit/src/contract-cache.ts:207](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L207)
[packages/sdk/contractkit/src/contract-cache.ts:213](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L213)

___

Expand Down Expand Up @@ -247,6 +234,20 @@ ___

___

### getEpochManager

**getEpochManager**(): `Promise`\<[`EpochManagerWrapper`](wrappers_EpochManager.EpochManagerWrapper.md)\>

#### Returns

`Promise`\<[`EpochManagerWrapper`](wrappers_EpochManager.EpochManagerWrapper.md)\>

#### Defined in

[packages/sdk/contractkit/src/contract-cache.ts:154](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L154)

___

### getEpochRewards

**getEpochRewards**(): `Promise`\<[`EpochRewardsWrapper`](wrappers_EpochRewards.EpochRewardsWrapper.md)\>
Expand Down Expand Up @@ -277,7 +278,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/contract-cache.ts:154](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L154)
[packages/sdk/contractkit/src/contract-cache.ts:157](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L157)

___

Expand All @@ -291,7 +292,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/contract-cache.ts:157](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L157)
[packages/sdk/contractkit/src/contract-cache.ts:160](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L160)

___

Expand All @@ -305,7 +306,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/contract-cache.ts:164](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L164)
[packages/sdk/contractkit/src/contract-cache.ts:167](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L167)

___

Expand All @@ -319,7 +320,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/contract-cache.ts:167](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L167)
[packages/sdk/contractkit/src/contract-cache.ts:170](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L170)

___

Expand All @@ -333,7 +334,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/contract-cache.ts:170](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L170)
[packages/sdk/contractkit/src/contract-cache.ts:173](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L173)

___

Expand All @@ -347,7 +348,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/contract-cache.ts:161](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L161)
[packages/sdk/contractkit/src/contract-cache.ts:164](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L164)

___

Expand All @@ -361,7 +362,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/contract-cache.ts:173](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L173)
[packages/sdk/contractkit/src/contract-cache.ts:176](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L176)

___

Expand All @@ -379,7 +380,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/contract-cache.ts:176](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L176)
[packages/sdk/contractkit/src/contract-cache.ts:179](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L179)

___

Expand All @@ -393,7 +394,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/contract-cache.ts:179](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L179)
[packages/sdk/contractkit/src/contract-cache.ts:182](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L182)

___

Expand All @@ -407,7 +408,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/contract-cache.ts:182](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L182)
[packages/sdk/contractkit/src/contract-cache.ts:185](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L185)

___

Expand All @@ -427,7 +428,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/contract-cache.ts:185](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L185)
[packages/sdk/contractkit/src/contract-cache.ts:188](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L188)

___

Expand All @@ -441,7 +442,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/contract-cache.ts:188](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L188)
[packages/sdk/contractkit/src/contract-cache.ts:191](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L191)

___

Expand All @@ -455,7 +456,21 @@ ___

#### Defined in

[packages/sdk/contractkit/src/contract-cache.ts:191](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L191)
[packages/sdk/contractkit/src/contract-cache.ts:194](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L194)

___

### getScoreManager

**getScoreManager**(): `Promise`\<[`ScoreManagerWrapper`](wrappers_ScoreManager.ScoreManagerWrapper.md)\>

#### Returns

`Promise`\<[`ScoreManagerWrapper`](wrappers_ScoreManager.ScoreManagerWrapper.md)\>

#### Defined in

[packages/sdk/contractkit/src/contract-cache.ts:197](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L197)

___

Expand All @@ -469,7 +484,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/contract-cache.ts:194](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L194)
[packages/sdk/contractkit/src/contract-cache.ts:200](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L200)

___

Expand All @@ -493,7 +508,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/contract-cache.ts:197](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L197)
[packages/sdk/contractkit/src/contract-cache.ts:203](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L203)

___

Expand All @@ -507,7 +522,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/contract-cache.ts:200](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L200)
[packages/sdk/contractkit/src/contract-cache.ts:206](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L206)

___

Expand All @@ -533,4 +548,4 @@ ___

#### Defined in

[packages/sdk/contractkit/src/contract-cache.ts:231](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L231)
[packages/sdk/contractkit/src/contract-cache.ts:237](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/contract-cache.ts#L237)
Loading

0 comments on commit 7400467

Please sign in to comment.