-
Notifications
You must be signed in to change notification settings - Fork 0
Enforce warrant issuance vesting references #250
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| module OpenCapTable.TestWarrantIssuanceReferences where | ||
|
|
||
| import qualified Fairmint.OpenCapTable.CapTable as CT | ||
| import Fairmint.OpenCapTable.OCF.WarrantIssuance (WarrantIssuanceOcfData(..)) | ||
| import Fairmint.OpenCapTable.Types.Monetary (OcfMonetary(..)) | ||
| import Fairmint.OpenCapTable.Types.Stock (OcfQuantitySourceType(..)) | ||
| import OpenCapTable.HelpersTriggers (ocfTriggerElectiveAtWill) | ||
| import OpenCapTable.Setup | ||
| import OpenCapTable.TestHelpers | ||
| import Daml.Script | ||
|
|
||
| warrantIssuance : Text -> Text -> Text -> WarrantIssuanceOcfData | ||
| warrantIssuance issuanceId securityId stakeholderId = WarrantIssuanceOcfData with | ||
| id = issuanceId | ||
| date = defaultTestDate | ||
| security_id = securityId | ||
| custom_id = "W-" <> issuanceId | ||
| stakeholder_id = stakeholderId | ||
| board_approval_date = None | ||
| stockholder_approval_date = None | ||
| consideration_text = None | ||
| security_law_exemptions = [] | ||
| quantity = Some 100.0 | ||
| quantity_source = Some OcfQuantityUnspecified | ||
| exercise_price = Some (OcfMonetary with amount = 1.0, currency = "USD") | ||
| purchase_price = OcfMonetary with amount = 0.0, currency = "USD" | ||
| exercise_triggers = [ocfTriggerElectiveAtWill] | ||
| warrant_expiration_date = None | ||
| vesting_terms_id = None | ||
| vestings = [] | ||
| comments = [] | ||
|
|
||
| createReferencedWarrantIssuance : | ||
| Party -> | ||
| ContractId CT.CapTable -> | ||
| Script (ContractId CT.CapTable, WarrantIssuanceOcfData, Text) | ||
| createReferencedWarrantIssuance issuer capTableCid = do | ||
| (capTableWithStakeholder, stakeholderId) <- setupStakeholderWithId issuer capTableCid "SH_WARRANT_REF" "Warrant Holder" | ||
| let vestingTermsId = "VT_WARRANT_REF" | ||
| let issuance = (warrantIssuance "TX_WARRANT_REF" "WARRANT-REF" stakeholderId) with | ||
| vesting_terms_id = Some vestingTermsId | ||
|
|
||
| result <- submit issuer do | ||
| exerciseCmd capTableWithStakeholder CT.UpdateCapTable with | ||
| creates = | ||
| [ CT.OcfCreateVestingTerms (defaultVestingTerms vestingTermsId) | ||
| , CT.OcfCreateWarrantIssuance issuance | ||
| ] | ||
| edits = [] | ||
| deletes = [] | ||
| pure (result.updatedCapTableCid, issuance, vestingTermsId) | ||
|
|
||
| testWarrantIssuance_MissingVestingTermsReferenceFails = script do | ||
| TestOcp{issuer, cap_table} <- setupTestOcp | ||
| (capTableCid, stakeholderId) <- setupStakeholderWithId issuer cap_table "SH_WARRANT_MISSING_VESTING" "Warrant Holder" | ||
| let issuance = (warrantIssuance "TX_WARRANT_MISSING_VESTING" "WARRANT-MISSING-VESTING" stakeholderId) with | ||
| vesting_terms_id = Some "VT_MISSING_WARRANT" | ||
|
|
||
| submitMustFail issuer do | ||
| exerciseCmd capTableCid CT.UpdateCapTable with | ||
| creates = [CT.OcfCreateWarrantIssuance issuance] | ||
| edits = [] | ||
| deletes = [] | ||
|
|
||
| testWarrantIssuance_VestingTermsCreatedInSameBatchSucceeds = script do | ||
| TestOcp{issuer, cap_table} <- setupTestOcp | ||
| _ <- createReferencedWarrantIssuance issuer cap_table | ||
| pure () | ||
|
|
||
| testWarrantIssuance_EditMissingVestingTermsReferenceFails = script do | ||
| TestOcp{issuer, cap_table} <- setupTestOcp | ||
| (capTableCid, issuance, _) <- createReferencedWarrantIssuance issuer cap_table | ||
| let editedIssuance = issuance with vesting_terms_id = Some "VT_MISSING_WARRANT_ON_EDIT" | ||
|
|
||
| submitMustFail issuer do | ||
| exerciseCmd capTableCid CT.UpdateCapTable with | ||
| creates = [] | ||
| edits = [CT.OcfEditWarrantIssuance editedIssuance] | ||
| deletes = [] | ||
|
|
||
| testWarrantIssuance_DeleteReferencedVestingTermsFails = script do | ||
| TestOcp{issuer, cap_table} <- setupTestOcp | ||
| (capTableCid, _, vestingTermsId) <- createReferencedWarrantIssuance issuer cap_table | ||
|
|
||
| submitMustFail issuer do | ||
| exerciseCmd capTableCid CT.UpdateCapTable with | ||
| creates = [] | ||
| edits = [] | ||
| deletes = [CT.OcfDeleteVestingTerms vestingTermsId] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,14 +88,9 @@ validations: | |
| 'vesting_terms_id?:vesting_terms', | ||
| ] | ||
| EquityCompensationIssuance: | ||
| [ | ||
| stakeholder_id, | ||
| 'stock_class_id?:stock_classes', | ||
| 'stock_plan_id?:stock_plans', | ||
| 'vesting_terms_id?:vesting_terms', | ||
| ] | ||
| [stakeholder_id, 'stock_class_id?:stock_classes', 'stock_plan_id?:stock_plans', 'vesting_terms_id?:vesting_terms'] | ||
| ConvertibleIssuance: [stakeholder_id] | ||
| WarrantIssuance: [stakeholder_id] | ||
| WarrantIssuance: [stakeholder_id, 'vesting_terms_id?:vesting_terms'] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When an existing warrant is edited to set Useful? React with 👍 / 👎. |
||
| # Stakeholder events - validate stakeholder exists | ||
| StakeholderRelationshipChangeEvent: [stakeholder_id] | ||
| StakeholderStatusChangeEvent: [stakeholder_id] | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes the recorded bytes for the already-backed-up
OpenCapTable-v34/0.0.2DAR whileOpenCapTable-v34/daml.yamlstill declares version0.0.2. The repo's backup flow treats existing lock keys as immutable (backup-darrefuses to overwrite them), so consumers or upgrade checks that refer to the previous 0.0.2 package can no longer reproduce that exact archive fromdars/; for this contract change, bump the package patch and add a new backup instead of replacing the existing 0.0.2 entry.Useful? React with 👍 / 👎.