Skip to content

Commit d410e55

Browse files
committed
add linear code address generator
1 parent d7f11be commit d410e55

File tree

1 file changed

+60
-52
lines changed

1 file changed

+60
-52
lines changed

README.md

Lines changed: 60 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,27 @@ Flow is a new blockchain for open worlds. Read more about it [here](https://www.
1313

1414
# What is Cadence?
1515

16-
Cadence is a new Resource-oriented programming language
16+
Cadence is a new Resource-oriented programming language
1717
for developing smart contracts for the Flow Blockchain.
1818
Read more about it [here](https://www.docs.onflow.org)
1919

2020
We recommend that anyone who is reading this should have already
21-
completed the [Cadence Tutorials](https://docs.onflow.org/docs/getting-started-1)
21+
completed the [Cadence Tutorials](https://docs.onflow.org/docs/getting-started-1)
2222
so they can build a basic understanding of the programming language.
2323

2424
## FlowToken
2525

2626
`contracts/FlowToken.cdc`
2727

28-
| Network | Contract Address |
29-
| ---------------------------- | -------------------- |
30-
| Emulator | `0x0ae53cb6e3f42a79` |
31-
| Testnet | `0x7e60df042a9c0868` |
32-
| Mainnet | `0x1654653399040a61` |
28+
| Network | Contract Address |
29+
| ---------| -------------------- |
30+
| Emulator | `0x0ae53cb6e3f42a79` |
31+
| Testnet | `0x7e60df042a9c0868` |
32+
| Mainnet | `0x1654653399040a61` |
3333

34-
This is the contract that defines the network token for Flow.
35-
This token is used for account creation fees, transaction fees, staking, and more. It is
36-
implemented as a regular smart contract so that it can be easily used
34+
This is the contract that defines the network token for Flow.
35+
This token is used for account creation fees, transaction fees, staking, and more. It is
36+
implemented as a regular smart contract so that it can be easily used
3737
just like any other token in the network. See the [flow fungible token repository](https://github.com/onflow/flow-ft)
3838
for more information.
3939

@@ -43,23 +43,23 @@ You can find transactions for using the Flow Token in the `transactions/flowToke
4343

4444
`contracts/FlowFees.cdc`
4545

46-
| Network | Contract Address |
47-
| ---------------------------- | -------------------- |
48-
| Emulator | `0xe5a8b7f23e8b548f` |
49-
| Testnet | `0x912d5440f7e3769e` |
50-
| Mainnet | `0xf919ee77447b7497` |
46+
| Network | Contract Address |
47+
| ---------| -------------------- |
48+
| Emulator | `0xe5a8b7f23e8b548f` |
49+
| Testnet | `0x912d5440f7e3769e` |
50+
| Mainnet | `0xf919ee77447b7497` |
5151

5252
This contract defines fees that are spent for executing transactions and creating accounts.
5353

5454
## Storage Fee Contract
5555

5656
`contracts/FlowStorageFees.cdc`
5757

58-
| Network | Contract Address |
59-
| ---------------------------- | -------------------- |
60-
| Emulator | `0xf8d6e0586b0a20c7` |
61-
| Testnet | `0x8c5303eaa26202d6` |
62-
| Mainnet | `0xe467b9dd11fa00df` |
58+
| Network | Contract Address |
59+
| ---------| -------------------- |
60+
| Emulator | `0xf8d6e0586b0a20c7` |
61+
| Testnet | `0x8c5303eaa26202d6` |
62+
| Mainnet | `0xe467b9dd11fa00df` |
6363

6464
This contract defines fees that are spent to pay for the storage that an account uses.
6565
There is a minimum balance that an account needs to maintain in its main `FlowToken` Vault
@@ -70,11 +70,11 @@ You can see [more docs about storage capacity and fees here.](https://docs.onflo
7070

7171
`contracts/FlowServiceAccount.cdc`
7272

73-
| Network | Contract Address |
74-
| ---------------------------- | -------------------- |
75-
| Emulator | `0xf8d6e0586b0a20c7` |
76-
| Testnet | `0x8c5303eaa26202d6` |
77-
| Mainnet | `0xe467b9dd11fa00df` |
73+
| Network | Contract Address |
74+
| ---------| -------------------- |
75+
| Emulator | `0xf8d6e0586b0a20c7` |
76+
| Testnet | `0x8c5303eaa26202d6` |
77+
| Mainnet | `0xe467b9dd11fa00df` |
7878

7979
This contract manages account creation and flow token initialization. It enforces temporary
8080
requirements for which accounts are allowed to create other accounts, and provides common
@@ -86,11 +86,11 @@ You can find transactions for interacting with the service account contract in t
8686

8787
`contracts/RandomBeaconHistory.cdc`
8888

89-
| Network | Contract Address |
90-
| ---------------------------- | -------------------- |
91-
| Emulator | `0xf8d6e0586b0a20c7` |
92-
| Testnet | `0x8c5303eaa26202d6` |
93-
| Mainnet | `0xe467b9dd11fa00df` |
89+
| Network | Contract Address |
90+
| ---------| -------------------- |
91+
| Emulator | `0xf8d6e0586b0a20c7` |
92+
| Testnet | `0x8c5303eaa26202d6` |
93+
| Mainnet | `0xe467b9dd11fa00df` |
9494

9595
This contract stores the history of random sources generated by
9696
the Flow network. The defined Heartbeat resource is
@@ -104,11 +104,11 @@ You can find transactions for interacting with the random beacon
104104

105105
`contracts/NodeVersionBeacon.cdc`
106106

107-
| Network | Contract Address |
108-
| ----------------- | -------------------- |
109-
| Emulator | `0xf8d6e0586b0a20c7` |
110-
| Testnet | `0x8c5303eaa26202d6` |
111-
| Mainnet | `0xe467b9dd11fa00df` |
107+
| Network | Contract Address |
108+
| ---------| -------------------- |
109+
| Emulator | `0xf8d6e0586b0a20c7` |
110+
| Testnet | `0x8c5303eaa26202d6` |
111+
| Mainnet | `0xe467b9dd11fa00df` |
112112

113113
The `NodeVersionBeacon` contract holds the past
114114
and future protocol versions that should be used
@@ -122,11 +122,11 @@ history contract in the `transactions/nodeVersionBeacon` directory.
122122
`contracts/FlowIDTableStaking.cdc`
123123
`contracts/epochs/FlowEpoch.cdc`
124124

125-
| Network | Contract Address |
126-
| ------------------- | -------------------- |
127-
| Emulator | `0xf8d6e0586b0a20c7` |
128-
| Testnet | `0x9eca2b38b18b5dfe` |
129-
| Mainnet | `0x8624b52f9ddcd04a` |
125+
| Network | Contract Address |
126+
| ---------| -------------------- |
127+
| Emulator | `0xf8d6e0586b0a20c7` |
128+
| Testnet | `0x9eca2b38b18b5dfe` |
129+
| Mainnet | `0x8624b52f9ddcd04a` |
130130

131131
These contract manages the list of identities that correspond to node operators in the Flow network
132132
as well as the process for adding and removing nodes from the network via Epochs.
@@ -152,11 +152,11 @@ These scripts are documented in the [staking scripts section of the docs](https:
152152

153153
`contracts/LockedTokens.cdc`
154154

155-
| Network | Contract Address |
156-
| --------------- | -------------------- |
157-
| Emulator | `0xf8d6e0586b0a20c7` |
158-
| Testnet | `0x95e019a17d0e23d7` |
159-
| Mainnet | `0x8d0e87b65159ae63` |
155+
| Network | Contract Address |
156+
| ---------| -------------------- |
157+
| Emulator | `0xf8d6e0586b0a20c7` |
158+
| Testnet | `0x95e019a17d0e23d7` |
159+
| Mainnet | `0x8d0e87b65159ae63` |
160160

161161
This contract manages the two year lockup of Flow tokens that backers purchased in the initial
162162
token sale in October of 2020. See more documentation about `LockedTokens` [here.](https://docs.onflow.org/flow-token/locked-account-setup/)
@@ -195,16 +195,24 @@ then all the changes are handled for them and there is nothing for you to worry
195195

196196
### Staking Collection Technical features
197197

198-
* The staking collection contract stores [a dictionary of staking objects](https://github.com/onflow/flow-core-contracts/blob/master/contracts/FlowStakingCollection.cdc#L68) from the staking contract that are used to manage the stakers tokens. Since they are dictionaries, there can be as many node or delegator objects per account as the user wants.
198+
* The staking collection contract stores [a dictionary of staking objects](https://github.com/onflow/flow-core-contracts/blob/master/contracts/FlowStakingCollection.cdc#L68) from the staking contract that are used to manage the stakers tokens. Since they are dictionaries, there can be as many node or delegator objects per account as the user wants.
199199
* The resource only has one set of staking methods, which route the call to the correct staking object based on the arguments that the caller specifies. (nodeID, delegatorID)
200200
* The contract also stores an [optional capability to the locked token vault](https://github.com/onflow/flow-core-contracts/blob/master/contracts/FlowStakingCollection.cdc#L63) and [locked tokens `TokenHolder` resource](https://github.com/onflow/flow-core-contracts/blob/master/ontracts/FlowStakingCollection.cdc#L73). This is only used if the user already has a locked account. The staking collection does not change the locked account setup at all, it only has access to it and to the locked vault.
201201
* The collection makes the staking objects and vault capability fields private, because since it has access to the locked tokens, it needs to mediate access to the staking objects so users cannot withdraw tokens that are still locked from the sale. The resource has fields `unlockedTokensUsed` and `lockedTokensUsed`, to keep track of how many locked and unlocked tokens are being used for staking in order to allow the user to withdraw the correct amount when they choose to.
202202
* The staking collection contract is a brand new contract that will be deployed to the same account as the existing locked tokens contract. A few of the fields on the `LockedTokens` contract have been updated to have `access(account)` visibility instead of `access(self)` because the staking collection contract needs to be able to access to them in order to work properly.
203-
* We also included a public interface and getters in the contract so you can easily query it with an address to get node or delegator information from a collection.
203+
* We also included a public interface and getters in the contract so you can easily query it with an address to get node or delegator information from a collection.
204204

205205
Looking for feedback on design decisions, implementation details, any events that would be useful to include in the contract, and whatever you feel is important!
206206

207-
We intend for this to be the method that all Flow Port users (ledger, blocto, etc) use for the forseeable future. When we enable it in Flow Port, we will ask every user to run a transaction to set up their account to use the staking collection from then on.
207+
We intend for this to be the method that all Flow Port users (ledger, blocto, etc) use for the forseeable future. When we enable it in Flow Port, we will ask every user to run a transaction to set up their account to use the staking collection from then on.
208+
209+
## Linear Code Address Generator
210+
211+
`contracts/LinearCodeAddressGenerator.cdc`
212+
213+
The linear code address generator contract allows translating an address index to an address,
214+
and and address back to an address index.
215+
It implements the same address generation logic as used on all Flow networks.
208216

209217
# Testing
210218

@@ -218,22 +226,22 @@ Flow Core Contracts were audited by Quantstamp in July 2021: [final report](http
218226

219227
# Getting Transaction Templates
220228

221-
If you need to use the contracts and transaction templates we have provided in an app, you don't necessarily
229+
If you need to use the contracts and transaction templates we have provided in an app, you don't necessarily
222230
need to copy and paste them into your code. We plan on providing packages for different
223231
languages to import in order to use the transactions instead of copying and pasting.
224232

225233
We currently include the `lib/go/templates` package for getting templates in the Go programming language.
226234
To use this package, run `go get github.com/onflow/flow-core-contracts/lib/go/templates@{latest version}`
227-
in your Go project direcory. To use it in your Go code, you can simply call one of the many
228-
template getters in one of the `*_templates.go` files.
235+
in your Go project direcory. To use it in your Go code, you can simply call one of the many
236+
template getters in one of the `*_templates.go` files.
229237

230238
### Packages in other languages
231239

232240
We would like to add new packages for other popular languages to get transaction templates.
233241
If you would like to contribute to add one of these new packages, please reach out
234242
to the team and we would be happy to help!
235243

236-
## License
244+
## License
237245

238246
The works in these folders are under the [Unlicense](https://github.com/onflow/flow-core-contracts/blob/master/LICENSE):
239247

0 commit comments

Comments
 (0)