Skip to content

Commit 2d18f5e

Browse files
authored
Merge pull request #150 from yetininoliviercoulibaly/main
RadInsurance
2 parents a1da594 + 3b64095 commit 2d18f5e

File tree

106 files changed

+24922
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+24922
-0
lines changed

7-defi-devpost/RadInsurance/README.md

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# What is RadInsurance ?
2+
3+
RadInsurance is a simplified version of a decentralized insurance protocol. The objective of this protocol is to improve the implementation of insurance by providing a more robust protocol in the future. The simplified protocol has several features that are explained in details.
4+
5+
Firstly, the protocol involves insurers investing in an insurance policy and being rewarded based on the contributions made by the insured. The rate of reward for insurers is equal to the rate of contributions made by the insured. This means that the more the insured contribute, the more the insurers will be rewarded.
6+
7+
Secondly, the maximum coverage for the insurance policy is equal to the amount invested by insurers. This means that the coverage provided by the insurance policy is directly proportional to the investment made by the insurers.
8+
9+
Thirdly, insurers cannot withdraw their investment but can sell it on the marketplace of insurers in case of liquidity needs. This provides flexibility to insurers who might need liquidity in the future.
10+
11+
Lastly, fixed service fees are deducted during the investment of insurers and the subscription of the insured.
12+
13+
In summary, the main idea is to propose a simplified version of a decentralized insurance protocol that has certain features that can improve the implementation of insurance. These features include rewards for insurers based on contributions made by the insured, a coverage directly proportional to the investment made by the insurers, flexibility for insurers to sell their investment on the marketplace and fixed service fees for both insurers and the insured.
14+
15+
If you are an insurance professionnal or if you have extensive knowledge of insurance topics, feel free to join us, you are welcome to the team ! :smiley:
16+
17+
18+
19+
## Quick start
20+
21+
Open a terminal window
22+
23+
Build scrypto project :
24+
25+
./scrypto/build.sh
26+
27+
### This application allows to :
28+
29+
An administrator to create an insurance policy :
30+
31+
cd ./scrypto/rad_insurance/demo && ./create_policy.sh
32+
33+
Anonymous users to invest liquidity in an insurance policy and thus become an insurer :
34+
35+
cd ./scrypto/rad_insurance/demo && ./invest_as_insurer.sh
36+
37+
Insurers to withdraw their rewards :
38+
39+
cd ./scrypto/rad_insurance/demo && ./rewards_withdrawal.sh
40+
41+
Anonymous users to subscribe to an insurance policy and thus become insured :
42+
43+
cd ./scrypto/rad_insurance/demo && ./subscribe_to_insurance_policy.sh
44+
45+
Insured to report a claim :
46+
47+
cd ./scrypto/rad_insurance/demo && ./report_a_claim.sh
48+
49+
The administrator to accept the claim report and allow the insured to withdraw the amount :
50+
51+
cd ./scrypto/rad_insurance/demo && ./make_claim_as_accepted.sh
52+
53+
The administrator to refuse the claim report :
54+
55+
cd ./scrypto/rad_insurance/demo && ./make_claim_as_refused.sh
56+
57+
Insurers to claim withdraw :
58+
59+
cd ./scrypto/rad_insurance/demo && ./claim_withdraw.sh
60+
61+
Insurers to get rewards :
62+
63+
cd ./scrypto/rad_insurance/demo && ./get_rewards.sh
64+
65+
Insurers to withdraw sale amount :
66+
67+
cd ./scrypto/rad_insurance/demo && ./withdrawal_sale_amount.sh
68+
69+
Insurers to buy on marketplace :
70+
71+
cd ./scrypto/rad_insurance/demo && ./buy_on_marketplace.sh
72+
73+
Insurers to list on marketplace :
74+
75+
cd ./scrypto/rad_insurance/demo && ./list_on_marketplace.sh
76+
77+
Insurers to delist on marketplace :
78+
79+
cd ./scrypto/rad_insurance/demo && ./delist_on_marketplace.sh
80+
81+
82+
# Run front application
83+
84+
Open a new terminal window
85+
86+
Go to scrypto-frontend folder and install packages
87+
88+
cd ./scrypto-frontend && npm install
89+
90+
The frontend application is developed in Angular. You can therefore launch the application with this command :
91+
92+
ng serve
93+
94+
Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
95+
96+
##### :warning: We encountered compilation errors from the @radixdlt/radix-dapp-toolkit module
97+
the following error occurs:
98+
99+
![Compilation error](./scrypto-frontend//RadInsurance-angular/docs/compilation_error.png)
100+
101+
The file containing the bug is located in the following path :
102+
` node_modules/@radixdlt/wallet-sdk/dist/IO/schemas.d.ts`
103+
104+
To fix this error, you can just add the missing braces around `z` in the import :
105+
106+
import { z } from 'zod';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Editor configuration, see https://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.ts]
12+
quote_type = single
13+
14+
[*.md]
15+
max_line_length = off
16+
trim_trailing_whitespace = false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# Compiled output
4+
/dist
5+
/tmp
6+
/out-tsc
7+
/bazel-out
8+
9+
# Node
10+
/node_modules
11+
npm-debug.log
12+
yarn-error.log
13+
14+
# IDEs and editors
15+
.idea/
16+
.project
17+
.classpath
18+
.c9/
19+
*.launch
20+
.settings/
21+
*.sublime-workspace
22+
23+
# Visual Studio Code
24+
.vscode/*
25+
!.vscode/settings.json
26+
!.vscode/tasks.json
27+
!.vscode/launch.json
28+
!.vscode/extensions.json
29+
.history/*
30+
31+
# Miscellaneous
32+
/.angular/cache
33+
.sass-cache/
34+
/connect.lock
35+
/coverage
36+
/libpeerconnection.log
37+
testem.log
38+
/typings
39+
40+
# System files
41+
.DS_Store
42+
Thumbs.db
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# RadInsuranceAngular
2+
3+
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.2.1.
4+
5+
## Development server
6+
7+
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
8+
9+
## Code scaffolding
10+
11+
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
12+
13+
## Build
14+
15+
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
16+
17+
## Running unit tests
18+
19+
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
20+
21+
## Running end-to-end tests
22+
23+
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
24+
25+
## Further help
26+
27+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"RadInsurance-angular": {
7+
"projectType": "application",
8+
"schematics": {},
9+
"root": "",
10+
"sourceRoot": "src",
11+
"prefix": "app",
12+
"architect": {
13+
"build": {
14+
"builder": "@angular-devkit/build-angular:browser",
15+
"options": {
16+
"outputPath": "dist/rad-insurance-angular",
17+
"index": "src/index.html",
18+
"main": "src/main.ts",
19+
"polyfills": [
20+
"zone.js"
21+
],
22+
"tsConfig": "tsconfig.app.json",
23+
"assets": [
24+
"src/favicon.ico",
25+
"src/assets"
26+
],
27+
"styles": [
28+
"src/styles.css"
29+
],
30+
"allowedCommonJsDependencies": [
31+
"lodash"
32+
],
33+
"scripts": []
34+
},
35+
"configurations": {
36+
"production": {
37+
"budgets": [
38+
{
39+
"type": "initial",
40+
"maximumWarning": "500kb",
41+
"maximumError": "1mb"
42+
},
43+
{
44+
"type": "anyComponentStyle",
45+
"maximumWarning": "2kb",
46+
"maximumError": "4kb"
47+
}
48+
],
49+
"outputHashing": "all"
50+
},
51+
"development": {
52+
"buildOptimizer": false,
53+
"optimization": false,
54+
"vendorChunk": true,
55+
"extractLicenses": false,
56+
"sourceMap": true,
57+
"namedChunks": true
58+
}
59+
},
60+
"defaultConfiguration": "production"
61+
},
62+
"serve": {
63+
"builder": "@angular-devkit/build-angular:dev-server",
64+
"configurations": {
65+
"production": {
66+
"browserTarget": "RadInsurance-angular:build:production"
67+
},
68+
"development": {
69+
"browserTarget": "RadInsurance-angular:build:development"
70+
}
71+
},
72+
"defaultConfiguration": "development"
73+
},
74+
"extract-i18n": {
75+
"builder": "@angular-devkit/build-angular:extract-i18n",
76+
"options": {
77+
"browserTarget": "RadInsurance-angular:build"
78+
}
79+
},
80+
"test": {
81+
"builder": "@angular-devkit/build-angular:karma",
82+
"options": {
83+
"polyfills": [
84+
"zone.js",
85+
"zone.js/testing"
86+
],
87+
"tsConfig": "tsconfig.spec.json",
88+
"assets": [
89+
"src/favicon.ico",
90+
"src/assets"
91+
],
92+
"styles": [
93+
"src/styles.css"
94+
],
95+
"scripts": []
96+
}
97+
}
98+
}
99+
}
100+
},
101+
"cli": {
102+
"analytics": "8a08c660-8e83-4cba-98b4-930a337b3589"
103+
}
104+
}

0 commit comments

Comments
 (0)