You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -5,153 +5,132 @@ L2 contracts for Yield Dex project.
5
5
### Compilation
6
6
7
7
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.
12
11
13
12
### Test
14
13
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.
18
16
To run the tests, just do `snforge test`.
19
17
20
18
### Declare With Starkli
21
19
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).
31
26
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.
39
31
40
32
### Declare With Script
41
33
42
34
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
53
43
54
44
### Deploy With Starkli
55
45
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.
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`).
70
57
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
74
61
75
62
### 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.
122
104
123
105
### 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.
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.
0 commit comments