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

Feature/recurring payments #20

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
14 changes: 14 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ variable asset_type_security {
default = "2"
}

module "accounts" {
source = "modules/accounts"
general_account_role = "${module.account_roles.general_account_role}"

rec_payments_signer_role = "${module.signer_roles.rec_payments_signer_role}"
default_signer_role = "${module.signer_roles.default_signer_role}"
}

// creates basic account rules
module "account_rules" {
source = "modules/account_rules"
Expand Down Expand Up @@ -254,6 +262,11 @@ module "signer_roles" {
create_kyc = [
"${module.signer_rules.kyc_recovery_creator}",
]

rec_payments_rules = [
"${module.signer_rules.tx_sender}",
"${module.signer_rules.rec_payment_creator}"
]
}

module "key_values" {
Expand All @@ -276,4 +289,5 @@ module "external_system_type_pool_entry" {
module "signers" {
source = "modules/signers"
license_signer_role = "${module.signer_roles.license_signer_role}"
rec_payments_signer_role = "${module.signer_roles.rec_payments_signer_role}"
}
4 changes: 4 additions & 0 deletions modules/account_roles/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,7 @@ resource tokend_key_value "us_accredited" {
value_type = "uint32"
value = "${tokend_account_role.us_accredited.id}"
}

output "general_account_role" {
value = "${tokend_account_role.general.id}"
}
30 changes: 30 additions & 0 deletions modules/accounts/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
variable "general_account_role" {
type = "string"
}

variable "rec_payments_signer_role" {
type = "string"
}

variable "default_signer_role" {
type = "string"
}

resource tokend_account "recurring_payments_account" {
account_id = "GBSO4E7YBNWOGQAW64RC4LACM3YNBH2C4PWRLNXILVFHG2AWANH54L5T" # SC45C2RCEBVIUMKU6MJBVDI2PULM4RXJBNGRZRSGRZRVIK5UZMFUFOIX
role_id = "${var.general_account_role}"
signers = [
{
role_id = "${var.rec_payments_signer_role}"
public_key = "GDX6P3OBSMLKVPADU2FPJZJSSB6S5SCSMHKDC2RLJVE6PAWPDBGUM4QG" # SBZY7CTSALS4TJ5MZ47RPUNT7RLKY6ACN3F7U2KHRTFGMEXI43F5D2B6
weight = 1000
identity = 1
},
{
role_id = "${var.default_signer_role}"
public_key = "GDMIOBLB6F3R2NMWTA5ZPM7DHKOQ5EQWMI4KLSUOKDZQYXTU2PP4VUN5" # SB7KM4EMFJIQZYE2H66OVP6XPXDPEA2S2Y7DPCOV7OAJJKNW2UQVEYZJ
weight = 1000
identity = 1
}
]
}
31 changes: 30 additions & 1 deletion modules/signer_roles/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ variable "license_admin" {
type = "list"
}

variable "rec_payments_rules" {
type = "list"
}

variable "create_kyc" {
type = "list"
}
Expand Down Expand Up @@ -66,7 +70,7 @@ resource tokend_signer_role "kyc_aml_admin" {

resource tokend_signer_role "license_admin" {
rules = [
"${var.license_admin}"
"${var.license_admin}"
]
details = {
admin_role = true
Expand All @@ -75,6 +79,17 @@ resource tokend_signer_role "license_admin" {
}
}

resource tokend_signer_role "rec_payments_signer" {
rules = [
"${var.rec_payments_rules}"
]

details = {
admin_role = false
name = "Recurring Payments signer role"
description = "Able to sign recurring payments"
}
}

// users operational signer role
resource tokend_signer_role "default" {
Expand Down Expand Up @@ -106,6 +121,20 @@ resource tokend_key_value "license_admin_role" {
value = "${tokend_signer_role.license_admin.id}"
}

resource tokend_key_value "rec_payments_role" {
key = "signer_role:rec_payments"
value_type = "uint64"
value = "${tokend_signer_role.rec_payments_signer.id}"
}

output "license_signer_role" {
value = "${tokend_signer_role.license_admin.id}"
}

output "rec_payments_signer_role" {
value = "${tokend_signer_role.rec_payments_signer.id}"
}

output "default_signer_role" {
value = "${tokend_signer_role.default.id}"
}
13 changes: 13 additions & 0 deletions modules/signer_rules/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ resource tokend_signer_rule "stamp_creator" {
entry_type = "stamp"
}

resource tokend_signer_rule "rec_payment_creator" {
action = "send"
entry_type = "asset"
entry = {
asset_code = "*"
asset_type = "*"
}
}

output "aml_alert_reviewer" {
value = "${tokend_signer_rule.aml_alert_reviewer.id}"
}
Expand Down Expand Up @@ -119,6 +128,10 @@ output "license_creator" {
value = "${tokend_signer_rule.license_creator.id}"
}

output "rec_payment_creator" {
value = "${tokend_signer_rule.rec_payment_creator.id}"
}

output "stamp_creator" {
value = "${tokend_signer_rule.stamp_creator.id}"
}
Expand Down
6 changes: 5 additions & 1 deletion modules/signers/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ variable "license_signer_role" {
type = "string"
}

variable "rec_payments_signer_role" {
type = "string"
}

resource tokend_account_signer "license_signer" {
public_key = "GAEOJ3TZ2HI2FNFLMS7KLYZXRX5YZKC5UBMXUH2B5O2KSJ7ALZQALHH3"
weight = 1000
identity = 0
role_id = "${var.license_signer_role}"
}
}