Add Pons native contract for inter-government bridge protocol
Implement comprehensive cross-border cooperation infrastructure: - Bilateral Agreements: Government-to-government treaties - Committee-managed agreement lifecycle - Types: Trade, Identity, Education, Health, Settlement, Comprehensive - Active/Suspended/Terminated status tracking - Cross-Border Verification: Identity and credential validation - Request identity verification from partner governments - Verification types: Identity, Credential, Health, Employment - Pending/Verified/Rejected/Expired status management - International Settlement: Cross-border VTS transactions - Settlement requests between sovereign chains - Fee calculation with configurable default (0.5%) - Complete transaction tracking with proofs - Credential Sharing: Portable education and health records - Share Scire (education) and Salus (health) credentials - Configurable validity periods - Revocation support for outdated credentials - Cross-contract integration: - Vita: Identity verification for requests - Federation: Complement intra-chain coordination - RoleRegistry: RoleBridgeOperator (ID 27) - VTS: Settlement payments - Scire/Salus: Credential verification Latin naming: Pons = "bridge" - reflecting the contract's purpose of connecting sovereign government blockchain instances. Contract ID: -24 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
1fdf29e5e9
commit
3a6ee2492e
|
|
@ -634,6 +634,16 @@ func NewDefaultContracts(cfg config.ProtocolConfiguration) []interop.Contract {
|
||||||
palam.RoleRegistry = roleRegistry
|
palam.RoleRegistry = roleRegistry
|
||||||
palam.Lex = lex
|
palam.Lex = lex
|
||||||
|
|
||||||
|
// Create Pons (Inter-Government Bridge) contract
|
||||||
|
pons := newPons()
|
||||||
|
pons.NEO = neo
|
||||||
|
pons.Vita = vita
|
||||||
|
pons.Federation = federation
|
||||||
|
pons.RoleRegistry = roleRegistry
|
||||||
|
pons.VTS = vts
|
||||||
|
pons.Scire = scire
|
||||||
|
pons.Salus = salus
|
||||||
|
|
||||||
return []interop.Contract{
|
return []interop.Contract{
|
||||||
mgmt,
|
mgmt,
|
||||||
s,
|
s,
|
||||||
|
|
@ -658,5 +668,6 @@ func NewDefaultContracts(cfg config.ProtocolConfiguration) []interop.Contract {
|
||||||
tribute,
|
tribute,
|
||||||
opus,
|
opus,
|
||||||
palam,
|
palam,
|
||||||
|
pons,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -55,4 +55,6 @@ var (
|
||||||
Opus = util.Uint160{0xf5, 0x22, 0x73, 0x17, 0x98, 0xab, 0xfc, 0x4d, 0x7c, 0x3a, 0x51, 0x8, 0x47, 0xc7, 0xe5, 0xe4, 0x6, 0x96, 0xb6, 0xfd}
|
Opus = util.Uint160{0xf5, 0x22, 0x73, 0x17, 0x98, 0xab, 0xfc, 0x4d, 0x7c, 0x3a, 0x51, 0x8, 0x47, 0xc7, 0xe5, 0xe4, 0x6, 0x96, 0xb6, 0xfd}
|
||||||
// Palam is a hash of native Palam contract.
|
// Palam is a hash of native Palam contract.
|
||||||
Palam = util.Uint160{0x3, 0x23, 0x73, 0xfa, 0x71, 0x3a, 0x34, 0xab, 0x8d, 0x8c, 0xfa, 0xe2, 0xb0, 0x46, 0xdf, 0x53, 0x88, 0x79, 0x16, 0xae}
|
Palam = util.Uint160{0x3, 0x23, 0x73, 0xfa, 0x71, 0x3a, 0x34, 0xab, 0x8d, 0x8c, 0xfa, 0xe2, 0xb0, 0x46, 0xdf, 0x53, 0x88, 0x79, 0x16, 0xae}
|
||||||
|
// Pons is a hash of native Pons contract.
|
||||||
|
Pons = util.Uint160{0x58, 0x39, 0xd0, 0x19, 0xa5, 0xb8, 0x8c, 0x92, 0x3f, 0x9a, 0x80, 0x2b, 0x53, 0xa7, 0xc7, 0x7c, 0x35, 0x81, 0xdd, 0xcc}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -53,4 +53,6 @@ const (
|
||||||
Opus int32 = -22
|
Opus int32 = -22
|
||||||
// Palam is an ID of native Palam contract.
|
// Palam is an ID of native Palam contract.
|
||||||
Palam int32 = -23
|
Palam int32 = -23
|
||||||
|
// Pons is an ID of native Pons contract.
|
||||||
|
Pons int32 = -24
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ const (
|
||||||
Tribute = "Tribute"
|
Tribute = "Tribute"
|
||||||
Opus = "Opus"
|
Opus = "Opus"
|
||||||
Palam = "Palam"
|
Palam = "Palam"
|
||||||
|
Pons = "Pons"
|
||||||
)
|
)
|
||||||
|
|
||||||
// All contains the list of all native contract names ordered by the contract ID.
|
// All contains the list of all native contract names ordered by the contract ID.
|
||||||
|
|
@ -52,6 +53,7 @@ var All = []string{
|
||||||
Tribute,
|
Tribute,
|
||||||
Opus,
|
Opus,
|
||||||
Palam,
|
Palam,
|
||||||
|
Pons,
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsValid checks if the name is a valid native contract's name.
|
// IsValid checks if the name is a valid native contract's name.
|
||||||
|
|
@ -78,5 +80,6 @@ func IsValid(name string) bool {
|
||||||
name == Sese ||
|
name == Sese ||
|
||||||
name == Tribute ||
|
name == Tribute ||
|
||||||
name == Opus ||
|
name == Opus ||
|
||||||
name == Palam
|
name == Palam ||
|
||||||
|
name == Pons
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,130 @@
|
||||||
|
package state
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/tutus-one/tutus-chain/pkg/util"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AgreementStatus represents the status of a bilateral agreement.
|
||||||
|
type AgreementStatus uint8
|
||||||
|
|
||||||
|
// Agreement status constants.
|
||||||
|
const (
|
||||||
|
AgreementPending AgreementStatus = 0
|
||||||
|
AgreementActive AgreementStatus = 1
|
||||||
|
AgreementSuspended AgreementStatus = 2
|
||||||
|
AgreementTerminated AgreementStatus = 3
|
||||||
|
)
|
||||||
|
|
||||||
|
// AgreementType represents the type of bilateral agreement.
|
||||||
|
type AgreementType uint8
|
||||||
|
|
||||||
|
// Agreement type constants.
|
||||||
|
const (
|
||||||
|
AgreementTypeGeneral AgreementType = 0 // General cooperation
|
||||||
|
AgreementTypeIdentity AgreementType = 1 // Identity verification
|
||||||
|
AgreementTypeSettlement AgreementType = 2 // VTS settlement
|
||||||
|
AgreementTypeEducation AgreementType = 3 // Education credential sharing
|
||||||
|
AgreementTypeHealthcare AgreementType = 4 // Healthcare record sharing
|
||||||
|
AgreementTypeComprehensive AgreementType = 5 // All services
|
||||||
|
)
|
||||||
|
|
||||||
|
// VerificationStatus represents the status of a verification request.
|
||||||
|
type VerificationStatus uint8
|
||||||
|
|
||||||
|
// Verification status constants.
|
||||||
|
const (
|
||||||
|
VerificationPending VerificationStatus = 0
|
||||||
|
VerificationApproved VerificationStatus = 1
|
||||||
|
VerificationRejected VerificationStatus = 2
|
||||||
|
VerificationExpired VerificationStatus = 3
|
||||||
|
)
|
||||||
|
|
||||||
|
// VerificationType represents the type of verification request.
|
||||||
|
type VerificationType uint8
|
||||||
|
|
||||||
|
// Verification type constants.
|
||||||
|
const (
|
||||||
|
VerificationTypeIdentity VerificationType = 0 // Identity verification
|
||||||
|
VerificationTypeCredential VerificationType = 1 // Education credential
|
||||||
|
VerificationTypeHealth VerificationType = 2 // Healthcare record
|
||||||
|
VerificationTypeCertificate VerificationType = 3 // Professional certificate
|
||||||
|
)
|
||||||
|
|
||||||
|
// SettlementStatus represents the status of a settlement request.
|
||||||
|
type SettlementStatus uint8
|
||||||
|
|
||||||
|
// Settlement status constants.
|
||||||
|
const (
|
||||||
|
SettlementPending SettlementStatus = 0
|
||||||
|
SettlementCompleted SettlementStatus = 1
|
||||||
|
SettlementRejected SettlementStatus = 2
|
||||||
|
SettlementCancelled SettlementStatus = 3
|
||||||
|
)
|
||||||
|
|
||||||
|
// BilateralAgreement represents an agreement between two sovereign chains.
|
||||||
|
type BilateralAgreement struct {
|
||||||
|
ID uint64 // Unique agreement ID
|
||||||
|
LocalChainID uint32 // This chain's ID
|
||||||
|
RemoteChainID uint32 // Partner chain's ID
|
||||||
|
AgreementType AgreementType // Type of agreement
|
||||||
|
Status AgreementStatus
|
||||||
|
Terms util.Uint256 // Hash of off-chain terms document
|
||||||
|
EffectiveDate uint32 // Block height when effective
|
||||||
|
ExpirationDate uint32 // Block height when expires (0 = no expiry)
|
||||||
|
CreatedAt uint32 // Block height when created
|
||||||
|
UpdatedAt uint32 // Last update block height
|
||||||
|
}
|
||||||
|
|
||||||
|
// VerificationRequest represents a cross-border verification request.
|
||||||
|
type VerificationRequest struct {
|
||||||
|
ID uint64 // Unique request ID
|
||||||
|
RequestingChain uint32 // Chain requesting verification
|
||||||
|
TargetChain uint32 // Chain being queried
|
||||||
|
Subject util.Uint160 // Subject of verification
|
||||||
|
VerificationType VerificationType
|
||||||
|
DataHash util.Uint256 // Hash of requested data
|
||||||
|
Status VerificationStatus
|
||||||
|
ResponseHash util.Uint256 // Hash of response data (if any)
|
||||||
|
Requester util.Uint160 // Who initiated request
|
||||||
|
CreatedAt uint32 // Block height
|
||||||
|
ExpiresAt uint32 // Request expiry
|
||||||
|
RespondedAt uint32 // When responded (0 = pending)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SettlementRequest represents an international VTS settlement request.
|
||||||
|
type SettlementRequest struct {
|
||||||
|
ID uint64 // Unique request ID
|
||||||
|
FromChain uint32 // Originating chain
|
||||||
|
ToChain uint32 // Destination chain
|
||||||
|
Sender util.Uint160 // Sender on from chain
|
||||||
|
Receiver util.Uint160 // Receiver on to chain
|
||||||
|
Amount uint64 // VTS amount (in smallest units)
|
||||||
|
Reference string // Payment reference
|
||||||
|
Status SettlementStatus
|
||||||
|
CreatedAt uint32 // Block height
|
||||||
|
SettledAt uint32 // When settled (0 = pending)
|
||||||
|
TxHash util.Uint256 // Settlement transaction hash
|
||||||
|
}
|
||||||
|
|
||||||
|
// CredentialShare represents a shared credential between chains.
|
||||||
|
type CredentialShare struct {
|
||||||
|
ID uint64 // Unique share ID
|
||||||
|
SourceChain uint32 // Chain where credential originated
|
||||||
|
TargetChain uint32 // Chain receiving credential
|
||||||
|
Owner util.Uint160 // Credential owner
|
||||||
|
CredentialType VerificationType
|
||||||
|
CredentialID uint64 // Original credential ID on source chain
|
||||||
|
ContentHash util.Uint256 // Hash of credential content
|
||||||
|
ValidUntil uint32 // Validity period on target chain
|
||||||
|
CreatedAt uint32 // Block height
|
||||||
|
IsRevoked bool // Has been revoked
|
||||||
|
}
|
||||||
|
|
||||||
|
// PonsConfig represents configurable parameters for the Pons contract.
|
||||||
|
type PonsConfig struct {
|
||||||
|
LocalChainID uint32 // This chain's unique identifier
|
||||||
|
VerificationTimeout uint32 // Blocks until verification request expires
|
||||||
|
SettlementTimeout uint32 // Blocks until settlement request expires
|
||||||
|
MaxPendingRequests uint64 // Maximum pending requests per chain
|
||||||
|
CredentialShareExpiry uint32 // Default validity period for shared credentials
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue