Skip to content

Commit cd4d55b

Browse files
author
James Browning
committed
Added some v1.2 BDD scenarios in Gherkin
1 parent 3f8eb2b commit cd4d55b

File tree

3 files changed

+124
-0
lines changed

3 files changed

+124
-0
lines changed

bdd/features/delegation

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
Feature: Delegation
2+
3+
Rule: Delegation transaction can be constructed
4+
5+
Scenario: Valid case
6+
Given exchange holds 2'463'071'701 ADA in my account
7+
And stake pool TEST_1 is registered
8+
When I provide details of my delegation intent
9+
Then exchange can construct a transaction for this delegation
10+
And the delegation transaction matches my delegation intent
11+
12+
Scenario: Invalid case – no funds
13+
Given exchange holds no funds in my account
14+
And stake pool TEST_1 is registered
15+
When I provide details of my delegation intent
16+
Then an error is returned (this validation may not occur until submit)
17+
And exchange doesn't construct a transaction for this delegation
18+
19+
Scenario: Invalid case – not enough funds to delegate (less than 2ADA)
20+
Given exchange holds 1.5 ADA in my account
21+
And stake pool TEST_1 is registered
22+
When I provide details of my delegation intent
23+
Then an error is returned (this validation may not occur until submit)
24+
And exchange doesn't construct a transaction for this delegation
25+
26+
Scenario: Invalid case – not my account
27+
Given exchange holds 1'000 ADA in my account
28+
And stake pool TEST_1 is registered
29+
When I provide my delegation intent using a different account address
30+
Then an error is returned due to me not having permission
31+
And exchange doesn't construct a transaction for this delegation
32+
33+
Rule: Delegation transaction can be submitted
34+
35+
Scenario: Valid delegation transaction
36+
Given exchange holds 100 ADA in my account
37+
And exchange has constructed a valid delegation transaction for stake pool TEST_1
38+
When exchange submits the transaction
39+
Then a successful response is returned
40+
And there is onchain proof
41+
42+
Scenario: Invalid case – stakepool not registered
43+
Given exchange holds 100 ADA in my account
44+
And exchange has constructed a delegation transaction using a stakepool id that is not registered
45+
When exchange submits the transaction
46+
Then an error is returned
47+
And delegation is not accepted on the blockchain

bdd/features/pledge-to-stakepool

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Feature: Pledge to a stakepool
2+
3+
Rule: Pledging transaction can be constructed
4+
5+
Scenario: Valid case
6+
Given I am the owner of STAKEPOOL_1
7+
And I hold 1'000'000 ADA in my account
8+
When I provide pledging intent of 350'000 ADA
9+
Then exchange constructs a transaction for my pledge
10+
And the delegation transaction matches my pledging intent of 350'000 ADA
11+
12+
Scenario: Invalid case - no enough funds to pledge
13+
Given I am the owner of STAKEPOOL_1
14+
And I hold 1'000 ADA in my account
15+
When I probide pledging intent of 320'000 ADA
16+
Then exchange does not construct a transaction for my pledge
17+
18+
Scenario: Invalid case - stakepool not registered
19+
Given I am not the owner of STAKEPOOL_2
20+
And I hold 1'000'000 ADA in my account
21+
When I provide pledging intent of 350'000 ADA
22+
Then exchange does not construct a transaction for my pledger
23+
24+
Rule: Pledging transaction can be submitted
25+
26+
Scenario: Valid pledging transaction
27+
Given I am the owner of STAKEPOOL_1
28+
And exchange has already constructed my pledging transaction for 350'000 ADA
29+
When exchange submits the transaction
30+
Then a successful response is returned
31+
And there is onchain proof
32+
33+
Scenario: Invalid case – stakepool not registered
34+
Given exchange has constructed a delegation transaction using a stakepool id that is not registered
35+
When exchange submits the transaction
36+
Then an error is returned
37+
And pledge is not accepted on the blockchain

bdd/features/register-stakepool-owner

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Feature: Register as stakepool owner
2+
3+
Rule: Constructing a stakepool registration certificate (this may be client-side only and not Rosetta)
4+
5+
Scenario: Valid case - constructing a stakepool registration certificate
6+
Given exchange holds 600'000 ADA in my address
7+
When exchange is provided with registration detailsi (name, description, ticker, homepage, margin etc)
8+
Then exchange can successful construct a stakepool registration certificate
9+
10+
Rule: Publishing a stakepool registration certificate
11+
12+
Scenario: Valid case - publish stakepool registration certificate for pool that I operate
13+
Given exchange holds 600'000 ADA in my account
14+
And exchange has successfully constructed a stakepool registration certificate for pool that I operate
15+
And exchange has witnessed the certificate (action not performed with Rosetta)
16+
When exchange publishes this certificate
17+
Then regestration transaction is accepted on the blockchain
18+
19+
Scenario: Valid case - publish stakepool registration certificate for a 3rd party pool
20+
Given exchange holds 600'000 ADA in my account
21+
And exchange has successfully constructed a stakepool registration certificate for a 3rd party pool
22+
And exchange has witnessed the certificate (action not performed with Rosetta)
23+
When exchange publishes this certificate
24+
Then regestration transaction is accepted on the blockchain
25+
26+
Scenario: Invalid case - invalid witness
27+
Given exchange holds 600'000 ADA in my account
28+
And exchange has successfully constructed a stakepool registration certificate
29+
And exchange has witnessed the certificate with a different key (is this possible?)
30+
When exchange publishes this certificate
31+
Then an error is returned
32+
And regestration transaction is not accepted on the blockchain
33+
34+
Scenario: Invalid case - missing witness
35+
Given exchange holds 600'000 ADA in my account
36+
And exchange has successfully constructed a stakepool registration certificate
37+
And exchange has not witnessed the certificate
38+
When exchange publishes this certificate
39+
Then an error is returned
40+
And regestration transaction is not accepted on the blockchain

0 commit comments

Comments
 (0)