Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions solidity/contracts/Constants.sol
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: UNICENSE
pragma solidity 0.8.30;

library Constants {
Expand Down
6 changes: 0 additions & 6 deletions solidity/contracts/IZoltar.sol

This file was deleted.

12 changes: 6 additions & 6 deletions solidity/contracts/ReputationToken.sol
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
// SPDX-License-Identifier: UNICENSE
pragma solidity 0.8.30;

import './ERC20.sol';
import './IZoltar.sol';

contract ReputationToken is ERC20 {

IZoltar public zoltar;
address public zoltar;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be immutable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requires some trickery to get it as zoltar depends on it


constructor() ERC20('Reputation', 'REP') {
zoltar = IZoltar(msg.sender);
constructor(address _zoltar) ERC20('Reputation', 'REP') {
zoltar = _zoltar;
}

function mint(address account, uint256 value) external {
require(msg.sender == address(zoltar), "Not zoltar");
require(msg.sender == zoltar, "Not zoltar");
_mint(account, value);
}

function burn(address account, uint256 value) external {
require(msg.sender == address(zoltar), "Not zoltar");
require(msg.sender == zoltar, "Not zoltar");
_burn(account, value);
}
}
13 changes: 4 additions & 9 deletions solidity/contracts/Zoltar.sol
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
// SPDX-License-Identifier: UNICENSE
pragma solidity 0.8.30;

import './Constants.sol';
import './IZoltar.sol';
import './ReputationToken.sol';
import './IERC20.sol';

contract Zoltar {

struct Universe {
IERC20 reputationToken;
ReputationToken reputationToken;
uint56 forkingQuestion;
uint256 forkTime;
}
Expand Down Expand Up @@ -51,7 +50,7 @@ contract Zoltar {

constructor() {
universes[0] = Universe(
IERC20(Constants.GENESIS_REPUTATION_TOKEN),
ReputationToken(Constants.GENESIS_REPUTATION_TOKEN),
0,
0
);
Expand Down Expand Up @@ -161,11 +160,7 @@ contract Zoltar {

for (uint8 i = 1; i < Constants.NUM_OUTCOMES + 1; i++) {
uint192 childUniverseId = (_universeId << 2) + i;
universes[childUniverseId] = Universe(
new ReputationToken(),
0,
0
);
universes[childUniverseId] = Universe(new ReputationToken{ salt: bytes32(uint256(childUniverseId)) }(address(this)), 0, 0);

questionResolutions[childUniverseId][_questionId].reportTime = 1;
questionResolutions[childUniverseId][_questionId].outcome = Outcome(i - 1);
Expand Down