Skip to content

Commit 5d97b2e

Browse files
Merge pull request #615 from oasisprotocol/uniyalabhishek/rofl/warn-user-rent-refund-policy
feat: add warning for user about refund policy
2 parents ff344fd + 3e1b911 commit 5d97b2e

8 files changed

Lines changed: 58 additions & 0 deletions

File tree

cmd/rofl/common/policy.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package common
2+
3+
import "fmt"
4+
5+
// RentRefundWarning is a standardized message shown before renting, topping up, or canceling a machine.
6+
const RentRefundWarning = "WARNING: Machine rental is non-refundable. You will not get a refund for the already paid term if you cancel."
7+
8+
// PrintRentRefundWarning prints the standardized, user-facing refund policy warning.
9+
func PrintRentRefundWarning() {
10+
fmt.Println(RentRefundWarning)
11+
}

cmd/rofl/deploy.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ var (
195195
fmt.Printf("Selected per-%s pricing term, total price is ", term2str(term))
196196
tp.PrettyPrint(ctx, "", os.Stdout)
197197
fmt.Println(".")
198+
// Warn the user about the non-refundable rental policy before first renting.
199+
roflCommon.PrintRentRefundWarning()
198200

199201
// Prepare transaction.
200202
tx := roflmarket.NewInstanceCreateTx(nil, &roflmarket.InstanceCreate{

cmd/rofl/machine/mgmt.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ var (
8585
fmt.Printf("Using provider: %s (%s)\n", machine.Provider, providerAddr)
8686
fmt.Printf("Canceling machine: %s [%s]\n", machineName, machine.ID)
8787
fmt.Printf("WARNING: Canceling a machine will permanently destroy it including any persistent storage!\n")
88+
roflCommon.PrintRentRefundWarning()
8889

8990
// Prepare transaction.
9091
tx := roflmarket.NewInstanceCancelTx(nil, &roflmarket.InstanceCancel{
@@ -229,6 +230,7 @@ var (
229230
fmt.Printf("Using provider: %s (%s)\n", machine.Provider, providerAddr)
230231
fmt.Printf("Top-up machine: %s [%s]\n", machineName, machine.ID)
231232
fmt.Printf("Top-up term: %d x %s\n", roflCommon.TermCount, roflCommon.Term)
233+
roflCommon.PrintRentRefundWarning()
232234

233235
// Prepare transaction.
234236
tx := roflmarket.NewInstanceTopUpTx(nil, &roflmarket.InstanceTopUp{

docs/rofl.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,13 @@ To start it back again, use [`oasis rofl machine restart`].
299299
To cancel the rental and permanently remove a machine,
300300
including its persistent storage, use `oasis rofl machine remove`.
301301

302+
:::info
303+
304+
Canceling a machine rental will not refund any payment for the already paid
305+
term.
306+
307+
:::
308+
302309
## Advanced
303310

304311
### Upgrade ROFL app dependencies {#upgrade}

examples/rofl/deploy.out.static

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Using provider: oasis1qzc8pldvm8vm3duvdrj63wgvkw34y9ucfcxzetqr
22
Pushing ROFL app to OCI repository 'rofl.sh/7aaddbd5-d782-430f-9362-f0107aa109d2:1750242297'...
33
No pre-existing machine configured, creating a new one...
44
Taking offer: small [0000000000000000]
5+
WARNING: Machine rental is non-refundable. You will not get a refund for the already paid term if you cancel.
56
Unlock your account.
67
? Passphrase:
78
You are about to sign the following transaction:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
oasis rofl machine remove
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Using provider: oasis1qzc8pldvm8vm3duvdrj63wgvkw34y9ucfcxzetqr (oasis1qzc8pldvm8vm3duvdrj63wgvkw34y9ucfcxzetqr)
2+
Canceling machine: default [0000000000000000]
3+
WARNING: Canceling a machine will permanently destroy it including any persistent storage!
4+
WARNING: Machine rental is non-refundable. You will not get a refund for the already paid term if you cancel.
5+
Unlock your account.
6+
? Passphrase:
7+
You are about to sign the following transaction:
8+
Format: plain
9+
Method: roflmarket.InstanceCancel
10+
Body:
11+
{
12+
"provider": "oasis1qzc8pldvm8vm3duvdrj63wgvkw34y9ucfcxzetqr",
13+
"id": "0000000000000000"
14+
}
15+
Authorized signer(s):
16+
1. Amc63/tU+uNrYi7OID2a5a/hHbsbGTtAolnlyA+MF5g5 (secp256k1eth)
17+
Nonce: 7
18+
Fee:
19+
Amount: 0.0009876 ROSE
20+
Gas limit: 9876
21+
(gas price: 0.0000001 ROSE per gas unit)
22+
23+
Network: mainnet
24+
ParaTime: sapphire
25+
Account: test:dave
26+
? Sign this transaction? Yes
27+
(In case you are using a hardware-based signer you may need to confirm on device.)
28+
Broadcasting transaction...
29+
Transaction included in block successfully.
30+
Round: 9356524
31+
Transaction hash: 4c619736c5678486950f5b5950a7f9b7c43b9656935cc472a90680187469f4dd
32+
Execution successful.
33+
Machine removed.

examples/rofl/machine-top-up.out.static

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Using provider: oasis1qp2ens0hsp7gh23wajxa4hpetkdek3swyyulyrmz (oasis1qp2ens0hsp7gh23wajxa4hpetkdek3swyyulyrmz)
22
Top-up machine: default [000000000000022a]
33
Top-up term: 12 x hour
4+
WARNING: Machine rental is non-refundable. You will not get a refund for the already paid term if you cancel.
45
Unlock your account.
56
? Passphrase:
67
You are about to sign the following transaction:

0 commit comments

Comments
 (0)