Skip to content
This repository was archived by the owner on Nov 24, 2020. It is now read-only.

Commit 9b83603

Browse files
authored
merge rwanda project related changes
long due merge from demos
2 parents f495775 + 75de08c commit 9b83603

File tree

14 files changed

+119
-20
lines changed

14 files changed

+119
-20
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ The dependency graph of this repo can be seen [here](godepgraph.png)
5353
This is an open source project and everyone is invited to contribute value to it. It is part of an open innovation framework and published using an MIT License so that it allows compatibility with proprietary layers. General code standards are to be considered while opening Pull Requests.
5454
![Open Contributions](docs/figures/OpenContributions.png)
5555

56+
## Security
57+
For security related issues, *DO NOT OPEN A GITHUB ISSUE!*. Please disclose the information responsibly by sending a (preferably PGP Encrypted) email to `[email protected]`. [Our PGP Key](https://pgp.mit.edu/pks/lookup?op=vindex&fingerprint=on&search=0x708C606504A49970) fingerprint is `C98F 0014 9A99 36E4 E56D 2471 708C 6065 04A4 9970`
58+
5659
## License
5760

5861
[MIT](https://github.com/YaleOpenLab/openx/blob/master/LICENSE)

assets/assets.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ func SendAssetFromIssuer(assetName string, destination string, amount string,
116116
func SendAssetToIssuer(assetName string, destination string, amount string,
117117
seed string, pubkey string) (int32, string, error) {
118118
// this transaction is FROM recipient TO issuer
119+
// TODO: remove pubkey field since we already have the seed
119120
paymentTx, err := build.Transaction(
120121
build.SourceAccount{pubkey},
121122
build.TestNetwork,

data-sandbox/100kw.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"value": "Solar Output"
8383
}, {
8484
"type": "image",
85-
"value": "https://s3.amazonaws.com/cz-public-images/openx/rwanda-solargen.png",
85+
"value": "https://images.openx.solar/demo/rwanda-solargen.png",
8686
"height": 538
8787
}]
8888
}, {
@@ -105,7 +105,7 @@
105105
"width": 7,
106106
"content": [{
107107
"type": "image",
108-
"value": "http://images.openx.solar/demo/rwanda-engineering.png",
108+
"value": "https://images.openx.solar/demo/rwanda-engineering.png",
109109
"height": 437
110110
}]
111111
}, {

data-sandbox/100kwy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Have all the frontend sandbox params here and avoid cluttering the frontend
22
Index: 8
3-
Name: "Village Energy Collective, Off-grid Rural Microgrid, Rwanda (Theoretical)"
3+
Name: "Village Energy Collective, Rural Microgrid"
44
City: "Cyangugu"
55
State: "Rusizi District, Western Province"
66
Country: "Rwanda"

frontenddata.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func createAllStaticEntities() error {
9292
return err
9393
}
9494

95-
_, err = opensolar.NewOriginator("[email protected]", "password", "x", "bensouthworth", "Lancaster, NH", "Originator of the Lancaster oz fund community")
95+
_, err = opensolar.NewOriginator("[email protected]", "password", "x", "Ben Southworth", "Lancaster, NH", "Originator of the Lancaster oz fund community")
9696
if err != nil {
9797
return err
9898
}

models/munibond/munibond.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ func MunibondPayback(issuerPath string, recpIndex int, amount string, recipientS
215215
return -1, errors.Wrap(err, "You do not have the required stablecoin balance, please refill")
216216
}
217217

218+
if projIndex == 4 {
219+
escrowPubkey = "GB2MLKOMRHXJQRX3ZCBLAZ2PMJOYHMFXQUR525CNCSPKBE643FRQNZBM"
220+
}
218221
log.Println("ESCROW PUBKEY: ", escrowPubkey)
219222
_, stableUSDHash, err := assets.SendAsset(consts.Code, consts.StableCoinAddress, escrowPubkey, amount, recipientSeed, recipient.U.PublicKey, "Opensolar payback: "+utils.ItoS(projIndex))
220223
if err != nil {

platforms/opensolar/contract.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ func SeedInvest(projIndex int, invIndex int, invAmount string, invSeed string) e
196196
}
197197

198198
// MW: Consider other seed investments in stages before the big raise of stage 4
199-
if project.Stage != 1 {
199+
if project.Stage != 1 && project.Stage != 2 {
200200
return fmt.Errorf("project stage not at 1, you either have passed the seed stage or project is not at seed stage yet")
201201
}
202202

@@ -243,7 +243,7 @@ func Invest(projIndex int, invIndex int, invAmount string, invSeed string) error
243243
}
244244

245245
if project.Stage != 4 {
246-
if project.Stage == 1 {
246+
if project.Stage == 1 || project.Stage == 2 {
247247
// need to redirect it to the seedinvest function
248248
return SeedInvest(projIndex, invIndex, invAmount, invSeed)
249249
}

rpc/recipient.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ func payback() {
167167
return
168168
}
169169

170+
log.Println(recpIndex, projIndex, assetName, amount, recipientSeed)
170171
err = opensolar.Payback(recpIndex, projIndex, assetName, amount, recipientSeed)
171172
if err != nil {
172173
log.Println("did not payback", err)

sandbox.go

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,5 +536,69 @@ func populateAdditionalData() error {
536536
}
537537
log.Println("TX HASH for pasto school sec wallet getting stableUSD: ", txhash)
538538

539+
investor1, invSeed, err := bootstrapInvestor("[email protected]", "Medici Ventures")
540+
if err != nil {
541+
log.Fatal(err)
542+
}
543+
544+
_, err = assets.TrustAsset(consts.Code, consts.StablecoinPublicKey, "10000000000", investor1.U.PublicKey, invSeed)
545+
if err != nil {
546+
log.Fatal(err)
547+
}
548+
_, _, err = assets.SendAssetFromIssuer(consts.Code, investor1.U.PublicKey, "1000000", consts.StablecoinSeed, consts.StablecoinPublicKey)
549+
if err != nil {
550+
log.Fatal(err)
551+
}
552+
553+
investor1.U.Email = "[email protected]"
554+
investor1.U.Address = "101 Medici Rd"
555+
investor1.U.Country = "US"
556+
investor1.U.City = "Salt Lake City"
557+
investor1.U.ZipCode = "08404"
558+
investor1.U.RecoveryPhone = "1800SECRETS"
559+
560+
err = investor1.Save()
561+
if err != nil {
562+
log.Fatal(err)
563+
}
564+
565+
recp1, recpSeed, err := bootstrapRecipient("[email protected]", "Rwanda Village Energy Collective")
566+
if err != nil {
567+
log.Fatal(err)
568+
}
569+
570+
_, err = assets.TrustAsset(consts.Code, consts.StablecoinPublicKey, "10000000000", recp1.U.PublicKey, recpSeed)
571+
if err != nil {
572+
log.Fatal(err)
573+
}
574+
_, _, err = assets.SendAssetFromIssuer(consts.Code, recp1.U.PublicKey, "1000000", consts.StablecoinSeed, consts.StablecoinPublicKey)
575+
if err != nil {
576+
log.Fatal(err)
577+
}
578+
579+
recp1.U.Email = "[email protected]"
580+
recp1.U.Address = "45 Cyangugu Rd, Rwanda"
581+
recp1.U.Country = "Rwanda"
582+
recp1.U.City = "Rusizi"
583+
recp1.U.ZipCode = "6502"
584+
recp1.U.RecoveryPhone = "1800SECRETS"
585+
586+
err = recp1.Save()
587+
if err != nil {
588+
log.Fatal(err)
589+
}
590+
591+
project, err := opensolar.RetrieveProject(8)
592+
if err != nil {
593+
log.Fatal(err)
594+
}
595+
596+
project.RecipientIndex = 64
597+
598+
err = project.Save()
599+
if err != nil {
600+
log.Fatal(err)
601+
}
602+
539603
return nil
540604
}

teller/config.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,14 @@ func StartTeller() error {
101101
return errors.Wrap(err, "could not store start time locally")
102102
}
103103

104-
// sotre location at the start because if a person changes location, it is likely that the
104+
// store location at the start because if a person changes location, it is likely that the
105105
// teller goes offline and we get notified
106106
err = StoreLocation(mapskey) // stores DeviceLocation
107107
if err != nil {
108108
return errors.Wrap(err, "could not store location of teller")
109109
}
110110

111+
log.Println("STORED LOCATION SUCCESSFULLY")
111112
err = GetPlatformEmail()
112113
if err != nil {
113114
return errors.Wrap(err, "could not store platform email")

0 commit comments

Comments
 (0)