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

Update DigitalSecretary.sol #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
56 changes: 39 additions & 17 deletions DigitalSecretary.sol
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,14 @@ contract DigitalSecretary is SecretaryRole {
address public feeTokenAddress; // fee token address for paying filing and other administration fees / default testnet: "0x8ad3aa5d5ff084307d28c8f514d7a193b2bfe725"
address public secretary; // administrator of digital secretary contract
address public treasuryAddress; // receives filing and other administrative fees generated by digital secretary
uint256 public changeFee; // fee charged for any changes

mapping (uint256 => Entity) public entities; // mapping registered entities to filing numbers
mapping (address => Entity) public entities; // mapping registered entities to filing numbers

event entityRegistered(uint256 fileNumber, uint256 filingDate, string entityName, uint8 entityKind, bool domestic);

struct Entity {
address _address; // eth address of organization
uint256 fileNumber; // latest successful registration function call
uint256 filingDate; // blocktime of successful registration function call
string entityName; // Full Legal Name / e.g., "ACME LLC"
Expand All @@ -331,6 +333,7 @@ contract DigitalSecretary is SecretaryRole {
string filingDetails; // could be IPFS hash, plaintext, or JSON detailing articles or certificate of incorporation
uint256 feesPaid; // running tally of fees paid to digital secretary by registered entity
bool goodStanding; // default "true" on successful registration function call
bool annualFee; // default "false" turns "true" when entity pays annual filing fee
}

// compare: Delaware resource: https://icis.corp.delaware.gov/Ecorp/FieldDesc.aspx#ENTITY%20TYPE
Expand Down Expand Up @@ -361,11 +364,12 @@ contract DigitalSecretary is SecretaryRole {
/**
* @dev Sets the initial values for `filingFeeAmount`, `feeTokenAddress`, `treasuryAddress`.
*/
constructor (uint256 _filingFeeAmount, address _feeTokenAddress, address _treasuryAddress) public {
constructor (uint256 _filingFeeAmount, address _feeTokenAddress, address _treasuryAddress, uint256 _changeFee) public {
filingFeeAmount = _filingFeeAmount;
feeTokenAddress = _feeTokenAddress;
secretary = msg.sender;
treasuryAddress = _treasuryAddress;
changeFee = _changeFee;
}

// public function to register entity with digital secretary
Expand All @@ -384,14 +388,17 @@ contract DigitalSecretary is SecretaryRole {
Kind(entityKind);
Type(entityType);

address _address = msg.sender;
uint256 fileNumber = entityFilings.add(1); // tallies from running total
uint256 filingDate = block.timestamp; // "now"
uint256 feesPaid = filingFeeAmount; // pushes fee amount to entity tally
bool goodStanding = true; // default value for new entity
bool annualFee = false; // default value for new entity, can be updated with function "annualFee"

entityFilings = entityFilings.add(1); // tallies new filing to running total

entities[fileNumber] = Entity(
entities[_address] = Entity(
_address,
fileNumber,
filingDate,
entityName,
Expand All @@ -401,7 +408,8 @@ contract DigitalSecretary is SecretaryRole {
registeredAgentdetails,
filingDetails,
feesPaid,
goodStanding);
goodStanding,
annualFee);

emit entityRegistered(fileNumber, filingDate, entityName, entityKind, domestic);
}
Expand All @@ -428,38 +436,52 @@ contract DigitalSecretary is SecretaryRole {
ENTITY MGMT
***************/
// digital secretary can update entity name
function updateEntityName(uint256 fileNumber, string memory newName) public onlySecretary {
Entity storage entity = entities[fileNumber];
function updateEntityName(string memory newName) public payable {
require(msg.value == changeFee);
Entity storage entity = entities[msg.sender];
entity.entityName = newName;
}

// digital secretary can update registered agent details
function updateRegisteredAgent(uint256 fileNumber, string memory registeredAgentdetails) public onlySecretary {
Entity storage entity = entities[fileNumber];
function updateRegisteredAgent(string memory registeredAgentdetails) public payable {
require(msg.value == changeFee);
Entity storage entity = entities[msg.sender];
entity.registeredAgentdetails = registeredAgentdetails;
}

// digital secretary can convert entity kind
function convertEntityKind(uint256 fileNumber, uint8 newKind) public onlySecretary {
Entity storage entity = entities[fileNumber];
function convertEntityKind(uint8 newKind) public payable {
require(msg.value == changeFee);
Entity storage entity = entities[msg.sender];
entity.entityKind = newKind;
}

// digital secretary can convert entity type
function convertEntityType(uint256 fileNumber, uint8 newType) public onlySecretary {
Entity storage entity = entities[fileNumber];
// digital secretary can convert entity type
function convertEntityType(uint8 newType) public payable {
require(msg.value == changeFee);
Entity storage entity = entities[msg.sender];
entity.entityType = newType;
}

// digital secretary can convert entity domicile
function convertEntityDomicile(uint256 fileNumber, bool domestic) public onlySecretary {
Entity storage entity = entities[fileNumber];
function convertEntityDomicile(bool domestic) public payable {
require(msg.value == changeFee);
Entity storage entity = entities[msg.sender];
entity.domestic = domestic;
}

// digital secretary can convert entity standing
function convertEntityStanding(uint256 fileNumber, bool goodStanding) public onlySecretary {
Entity storage entity = entities[fileNumber];
function convertEntityStanding(address entityAddress, bool goodStanding) public onlySecretary {
Entity storage entity = entities[entityAddress];
entity.goodStanding = goodStanding;
}

// pay filing fee and update annualFee
function payAnnualFee() public payable {
require(msg.value == filingFeeAmount);
Entity storage entity = entities[msg.sender];
entity.annualFee == true;
}
}