-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added some v1.2 BDD scenarios in Gherkin
- Loading branch information
James Browning
committed
Mar 8, 2021
1 parent
3f8eb2b
commit cd4d55b
Showing
3 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
Feature: Delegation | ||
|
||
Rule: Delegation transaction can be constructed | ||
|
||
Scenario: Valid case | ||
Given exchange holds 2'463'071'701 ADA in my account | ||
And stake pool TEST_1 is registered | ||
When I provide details of my delegation intent | ||
Then exchange can construct a transaction for this delegation | ||
And the delegation transaction matches my delegation intent | ||
|
||
Scenario: Invalid case – no funds | ||
Given exchange holds no funds in my account | ||
And stake pool TEST_1 is registered | ||
When I provide details of my delegation intent | ||
Then an error is returned (this validation may not occur until submit) | ||
And exchange doesn't construct a transaction for this delegation | ||
|
||
Scenario: Invalid case – not enough funds to delegate (less than 2ADA) | ||
Given exchange holds 1.5 ADA in my account | ||
And stake pool TEST_1 is registered | ||
When I provide details of my delegation intent | ||
Then an error is returned (this validation may not occur until submit) | ||
And exchange doesn't construct a transaction for this delegation | ||
|
||
Scenario: Invalid case – not my account | ||
Given exchange holds 1'000 ADA in my account | ||
And stake pool TEST_1 is registered | ||
When I provide my delegation intent using a different account address | ||
Then an error is returned due to me not having permission | ||
And exchange doesn't construct a transaction for this delegation | ||
|
||
Rule: Delegation transaction can be submitted | ||
|
||
Scenario: Valid delegation transaction | ||
Given exchange holds 100 ADA in my account | ||
And exchange has constructed a valid delegation transaction for stake pool TEST_1 | ||
When exchange submits the transaction | ||
Then a successful response is returned | ||
And there is onchain proof | ||
|
||
Scenario: Invalid case – stakepool not registered | ||
Given exchange holds 100 ADA in my account | ||
And exchange has constructed a delegation transaction using a stakepool id that is not registered | ||
When exchange submits the transaction | ||
Then an error is returned | ||
And delegation is not accepted on the blockchain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
Feature: Pledge to a stakepool | ||
|
||
Rule: Pledging transaction can be constructed | ||
|
||
Scenario: Valid case | ||
Given I am the owner of STAKEPOOL_1 | ||
And I hold 1'000'000 ADA in my account | ||
When I provide pledging intent of 350'000 ADA | ||
Then exchange constructs a transaction for my pledge | ||
And the delegation transaction matches my pledging intent of 350'000 ADA | ||
|
||
Scenario: Invalid case - no enough funds to pledge | ||
Given I am the owner of STAKEPOOL_1 | ||
And I hold 1'000 ADA in my account | ||
When I probide pledging intent of 320'000 ADA | ||
Then exchange does not construct a transaction for my pledge | ||
|
||
Scenario: Invalid case - stakepool not registered | ||
Given I am not the owner of STAKEPOOL_2 | ||
And I hold 1'000'000 ADA in my account | ||
When I provide pledging intent of 350'000 ADA | ||
Then exchange does not construct a transaction for my pledger | ||
|
||
Rule: Pledging transaction can be submitted | ||
|
||
Scenario: Valid pledging transaction | ||
Given I am the owner of STAKEPOOL_1 | ||
And exchange has already constructed my pledging transaction for 350'000 ADA | ||
When exchange submits the transaction | ||
Then a successful response is returned | ||
And there is onchain proof | ||
|
||
Scenario: Invalid case – stakepool not registered | ||
Given exchange has constructed a delegation transaction using a stakepool id that is not registered | ||
When exchange submits the transaction | ||
Then an error is returned | ||
And pledge is not accepted on the blockchain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
Feature: Register as stakepool owner | ||
|
||
Rule: Constructing a stakepool registration certificate (this may be client-side only and not Rosetta) | ||
|
||
Scenario: Valid case - constructing a stakepool registration certificate | ||
Given exchange holds 600'000 ADA in my address | ||
When exchange is provided with registration detailsi (name, description, ticker, homepage, margin etc) | ||
Then exchange can successful construct a stakepool registration certificate | ||
|
||
Rule: Publishing a stakepool registration certificate | ||
|
||
Scenario: Valid case - publish stakepool registration certificate for pool that I operate | ||
Given exchange holds 600'000 ADA in my account | ||
And exchange has successfully constructed a stakepool registration certificate for pool that I operate | ||
And exchange has witnessed the certificate (action not performed with Rosetta) | ||
When exchange publishes this certificate | ||
Then regestration transaction is accepted on the blockchain | ||
|
||
Scenario: Valid case - publish stakepool registration certificate for a 3rd party pool | ||
Given exchange holds 600'000 ADA in my account | ||
And exchange has successfully constructed a stakepool registration certificate for a 3rd party pool | ||
And exchange has witnessed the certificate (action not performed with Rosetta) | ||
When exchange publishes this certificate | ||
Then regestration transaction is accepted on the blockchain | ||
|
||
Scenario: Invalid case - invalid witness | ||
Given exchange holds 600'000 ADA in my account | ||
And exchange has successfully constructed a stakepool registration certificate | ||
And exchange has witnessed the certificate with a different key (is this possible?) | ||
When exchange publishes this certificate | ||
Then an error is returned | ||
And regestration transaction is not accepted on the blockchain | ||
|
||
Scenario: Invalid case - missing witness | ||
Given exchange holds 600'000 ADA in my account | ||
And exchange has successfully constructed a stakepool registration certificate | ||
And exchange has not witnessed the certificate | ||
When exchange publishes this certificate | ||
Then an error is returned | ||
And regestration transaction is not accepted on the blockchain |