Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonAndell committed Dec 5, 2024
1 parent 094861e commit 08fc732
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 608 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,36 +33,11 @@

@ScoreClient
@ScoreInterface
public interface BalancedToken extends HubToken, IRC2BurnableInterface, GovernanceAddress, AdminAddress,
BnusdAddress, OracleAddress, DexAddress, DividendsAddress, Version {

@External
void setOracleName(String _name);

@External(readonly = true)
String getOracleName();
public interface BalancedToken extends HubToken, IRC2BurnableInterface, Version {

@External(readonly = true)
String getPeg();

@External
void setMinInterval(BigInteger _interval);

@External(readonly = true)
BigInteger getMinInterval();

@External(readonly = true)
BigInteger getPriceUpdateTime();

@External
BigInteger priceInLoop();

@External(readonly = true)
BigInteger lastPriceInLoop();

@External(readonly = true)
Map<String, BigInteger> detailsBalanceOf(Address _owner);

@External(readonly = true)
BigInteger unstakedBalanceOf(Address _owner);

Expand All @@ -72,54 +47,9 @@ public interface BalancedToken extends HubToken, IRC2BurnableInterface, Governan
@External(readonly = true)
BigInteger availableBalanceOf(Address _owner);

@External(readonly = true)
boolean getStakingEnabled();

@External(readonly = true)
BigInteger totalStakedBalance();

@External(readonly = true)
BigInteger getMinimumStake();

@External(readonly = true)
BigInteger getUnstakingPeriod();

@External
void toggleEnableSnapshot();

@External(readonly = true)
boolean getSnapshotEnabled();

@External
void toggleStakingEnabled();

@External
void stake(BigInteger _value);

@External
void setMinimumStake(BigInteger _amount);

@External
void setUnstakingPeriod(BigInteger _time);

@External
void setTimeOffset();

@External(readonly = true)
BigInteger getTimeOffset();

@External(readonly = true)
BigInteger getDay();

@External(readonly = true)
BigInteger stakedBalanceOfAt(Address _account, BigInteger _day);

@External(readonly = true)
BigInteger totalStakedBalanceOfAt(BigInteger _day);

@EventLog(indexed = 3)
void OraclePrice(String market, String oracle_name, Address oracle_address, BigInteger price);

@External
void setMinter(Address _address);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package network.balanced.score.lib.utils;

public class Versions {
public final static String BALN = "v1.1.0";
public final static String BALN = "v1.1.2";
public final static String DIVIDENDS = "v1.0.0";
public final static String LOANS = "v1.2.3";
public final static String RESERVE = "v1.0.0";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,24 @@ public class Balanced {

public Balanced() throws Exception {
balancedClients = new HashMap<>();
owner = createWalletWithBalance(BigInteger.TEN.pow(25));
// owner = createWalletWithBalance(BigInteger.TEN.pow(25));
}

private static final char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray();
public static String bytesToHex(byte[] bytes) {
char[] hexChars = new char[bytes.length * 2];
for (int j = 0; j < bytes.length; j++) {
int v = bytes[j] & 0xFF;
hexChars[j * 2] = HEX_ARRAY[v >>> 4];
hexChars[j * 2 + 1] = HEX_ARRAY[v & 0x0F];
}
return new String(hexChars);
}


public void setupBalanced() throws Exception {
System.out.println(bytesToHex(getContractData("BalancedToken")));
int i = 1/0;
registerPreps();
deployContracts();
setupAddresses();
Expand Down
Loading

0 comments on commit 08fc732

Please sign in to comment.