Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/bdd gherkin #316

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions bdd/features/delegation
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
37 changes: 37 additions & 0 deletions bdd/features/pledge-to-stakepool
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
40 changes: 40 additions & 0 deletions bdd/features/register-stakepool-owner
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