|
1 | | -# Emulated Light Client |
2 | | - |
3 | | -This is our attempt to build a bridge between Solana and Cosmos using IBC |
4 | | - |
5 | | -## Instructions to test solana program |
6 | | - |
7 | | -1. Run anchor test with `mocks` feature. Since we cannot pass features to anchor test command, we need to build it. |
8 | | -``` |
9 | | -anchor build -- --features mocks |
10 | | -``` |
11 | | - |
12 | | -2. Now while running the tests, we need to provide a flag to skip build since they are already set. Not providing the flag to skip build would make the program to be built again but without any features ( which we dont want for testing ). |
13 | | -``` |
14 | | -anchor test --skip-build |
15 | | -``` |
16 | | - |
17 | | -### Note: |
18 | | -- If you want to deploy the program with `mocks` feature, you need to build the program with the mocks feature and then deploy. |
19 | | -``` |
20 | | -anchor build -- --features mocks |
21 | | -anchor deploy |
22 | | -``` |
23 | | -- If you want to retain the local state once the tests are run, you would have to run a local validator. A local validator should run in the background and while running the test `skip-local-validator` flag has to be passed so that the program doesnt spin up its only validator. |
24 | | -Below is the command to run local validator ( run it in a seperate terminal). |
25 | | -``` |
26 | | -solana-test-validator -r |
27 | | -``` |
28 | | -And pass the flag to skip local validator while running the tests. |
29 | | -``` |
30 | | -anchor test --skip-local-validator --skip-build |
31 | | -``` |
32 | | -The `skip-build` has to be passed if you are running tests with `mocks` feature. So remember to build it with the command above before you run the tests. |
33 | | - |
34 | | - |
35 | | -IdlError: Type not found |
36 | | -https://github.com/coral-xyz/anchor/issues/651 |
37 | | -https://0xksure.medium.com/solana-anchor-idlerror-type-not-found-ac8897803856 |
38 | | -https://solana.stackexchange.com/questions/1382/idlerror-type-not-found |
| 1 | +# Overview |
| 2 | + |
| 3 | +# Vesting contract (without staking) |
| 4 | +- source code: https://github.com/ComposableFi/distributor |
| 5 | +- Num of deployed contracts on mainnet: 12 |
| 6 | + - angels, advisors, cliff, solvers, seed, single_advisor, polychain, liquidity_round, 6_month_lock_24_month_vest, angular_single |
| 7 | + - location of this files that was deployed: |
| 8 | + - root of mantis indexer https://github.com/ComposableFi/mantis-indexer/tree/main/mantis-indexer |
| 9 | + - https://github.com/ComposableFi/mantis-staking-program/tree/main/solana/merkle-tree/test_fixtures (dublicate) |
| 10 | + - cli to interact https://github.com/ComposableFi/distributor/tree/master/cli |
| 11 | + - example of cli commands that was executed to initalize this 12 vesting contract and https://github.com/ComposableFi/distributor/blob/master/cli/readme.md |
| 12 | + - workflow: admin deploy, initialize via new_distributor instruction. |
| 13 | + |
| 14 | +# Vesting contract (with staking) |
| 15 | +- source code: https://github.com/ComposableFi/mantis-staking-program/tree/main/solana/merkle-distributor |
| 16 | +- cli: https://github.com/ComposableFi/mantis-staking-program/blob/main/cli/src/lib.rs |
| 17 | +- file with eth/cosmos/polkadot wallets: https://github.com/ComposableFi/mantis-indexer/blob/main/mantis-indexer/ethcosmosclaimprod.csv |
| 18 | +- user sibmit signature to claim via this api endpoint: https://github.com/ComposableFi/mantis-staking-program/blob/main/vesting-backend/src/main.rs#L53C14-L53C21 |
| 19 | +- then vesting contact admin call instruction to give allocation from file ^^^ above: https://github.com/ComposableFi/mantis-staking-program/blob/main/solana/merkle-distributor/src/lib.rs#L105 |
| 20 | +- User able to claim initial amount via claim_new instruction and then need to stake via staking contract for 3 months to unlock the rest. |
| 21 | + |
| 22 | + |
| 23 | +# Staking contract. |
| 24 | +- source code: https://github.com/ComposableFi/mantis-staking-program/tree/main/solana/staking |
| 25 | +- docs: https://github.com/ComposableFi/mantis-staking-program/blob/main/solana/staking/README.md |
| 26 | + |
| 27 | +# Vesting(get_proof) api: |
| 28 | +- source code: https://github.com/ComposableFi/mantis-indexer/blob/main/mantis-indexer/src/main.rs#L272-L317 |
| 29 | +- user/FE/UI submit address and allocation name to get proof/unlocked ammount/locked ammount to sent this data into the new_claim instruction in the corresponding vesting contract. here -> https://github.com/ComposableFi/distributor/blob/master/programs/merkle-distributor/src/lib.rs#L81-L88 |
| 30 | +- after calling ^ method once. user/FE/UI is able to call claim_locked https://github.com/ComposableFi/distributor/blob/master/programs/merkle-distributor/src/lib.rs#L120-L123 to get vested tokens if there are some anlocked tokens. |
| 31 | + |
| 32 | +# Eth/Polkadot/Cosmos claming API |
| 33 | +- source code: https://github.com/ComposableFi/mantis-staking-program/blob/main/vesting-backend/src/main.rs#L53 |
| 34 | +- User/UI/FE submit signature with a message(solana address string) to link to specific cosmos/eth/polkadot wallet and recieve allocation on the contract (vesting WITH staking) where admin account via API will call admin_new_claim to set allocation for this solana wallet with a corresponding ammount from csv file. |
| 35 | +- csv file: https://github.com/ComposableFi/mantis-indexer/blob/main/mantis-indexer/ethcosmosclaimprod.csv |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | +# Question? |
| 40 | +1. Do you need to deploy new vesting schedule? |
| 41 | +- go to https://github.com/ComposableFi/distributor |
| 42 | +- anchor keys sync (make sure that new program id updated in anchor.toml and program_id!(".")) |
| 43 | +- anchor build |
| 44 | +- set an rpc |
| 45 | +- solana config set --url https://mainnet.helius-rpc.com/?api-key=123 |
| 46 | +- solana program deploy merkle_distributor.so --with-compute-unit-price 10000 --max-sign-attempts 100 --use-rpc |
| 47 | +- if any erorr then call (solana program close —buffers) to collect the used SOL fee that was taken by prev command. |
| 48 | +- cd cli |
| 49 | +- set up .env file |
| 50 | +- call new-distributor command for corresponding program id. |
| 51 | +- example here -> https://github.com/ComposableFi/distributor/blob/master/cli/readme.md |
| 52 | + |
| 53 | +2. Need to give allocation to some solana address by Admin? |
| 54 | +- go to https://github.com/ComposableFi/distributor or https://github.com/ComposableFi/mantis-staking-program/tree/main/solana/merkle-distributor depends do you need to give to vesting with/without staking. reminder distributor is a just vesting without staking. |
| 55 | +- go to cli |
| 56 | +- set up an .env file |
| 57 | +- call admin-new-clain command to give for specific address |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
0 commit comments