Skip to content

Commit

Permalink
ERC20 -> GovernERC20
Browse files Browse the repository at this point in the history
  • Loading branch information
Corantin committed May 14, 2022
1 parent 0c6c3d9 commit 458b1e5
Show file tree
Hide file tree
Showing 23 changed files with 1,660 additions and 335 deletions.
20 changes: 10 additions & 10 deletions packages/hardhat/contracts/mocks/OwnableCelesteMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pragma solidity ^0.5.8;
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
contract GovernERC20 {
function totalSupply() public view returns (uint256);

function balanceOf(address _who) public view returns (uint256);
Expand Down Expand Up @@ -94,7 +94,7 @@ interface IArbitrator {
view
returns (
address recipient,
ERC20 feeToken,
GovernERC20 feeToken,
uint256 feeAmount
);
}
Expand All @@ -106,7 +106,7 @@ interface IArbitrator {

pragma solidity ^0.5.8;

library SafeERC20 {
library SafeGovernERC20 {
// Before 0.5, solidity has a mismatch between `address.transfer()` and `token.transfer()`:
// https://github.com/ethereum/solidity/issues/3544
bytes4 private constant TRANSFER_SELECTOR = 0xa9059cbb;
Expand All @@ -116,7 +116,7 @@ library SafeERC20 {
* Note that this makes an external call to the token.
*/
function safeTransfer(
ERC20 _token,
GovernERC20 _token,
address _to,
uint256 _amount
) internal returns (bool) {
Expand All @@ -133,7 +133,7 @@ library SafeERC20 {
* Note that this makes an external call to the token.
*/
function safeTransferFrom(
ERC20 _token,
GovernERC20 _token,
address _from,
address _to,
uint256 _amount
Expand All @@ -152,7 +152,7 @@ library SafeERC20 {
* Note that this makes an external call to the token.
*/
function safeApprove(
ERC20 _token,
GovernERC20 _token,
address _spender,
uint256 _amount
) internal returns (bool) {
Expand Down Expand Up @@ -210,7 +210,7 @@ library SafeERC20 {
pragma solidity ^0.5.8;

contract OwnableCeleste is IArbitrator {
using SafeERC20 for ERC20;
using SafeGovernERC20 for GovernERC20;

// Note that Aragon Court treats the possible outcomes as arbitrary numbers, leaving the Arbitrable (us) to define how to understand them.
// Some outcomes [0, 1, and 2] are reserved by Aragon Court: "missing", "leaked", and "refused", respectively.
Expand All @@ -233,7 +233,7 @@ contract OwnableCeleste is IArbitrator {
State state;
}

ERC20 public feeToken;
GovernERC20 public feeToken;
uint256 public feeAmount;
uint256 public currentId;
address public owner;
Expand All @@ -244,7 +244,7 @@ contract OwnableCeleste is IArbitrator {
_;
}

constructor(ERC20 _feeToken, uint256 _feeAmount) public {
constructor(GovernERC20 _feeToken, uint256 _feeAmount) public {
owner = msg.sender;
feeToken = _feeToken;
feeAmount = _feeAmount;
Expand Down Expand Up @@ -342,7 +342,7 @@ contract OwnableCeleste is IArbitrator {
view
returns (
address,
ERC20,
GovernERC20,
uint256
)
{
Expand Down
3 changes: 1 addition & 2 deletions packages/hardhat/default-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@
"rinkeby": 300,
"xdai": 604800
},
"IArbitratorCelesteAddress": {
"rinkeby": "0xdd58ebed3c36460939285a92807f90e3d3a26789",
"CelesteResolver": {
"xdai": "TODO"
}
}
13 changes: 7 additions & 6 deletions packages/hardhat/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { config as dotenvConfig } from "dotenv";
import "solidity-coverage";
import "hardhat-deploy";
import { BigNumber, utils } from "ethers";
import { utils } from "ethers";
import fs from "fs";
import chalk from "chalk";
import "@nomiclabs/hardhat-waffle";
Expand All @@ -24,6 +24,7 @@ import governGnosis from "./deployments/xdai/Govern.json";
import defaultConfig from "./default-config.json";
import exportContractResult from "./scripts/export-contract-result";
import GovernQueueAbi from "./abi/contracts/Externals/GovernQueue.json";
import CelesteMock from "./deployments/rinkeby/OwnableCeleste.json";

dotenvConfig({ path: resolve(__dirname, "../../local.env") });

Expand Down Expand Up @@ -599,7 +600,7 @@ task("generateGovernQueueConfig:gnosis")
.addOptionalParam(
"resolver",
"Address of Celeste(IArbitrator)",
defaultConfig.IArbitratorCelesteAddress.xdai
defaultConfig.CelesteResolver.xdai
)
.addOptionalParam(
"rules",
Expand Down Expand Up @@ -650,7 +651,7 @@ task("generateGovernQueueConfig:rinkeby")
.addOptionalParam(
"resolver",
"Address of Celeste(IArbitrator)",
defaultConfig.IArbitratorCelesteAddress.rinkeby
CelesteMock.address
)
.addOptionalParam(
"rules",
Expand Down Expand Up @@ -693,7 +694,7 @@ task("newGovernQueue:gnosis")
.addOptionalParam(
"resolver",
"Address of Celeste(IArbitrator)",
defaultConfig.IArbitratorCelesteAddress.xdai
defaultConfig.CelesteResolver.xdai
)
.addOptionalParam(
"executionDelay",
Expand Down Expand Up @@ -736,7 +737,7 @@ task("newGovernQueue:rinkeby")
.addOptionalParam(
"resolver",
"Address of Celeste(IArbitrator)",
defaultConfig.IArbitratorCelesteAddress.rinkeby
CelesteMock.address
)
.addOptionalParam(
"executionDelay",
Expand Down Expand Up @@ -1033,7 +1034,7 @@ task("deployCeleste:rinkeby")
console.log("Verifying OwnableCeleste...");
await new Promise((res, rej) => {
setTimeout(
() =>
() =>
run("verify:verify", {
address: result.address,
constructorArguments,
Expand Down
94 changes: 71 additions & 23 deletions packages/hardhat/typechain/DepositLib.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,31 @@ import {
BigNumberish,
PopulatedTransaction,
} from "ethers";
import { Contract, ContractTransaction } from "@ethersproject/contracts";
import {
Contract,
ContractTransaction,
CallOverrides,
} from "@ethersproject/contracts";
import { BytesLike } from "@ethersproject/bytes";
import { Listener, Provider } from "@ethersproject/providers";
import { FunctionFragment, EventFragment, Result } from "@ethersproject/abi";

interface DepositLibInterface extends ethers.utils.Interface {
functions: {};

events: {
"DepositLock(address,address,uint256)": EventFragment;
"DepositUnlock(address,address,uint256)": EventFragment;
functions: {
"c_0x94360f43(bytes32)": FunctionFragment;
};

getEvent(nameOrSignatureOrTopic: "DepositLock"): EventFragment;
getEvent(nameOrSignatureOrTopic: "DepositUnlock"): EventFragment;
encodeFunctionData(
functionFragment: "c_0x94360f43",
values: [BytesLike]
): string;

decodeFunctionResult(
functionFragment: "c_0x94360f43",
data: BytesLike
): Result;

events: {};
}

export class DepositLib extends Contract {
Expand All @@ -40,25 +50,63 @@ export class DepositLib extends Contract {

interface: DepositLibInterface;

functions: {};
functions: {
c_0x94360f43(
c__0x94360f43: BytesLike,
overrides?: CallOverrides
): Promise<[void]>;

"c_0x94360f43(bytes32)"(
c__0x94360f43: BytesLike,
overrides?: CallOverrides
): Promise<[void]>;
};

c_0x94360f43(
c__0x94360f43: BytesLike,
overrides?: CallOverrides
): Promise<void>;

"c_0x94360f43(bytes32)"(
c__0x94360f43: BytesLike,
overrides?: CallOverrides
): Promise<void>;

callStatic: {
c_0x94360f43(
c__0x94360f43: BytesLike,
overrides?: CallOverrides
): Promise<void>;

callStatic: {};
"c_0x94360f43(bytes32)"(
c__0x94360f43: BytesLike,
overrides?: CallOverrides
): Promise<void>;
};

filters: {};

filters: {
DepositLock(
token: string | null,
from: string | null,
amount: null
): EventFilter;
estimateGas: {
c_0x94360f43(
c__0x94360f43: BytesLike,
overrides?: CallOverrides
): Promise<BigNumber>;

DepositUnlock(
token: string | null,
to: string | null,
amount: null
): EventFilter;
"c_0x94360f43(bytes32)"(
c__0x94360f43: BytesLike,
overrides?: CallOverrides
): Promise<BigNumber>;
};

estimateGas: {};
populateTransaction: {
c_0x94360f43(
c__0x94360f43: BytesLike,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;

populateTransaction: {};
"c_0x94360f43(bytes32)"(
c__0x94360f43: BytesLike,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
};
}
Loading

0 comments on commit 458b1e5

Please sign in to comment.