Skip to content

Commit b142ecf

Browse files
committed
Update example sol-anchor-contract #107
1 parent 5c867aa commit b142ecf

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# sol-anchor-contract
2+
3+
This is a program developed as a Rust Smart Contract(Solana Blockchain).
4+
It acts as an example for developers who are new to Solana ecosystem to learn on how the program interacts with the Pyth Oracles.
5+
6+
Instructions of the program:
7+
8+
1. init
9+
2. loanToValue
10+
11+
Please find below instructions on running the Smart Contract on local cluster:
12+
13+
1.
14+
15+
- Open a new terminal
16+
- Run below command which clones two account addresses and their associated data into local cluster from devnet cluster.
17+
18+
solana-test-validator --reset --clone EdVCmQ9FSPcVe5YySXDPCRmc8aDQLKJ9xvYBMZPie1Vw 38xoQ4oeJCBrcVvca2cGk7iV1dAfrmTR1kmhSCJQ8Jto --url devnet
19+
20+
2.
21+
22+
- Open a new terminal.
23+
- Run below command which listens to transaction logs.
24+
25+
solana logs
26+
27+
3.
28+
29+
- Open a new terminal.
30+
- Navigate to the root directory of your application.
31+
- Build and then deploy.
32+
- Run below command
33+
34+
anchor test --skip-local-validator
35+
36+
NB
37+
38+
When tetsing on local cluster you may encounter error "Pyth price oracle is offline.", please find below one of the approaches of addressing it.
39+
- On file "src\lib.rs", change the value "60" to a higher figure on these lines of code ".get_price_no_older_than(current_timestamp1, 60)"
40+
and ".get_price_no_older_than(current_timestamp2, 60)". This should just be for testing purposes on local cluster.

0 commit comments

Comments
 (0)