Skip to content

Commit

Permalink
fix:
Browse files Browse the repository at this point in the history
update contributor as well as sponsor address for the compromised wallet from CPSTreasury
  • Loading branch information
sdpisreddevil committed Jan 25, 2024
1 parent b6bf2e5 commit f0847ca
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ public void updateNewProjects(String oldHash, String newHash, int milestoneCount

@Override
@External
public void update_contributor_sponsor_address(String _ipfs_key, Address _new_contributor_address,
public void updateContributorSponsorAddress(String _ipfs_key, Address _new_contributor_address,
Address _new_sponsor_address) {
validateCpsScore();
Context.require(proposalExists(_ipfs_key), TAG + ": This project not exists");
Expand All @@ -614,18 +614,18 @@ public void update_contributor_sponsor_address(String _ipfs_key, Address _new_co
Address sponsorAddress = (Address) proposalData.get(consts.SPONSOR_ADDRESS);

// remove
contributorProjects.at(_new_contributor_address.toString()).add(_ipfs_key);
ArrayDBUtils.remove_array_item_string(contributorProjects.at(contributorAddress.toString()), _ipfs_key);
contributorProjects.at(_new_contributor_address.toString()).add(_ipfs_key);

// update contributor address
setContributorAddress(prefix, _new_contributor_address);

// remove
sponsorProjects.at(_new_sponsor_address.toString()).add(_ipfs_key);
ArrayDBUtils.remove_array_item_string(sponsorProjects.at(sponsorAddress.toString()),_ipfs_key);
sponsorProjects.at(_new_sponsor_address.toString()).add(_ipfs_key);

// update sponsor address
this.sponsorAddress.at(prefix).set(_new_sponsor_address);
setSponsorAddress(prefix, _new_sponsor_address);
}

public <T> T callScore(Class<T> t, Address address, String method, Object... params) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package community.icon.cps.score.cpstreasury.db;

import score.*;
import community.icon.cps.score.cpstreasury.utils.consts;
import score.Address;
import score.BranchDB;
import score.Context;
import score.VarDB;

import java.math.BigInteger;
import java.util.Map;
Expand Down Expand Up @@ -150,4 +153,7 @@ public String getToken(String prefix){
public void setContributorAddress(String prefix, Address newContributorAddress){
this.contributorAddress.at(prefix).set(newContributorAddress);
}
public void setSponsorAddress(String prefix, Address newSponsorAddress){
this.sponsorAddress.at(prefix).set(newSponsorAddress);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void updateProposalFund(String ipfsKey, BigInteger addedBudget, BigInteger added
BigInteger getOnsetPayment();

@External
void update_contributor_sponsor_address(String _ipfs_key, Address _new_contributor_address,
void updateContributorSponsorAddress(String _ipfs_key, Address _new_contributor_address,
Address _new_sponsor_address);

@EventLog(indexed = 1)
Expand Down

0 comments on commit f0847ca

Please sign in to comment.