Skip to content

Commit 453b7c7

Browse files
committed
fix: README
1 parent 056d5b4 commit 453b7c7

1 file changed

Lines changed: 88 additions & 109 deletions

File tree

README.md

Lines changed: 88 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -5,153 +5,132 @@ L2 contracts for Yield Dex project.
55
### Compilation
66

77
We are using Scarb to compile our contracts, you need to install it to be able to use it.
8-
For that you can follow the step [here](https://docs.swmansion.com/scarb/download.html).
9-
10-
Once scarb is install, you are able to compile the contracts.
11-
Run `Scarb build`, it will built Sierra code of this package will be written to `target/dev` directory.
8+
For that, you can follow the steps [here](https://book.cairo-lang.org/ch01-01-installation.html).
9+
Once Scarb is installed, you are able to compile the contracts.
10+
Run `scarb build`, it will build Sierra code of this package which will be written to the `target/dev` directory.
1211

1312
### Test
1413

15-
You can find our tests under `src/tests`, those tests are written using `snfoundry` you can find more information [here](https://foundry-rs.github.io/starknet-foundry/index.html).
16-
Follow the [installatio](https://foundry-rs.github.io/starknet-foundry/getting-started/installation.html) documentation to be able to run our tests.
17-
14+
You can find our tests under `src/tests`, these tests are written using snfoundry you can find more information [here](https://foundry-rs.github.io/starknet-foundry/getting-started/installation.html).
15+
Follow the installation documentation to be able to run our tests.
1816
To run the tests, just do `snforge test`.
1917

2018
### Declare With Starkli
2119

22-
For this, we used [starkli](https://book.starkli.rs/installation), you need to install it to be able to declare and deploy the contracts.
23-
Once `starkli` is installed, you will need set some environement variable.
24-
If you want to declare on `goerli` then do `export STARKNET_NETWORK="goerli"` (you replace it be `mainnet` or `sepolia` depending on the network you want to deploy to).
25-
26-
You will have to create a [signers](https://book.starkli.rs/signers) and [account](https://book.starkli.rs/accounts), just follow those documentation.
27-
28-
Now that everything is setup, you are able to declare the contracts.
29-
For that we will use `starkli declare` command, for more info check the documentation [here](https://book.starkli.rs/declaring-classes).
30-
20+
For this, we used starkli, you need to install it to be able to declare and deploy the contracts.
21+
Once starkli is installed, you will need to set some environment variables.
22+
If you want to declare on goerli then do `export STARKNET_NETWORK="goerli"` (you replace it be mainnet or sepolia depending on the network you want to deploy to).
23+
You will have to create a signers and account, just follow those [documentation](https://book.starkli.rs/signers).
24+
Now that everything is set up, you are able to declare the contracts.
25+
For that, we will use starkli declare command, for more info check the documentation [here](https://book.starkli.rs/declaring-classes).
3126
Run `starkli declare ./target/dev/CONTRACT_NAME.contract_class.json --account PATH/account-store --network NETWORK`.
32-
33-
- `CONTRACT_NAME` the name of the `json` file that can be found inside `./target/dev/` folder.
34-
- `PATH/account-store` is the path to you `account-store` that as been previously created.
35-
- `NETWORK` the name of the network you want to declare to (`goerli`, `sepolia` or `mainnet`).
36-
37-
After running that, it will return to you the declared contract `class hash`.
38-
27+
`CONTRACT_NAME `the name of the json file that can be found inside `./target/dev/ `folder.
28+
`PATH/account-store` is the path to your account-store that has been previously created.
29+
`NETWORK `the name of the network you want to declare to (goerli, sepolia or mainnet).
30+
After running that, it will return to you the declared contract class hash.
3931

4032
### Declare With Script
4133

4234
Create a `.env` and add `ACCOUNT_ADDRESS` and `ACCOUNT_PK`.
43-
Run `npm i` to install package.
44-
The script is deploying contract on `goerli` if you want to deploy on another network then go inside `scripts/declareContracts` and change `const provider = new RpcProvider({ nodeUrl: constants.NetworkName.SN_MAIN });` with the correct network (ex: `SN_GOERLI`).
45-
46-
To run the script just do `npx ts-node scripts/declareContracts.ts --contract CONTRACT_NAME`.
47-
`CONTRACT_NAME` must be replace by :
48-
- `PoolingManager`
49-
- `Factory`
50-
- `Token`
51-
- `TokenManager`
52-
35+
Run `npm i` to install the package.
36+
The script is deploying the contract on goerli if you want to deploy on another network then go inside `scripts/declareContracts` and change `const provider = new RpcProvider({ nodeUrl: constants.NetworkName.SN_MAIN });` with the correct network (ex: SN_GOERLI).
37+
To run the script just do `npx ts-node scripts/declareContracts.ts --contract CONTRACT_NAME.`
38+
`CONTRACT_NAME` must be replaced by :
39+
- PoolingManager
40+
- Factory
41+
- Token
42+
- TokenManager
5343

5444
### Deploy With Starkli
5545

56-
Now that our contracts are declaring, the next step is to deploy them. For that you can follow the documentation [here](https://book.starkli.rs/deploying-contracts).
57-
58-
Some of the contracts take parameters in their `constructore`, you will need to add them in your command.
46+
Now that our contracts are declared, the next step is to deploy them. For that, you can follow the documentation [here](https://book.starkli.rs/deploying-contracts).
47+
Some of the contracts take parameters in their constructor, you will need to add them in your command.
5948

60-
- PoolingManager: `starkli deploy POOLING_MANAGER_CLASS_HASH OWNER_ACCOUNT_ADDRESS --account PATH/account-store --network NETWORK`
61-
62-
- FACTORY: `starkli deploy FACTORY_CLASS_HASH POOLING_MANAGER_CONTRACT_ADDRESS TOKEN_CLASS_HASH TOKEN_MANAGER_CLASS_HASH --account PATH/account-store --network NETWORK`
49+
PoolingManager: `starkli deploy POOLING_MANAGER_CLASS_HASH OWNER_ACCOUNT_ADDRESS --account PATH/account-store --network NETWORK`
50+
Factory: `starkli deploy FACTORY_CLASS_HASH POOLING_MANAGER_CONTRACT_ADDRESS TOKEN_CLASS_HASH TOKEN_MANAGER_CLASS_HASH --account PATH/account-store --network NETWORK`
6351

6452
### Deploy With Script
6553

6654
Create a `.env` and add `ACCOUNT_ADDRESS` and `ACCOUNT_PK`.
67-
Run `npm i` to install package.
68-
The script is deploying contract on `goerli` if you want to deploy on another network then go inside `scripts/deployContracts` and change `const provider = new RpcProvider({ nodeUrl: constants.NetworkName.SN_MAIN });` with the correct network (ex: `SN_GOERLI`).
69-
55+
Run `npm i` to install the package.
56+
The script is deploying the contract on goerli if you want to deploy on another network then go inside `scripts/deployContracts` and change `const provider = new RpcProvider({ nodeUrl: constants.NetworkName.SN_MAIN });` with the correct network (ex: `SN_GOERLI`).
7057
To run the script just do `npx ts-node scripts/deployContracts.ts --contract CONTRACT_NAME`.
71-
`CONTRACT_NAME` must be replace by :
72-
- `PoolingManager`
73-
- `Factory`
58+
`CONTRACT_NAME` must be replaced by :
59+
- PoolingManager
60+
- Factory
7461

7562
### Setup
76-
77-
Only the owner of the contract will be able to setup the contract.
78-
79-
You can do the setup through [voyager](https://voyager.online/) or [starkscan](https://starkscan.co/).
80-
81-
- PoolingManager:
82-
Only Owner:
83-
- `set_fees_recipient`: Address of the fees recipient.
84-
- `set_l1_pooling_manager`: Address of the pooling manager on l1.
85-
- `set_factory`: Address of the Factory contract previously deployed.
86-
87-
Only Role, the owner has the correct role, but you can also give permition to other account:
88-
- `register_underlying`: Registers an underlying asset, its corresponding bridge contract and the corresponding address of the l1bridge
89-
90-
- Factory:
91-
Only Owner:
92-
- `deploy_strategy`: Deploys a new strategy with specified parameters.
93-
Parameters are:
94-
- `l1_strategy`: The Ethereum address of the L1 strategy
95-
- `underlying`: The contract address of the underlying asset
96-
- `token_name`: The name for the new token
97-
- `token_symbol`: The symbol for the new token
98-
- `performance_fees`: The performance fees for the strategy
99-
- `min_deposit`: The minimum deposit limit
100-
- `max_deposit`: The maximum deposit limit
101-
- `min_withdrawal`: The minimum withdrawal limit
102-
- `max_withdrawal`: The maximum withdrawal limit
103-
- `withdrawal_epoch_delay`: The delay in epochs for withdrawals
104-
- `dust_limit`: The dust limit for the strategy
105-
106-
`Deploy_strategy` will deploy a new contract call `token_manager` and returned you the address. We are going to use this contract to `deposit` some token.
107-
108-
Go to the `Token Manager` contract address and call `deposit` function, This function can be call by any user :
109-
- TokenManager:
110-
- `deposit`: Allows a user to deposit assets into the contract.
111-
Parameters are:
112-
- `assets`: The amount of assets to deposit.
113-
- `receiver`: The address to receive the minted shares.
114-
- `referal`: The referral address for the deposit.
115-
116-
Once users have deposit some assets, he can now request a withdrawal from the contract.
117-
118-
- `request_withdrawal`: Allows a user to request a withdrawal from the contract
119-
Parameter is:
120-
- `shares`: The amount of shares to withdraw.
121-
63+
Only the owner of the contract will be able to set up the contract.
64+
You can do the setup through voyager or starkscan.
65+
66+
PoolingManager:
67+
Only Owner:
68+
- set_fees_recipient: Address of the fees recipient.
69+
- set_l1_pooling_manager: Address of the pooling manager on l1.
70+
- set_factory: Address of the Factory contract previously deployed.
71+
72+
Only Role, the owner has the correct role, but you can also give permission to other accounts:
73+
- register_underlying: Registers an underlying asset, its corresponding bridge contract and the corresponding address of the l1bridge
74+
75+
Factory:
76+
Only Owner:
77+
- `deploy_strategy`: Deploys a new strategy with specified parameters.
78+
Parameters are:
79+
- l1_strategy: The Ethereum address of the L1 strategy
80+
- underlying: The contract address of the underlying asset
81+
- token_name: The name for the new token
82+
- token_symbol: The symbol for the new token
83+
- performance_fees: The performance fees for the strategy
84+
- min_deposit: The minimum deposit limit
85+
- max_deposit: The maximum deposit limit
86+
- min_withdrawal: The minimum withdrawal limit
87+
- max_withdrawal: The maximum withdrawal limit
88+
- withdrawal_epoch_delay: The delay in epochs for withdrawals
89+
- dust_limit: The dust limit for the strategy
90+
Deploy_strategy will deploy a new contract called token_manager and return you the address. We are going to use this contract to deposit some tokens.
91+
92+
Go to the Token Manager contract address and call the deposit function, This function can be called by any user :
93+
94+
TokenManager:
95+
- `deposit`: Allows a user to deposit assets into the contract.
96+
Parameters are:
97+
- assets: The amount of assets to deposit.
98+
- receiver: The address to receive the minted shares.
99+
- referral: The referral address for the deposit.
100+
Once users have deposited some assets, they can now request a withdrawal from the contract.
101+
- `request_withdrawal`: Allows a user to request a withdrawal from the contract
102+
Parameter is:
103+
- shares: The amount of shares to withdraw.
122104

123105
### Goerli Class Hash
124-
125-
You can declare a contract only once on each network. So if you don't do any modification into our current contract implementation you may face an error while declaring. There for here you can find the current `class hash` of each contract on Goerli.
106+
You can declare a contract only once on each network. So if you don't do any modification into our current contract implementation you may face an error while declaring. Therefore here you can find the current class hash of each contract on Goerli.
126107

127108
```
109+
POOLINGMANAGER_CLASS_HASH="0x05adb7661d0dcb3cc5fbe69380846fb7662c92f1943fcf609c51b756cae7d411"
128110
129-
POOLINGMANAGER_CLASS_HASH="0x05adb7661d0dcb3cc5fbe69380846fb7662c92f1943fcf609c51b756cae7d411"
130-
131-
TOKENMANAGER_CLASS_HASH="0x03be98338455134abae1d830802a162cd81b24ddb38a868ec9c6a4341ecd7210"
111+
TOKENMANAGER_CLASS_HASH="0x03be98338455134abae1d830802a162cd81b24ddb38a868ec9c6a4341ecd7210"
132112
133-
TOKENMOCK_CLASS_HASH="0x00da57dbb24ceb46a3901f148442e0d591528baba485ee84ed6d4948dedf12e5"
113+
TOKENMOCK_CLASS_HASH="0x00da57dbb24ceb46a3901f148442e0d591528baba485ee84ed6d4948dedf12e5"
134114
135-
TOKEN_CLASS_HASH="0x0720f601c0432ab03e12df99c2b215e7ab9a9c12e1b4d8b0473e18bbb3213bea"
115+
TOKEN_CLASS_HASH="0x0720f601c0432ab03e12df99c2b215e7ab9a9c12e1b4d8b0473e18bbb3213bea"
136116
137-
TOKENBRIDGE_CLASS_HASH="0x00de6d9bd84775dd221273e833dc44946da586483cf822e0021385de95964700"
138-
139-
FACTORY_CLASS_HASH="0x0581277daf0e409c2537979108b7eb4a5cec3624db552c35f8f6acc9a3ac937b"
117+
TOKENBRIDGE_CLASS_HASH="0x00de6d9bd84775dd221273e833dc44946da586483cf822e0021385de95964700"
140118
119+
FACTORY_CLASS_HASH="0x0581277daf0e409c2537979108b7eb4a5cec3624db552c35f8f6acc9a3ac937b"
141120
```
142121

122+
143123
### Mainnet Class Hash
144-
145-
You can declare a contract only once on each network. So if you don't do any modification into our current contract implementation you may face an error while declaring. There for here you can find the current `class hash` of each contract on Mainnet.
124+
You can declare a contract only once on each network. So if you don't do any modification into our current contract implementation you may face an error while declaring. Therefore here you can find the current class hash of each contract on Mainnet.
146125

147126
```
127+
POOLINGMANAGER_CLASS_HASH=0x05adb7661d0dcb3cc5fbe69380846fb7662c92f1943fcf609c51b756cae7d411
148128
149-
POOLINGMANAGER_CLASS_HASH=0x05adb7661d0dcb3cc5fbe69380846fb7662c92f1943fcf609c51b756cae7d411
150-
151-
FACTORY_CLASS_HASH=0x581277daf0e409c2537979108b7eb4a5cec3624db552c35f8f6acc9a3ac937b
129+
FACTORY_CLASS_HASH=0x581277daf0e409c2537979108b7eb4a5cec3624db552c35f8f6acc9a3ac937b
152130
153-
TOKENMANAGER_CLASS_HASH=0x3be98338455134abae1d830802a162cd81b24ddb38a868ec9c6a4341ecd7210
154-
155-
TOKEN_CLASS_HASH=0x720f601c0432ab03e12df99c2b215e7ab9a9c12e1b4d8b0473e18bbb3213bea
131+
TOKENMANAGER_CLASS_HASH=0x3be98338455134abae1d830802a162cd81b24ddb38a868ec9c6a4341ecd7210
156132
133+
TOKEN_CLASS_HASH=0x720f601c0432ab03e12df99c2b215e7ab9a9c12e1b4d8b0473e18bbb3213bea
157134
```
135+
136+

0 commit comments

Comments
 (0)