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

Remove legacy code for rewards #403

Merged
merged 9 commits into from
Aug 14, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public class GovernanceConstants extends Constants {
);

public static Map<String, String> ADMIN_ADDRESSES = Map.ofEntries(
entry("rewards", "governance"),
entry("baln", "rewards"),
entry("bwt", "governance")
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import static network.balanced.score.core.governance.GovernanceImpl.*;
import static network.balanced.score.core.governance.utils.GovernanceConstants.*;
import static network.balanced.score.lib.utils.Constants.EXA;
import static network.balanced.score.lib.utils.Math.pow;

public class SetupManager {
Expand Down Expand Up @@ -75,12 +76,16 @@ public static void launchBalanced() {
_setTimeOffset(timeDelta);

for (Map<String, String> source : DATA_SOURCES) {
call(ContractManager.getAddress(Names.REWARDS), "addNewDataSource", source.get("name"),
ContractManager.get(source.get("address")));
call(ContractManager.getAddress(Names.REWARDS), "createDataSource", source.get("name"),
ContractManager.get(source.get("address")), 0);
}

call(ContractManager.getAddress(Names.REWARDS), "updateBalTokenDistPercentage", (Object) RECIPIENTS);
}
call(ContractManager.getAddress(Names.REWARDS), "setPlatformDistPercentage", Names.DAOFUND, BigInteger.valueOf(5).multiply(pow(BigInteger.TEN, 16)));
call(ContractManager.getAddress(Names.REWARDS), "setPlatformDistPercentage", Names.RESERVE, BigInteger.valueOf(5).multiply(pow(BigInteger.TEN, 16)));
call(ContractManager.getAddress(Names.REWARDS), "setPlatformDistPercentage", Names.WORKERTOKEN, BigInteger.valueOf(20).multiply(pow(BigInteger.TEN, 16)));
call(ContractManager.getAddress(Names.REWARDS), "setFixedSourcePercentage", "Loans", BigInteger.valueOf(20).multiply(pow(BigInteger.TEN, 16)));
call(ContractManager.getAddress(Names.REWARDS), "setFixedSourcePercentage", "sICX/ICX", BigInteger.TEN.multiply(pow(BigInteger.TEN, 16)));
};

public static void createBnusdMarket() {
BigInteger value = Context.getValue();
Expand Down Expand Up @@ -115,16 +120,9 @@ public static void createBnusdMarket() {

_addLPDataSource(name, pid);

DistributionPercentage[] recipients = new DistributionPercentage[]{
createDistributionPercentage("Loans", BigInteger.valueOf(25).multiply(pow(BigInteger.TEN, 16))),
createDistributionPercentage("sICX/ICX", BigInteger.TEN.multiply(pow(BigInteger.TEN, 16))),
createDistributionPercentage("Worker Tokens", BigInteger.valueOf(20).multiply(pow(BigInteger.TEN, 16))),
createDistributionPercentage("Reserve Fund", BigInteger.valueOf(5).multiply(pow(BigInteger.TEN, 16))),
createDistributionPercentage("DAOfund", BigInteger.valueOf(225).multiply(pow(BigInteger.TEN, 15))),
createDistributionPercentage("sICX/bnUSD", BigInteger.valueOf(175).multiply(pow(BigInteger.TEN, 15)))
};
call(ContractManager.getAddress(Names.REWARDS), "setFixedSourcePercentage", "sICX/bnUSD", BigInteger.valueOf(15).multiply(pow(BigInteger.TEN, 16)));


call(ContractManager.getAddress(Names.REWARDS), "updateBalTokenDistPercentage", (Object) recipients);
}

public static void createBalnMarket(BigInteger _bnUSD_amount, BigInteger _baln_amount) {
Expand All @@ -149,18 +147,7 @@ public static void createBalnMarket(BigInteger _bnUSD_amount, BigInteger _baln_a
call(dexAddress, "setMarketName", pid, name);

_addLPDataSource(name, pid);

DistributionPercentage[] recipients = new DistributionPercentage[]{
createDistributionPercentage("Loans", BigInteger.valueOf(25).multiply(pow(BigInteger.TEN, 16))),
createDistributionPercentage("sICX/ICX", BigInteger.TEN.multiply(pow(BigInteger.TEN, 16))),
createDistributionPercentage("Worker Tokens", BigInteger.valueOf(20).multiply(pow(BigInteger.TEN, 16))),
createDistributionPercentage("Reserve Fund", BigInteger.valueOf(5).multiply(pow(BigInteger.TEN, 16))),
createDistributionPercentage("DAOfund", BigInteger.valueOf(5).multiply(pow(BigInteger.TEN, 16))),
createDistributionPercentage("sICX/bnUSD", BigInteger.valueOf(175).multiply(pow(BigInteger.TEN, 15))),
createDistributionPercentage("BALN/bnUSD", BigInteger.valueOf(175).multiply(pow(BigInteger.TEN, 15)))
};

call(rewardsAddress, "updateBalTokenDistPercentage", (Object) recipients);
call(ContractManager.getAddress(Names.REWARDS), "setFixedSourcePercentage", "BALN/bnUSD", BigInteger.valueOf(15).multiply(pow(BigInteger.TEN, 16)));
}

public static void createBalnSicxMarket(BigInteger _sicx_amount, BigInteger _baln_amount) {
Expand All @@ -184,23 +171,13 @@ public static void createBalnSicxMarket(BigInteger _sicx_amount, BigInteger _bal

_addLPDataSource(name, pid);

DistributionPercentage[] recipients = new DistributionPercentage[]{
createDistributionPercentage("Loans", BigInteger.valueOf(20).multiply(pow(BigInteger.TEN, 16))),
createDistributionPercentage("sICX/ICX", BigInteger.TEN.multiply(pow(BigInteger.TEN, 16))),
createDistributionPercentage("Worker Tokens", BigInteger.valueOf(20).multiply(pow(BigInteger.TEN, 16))),
createDistributionPercentage("Reserve Fund", BigInteger.valueOf(5).multiply(pow(BigInteger.TEN, 16))),
createDistributionPercentage("DAOfund", BigInteger.valueOf(5).multiply(pow(BigInteger.TEN, 16))),
createDistributionPercentage("sICX/bnUSD", BigInteger.valueOf(15).multiply(pow(BigInteger.TEN, 16))),
createDistributionPercentage("BALN/bnUSD", BigInteger.valueOf(15).multiply(pow(BigInteger.TEN, 16))),
createDistributionPercentage("BALN/sICX", BigInteger.valueOf(10).multiply(pow(BigInteger.TEN, 16)))
};
call(ContractManager.getAddress(Names.REWARDS), "setFixedSourcePercentage", "BALN/sICX", BigInteger.valueOf(10).multiply(pow(BigInteger.TEN, 16)));

call(ContractManager.getAddress(Names.REWARDS), "updateBalTokenDistPercentage", (Object) recipients);
}

private static void _addNewDataSource(String _data_source_name, String _contract_address) {
Context.call(ContractManager.getAddress(Names.REWARDS), "addNewDataSource", _data_source_name,
Address.fromString(_contract_address));
Context.call(ContractManager.getAddress(Names.REWARDS), "createDataSource", _data_source_name,
Address.fromString(_contract_address), 0);
}

private static void _addLPDataSource(String _name, BigInteger _poolId) {
Expand Down
Loading