diff --git a/core-contracts/Dex/src/main/java/network/balanced/score/core/dex/AbstractDex.java b/core-contracts/Dex/src/main/java/network/balanced/score/core/dex/AbstractDex.java index eefdbf0e6..59467f03d 100644 --- a/core-contracts/Dex/src/main/java/network/balanced/score/core/dex/AbstractDex.java +++ b/core-contracts/Dex/src/main/java/network/balanced/score/core/dex/AbstractDex.java @@ -644,6 +644,19 @@ public void govWithdraw(int id, Address token, BigInteger value) { Context.call(token, "transfer", getDaofund(), value); } + @External + public void governanceBorrow(Address token, BigInteger amount, Address recipient) { + onlyGovernance(); + BigInteger currentDebt = governanceDebt.getOrDefault(token, BigInteger.ZERO); + governanceDebt.set(token, currentDebt.add(amount)); + Context.call(token, "transfer", recipient, amount); + } + + @External(readonly=true) + public BigInteger getGovernanceDebt(Address token) { + return governanceDebt.getOrDefault(token, BigInteger.ZERO); + } + @External public void govSetPoolTotal(int pid, BigInteger total) { onlyGovernance(); diff --git a/core-contracts/Dex/src/main/java/network/balanced/score/core/dex/DexDBVariables.java b/core-contracts/Dex/src/main/java/network/balanced/score/core/dex/DexDBVariables.java index 97c8e40af..78aed6a20 100644 --- a/core-contracts/Dex/src/main/java/network/balanced/score/core/dex/DexDBVariables.java +++ b/core-contracts/Dex/src/main/java/network/balanced/score/core/dex/DexDBVariables.java @@ -58,6 +58,7 @@ public class DexDBVariables { private static final String TOKEN_PRECISIONS = "token_precisions"; public static final String VERSION = "version"; public static final String ORACLE_PROTECTION = "oracle_protection"; + public static final String GOV_DEBT = "governance_debt"; final static VarDB
governance = Context.newVarDB(GOVERNANCE_ADDRESS, Address.class); @@ -137,4 +138,8 @@ public class DexDBVariables { //Map: pid -> percentage public final static DictDB