Skip to content

Commit

Permalink
add/remove trainer and testing
Browse files Browse the repository at this point in the history
  • Loading branch information
yann300 committed Dec 14, 2023
1 parent be735b5 commit edd1a42
Show file tree
Hide file tree
Showing 8 changed files with 25,300 additions and 15,097 deletions.
17 changes: 16 additions & 1 deletion contracts/RemixRewardUpgradable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,19 @@ contract Remix is Initializable, ERC721Upgradeable, ERC721EnumerableUpgradeable,
string public zkChallengePayload;
bytes public zkChallengeHash;

mapping(address => uint) public trainers;

struct TokenData {
string payload;
string tokenType;
bytes hash;
}

modifier isTrainer() {
require(trainers[msg.sender] == 1, "Caller is not a trainer");
_;
}

/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {}

Expand Down Expand Up @@ -129,7 +136,15 @@ contract Remix is Initializable, ERC721Upgradeable, ERC721EnumerableUpgradeable,
tokensData[tokenId].hash = contributorHash;
}

function grantRemixersMinting (address[] calldata remixers, uint amount) public onlyRole(DEFAULT_ADMIN_ROLE) {
function addTrainer (address trainer) public onlyRole(DEFAULT_ADMIN_ROLE) {
trainers[trainer] = 1;
}

function removeTrainer (address trainer) public onlyRole(DEFAULT_ADMIN_ROLE) {
delete trainers[trainer];
}

function grantRemixersMinting (address[] calldata remixers, uint amount) public isTrainer() {
for (uint k = 0; k < remixers.length; k++) {
allowedMinting[remixers[k]] += amount;
}
Expand Down
14 changes: 7 additions & 7 deletions contracts/artifacts/Pairing.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,24 @@
"functionDebugData": {},
"generatedSources": [],
"linkReferences": {},
"object": "60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212203424c9cfd0d69a63ec038e806cc1f18a4c15697a0f4da59d2d79a4a1f2a494ab64736f6c63430008070033",
"opcodes": "PUSH1 0x56 PUSH1 0x37 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH1 0x0 BYTE PUSH1 0x73 EQ PUSH1 0x2A JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH1 0x0 MSTORE PUSH1 0x0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST ADDRESS PUSH1 0x0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 CALLVALUE 0x24 0xC9 0xCF 0xD0 0xD6 SWAP11 PUSH4 0xEC038E80 PUSH13 0xC1F18A4C15697A0F4DA59D2D79 LOG4 LOG1 CALLCODE LOG4 SWAP5 0xAB PUSH5 0x736F6C6343 STOP ADDMOD SMOD STOP CALLER ",
"object": "60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f80fdfea2646970667358221220ce6f0606c567908e8ecea65fc676cb30d37f1318b889949696be20675d9b73b864736f6c63430008160033",
"opcodes": "PUSH1 0x55 PUSH1 0x32 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH0 BYTE PUSH1 0x73 EQ PUSH1 0x26 JUMPI PUSH4 0x4E487B71 PUSH1 0xE0 SHL PUSH0 MSTORE PUSH0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH0 REVERT JUMPDEST ADDRESS PUSH0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xCE PUSH16 0x606C567908E8ECEA65FC676CB30D37F SGT XOR 0xB8 DUP10 SWAP5 SWAP7 SWAP7 0xBE KECCAK256 PUSH8 0x5D9B73B864736F6C PUSH4 0x43000816 STOP CALLER ",
"sourceMap": "1128:5104:0:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;1128:5104:0;;;;;;;;;;;;;;;;;"
},
"deployedBytecode": {
"functionDebugData": {},
"generatedSources": [],
"immutableReferences": {},
"linkReferences": {},
"object": "73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212203424c9cfd0d69a63ec038e806cc1f18a4c15697a0f4da59d2d79a4a1f2a494ab64736f6c63430008070033",
"opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 CALLVALUE 0x24 0xC9 0xCF 0xD0 0xD6 SWAP11 PUSH4 0xEC038E80 PUSH13 0xC1F18A4C15697A0F4DA59D2D79 LOG4 LOG1 CALLCODE LOG4 SWAP5 0xAB PUSH5 0x736F6C6343 STOP ADDMOD SMOD STOP CALLER ",
"object": "730000000000000000000000000000000000000000301460806040525f80fdfea2646970667358221220ce6f0606c567908e8ecea65fc676cb30d37f1318b889949696be20675d9b73b864736f6c63430008160033",
"opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xCE PUSH16 0x606C567908E8ECEA65FC676CB30D37F SGT XOR 0xB8 DUP10 SWAP5 SWAP7 SWAP7 0xBE KECCAK256 PUSH8 0x5D9B73B864736F6C PUSH4 0x43000816 STOP CALLER ",
"sourceMap": "1128:5104:0:-:0;;;;;;;;"
},
"gasEstimates": {
"creation": {
"codeDepositCost": "17200",
"executionCost": "103",
"totalCost": "17303"
"codeDepositCost": "17000",
"executionCost": "96",
"totalCost": "17096"
},
"internal": {
"P1()": "infinite",
Expand Down
4 changes: 2 additions & 2 deletions contracts/artifacts/Pairing_metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compiler": {
"version": "0.8.7+commit.e28d00a7"
"version": "0.8.22+commit.4fc1097e"
},
"language": "Solidity",
"output": {
Expand All @@ -20,7 +20,7 @@
"compilationTarget": {
"contracts/Verifier.sol": "Pairing"
},
"evmVersion": "london",
"evmVersion": "shanghai",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
Expand Down
35,334 changes: 22,709 additions & 12,625 deletions contracts/artifacts/Remix.json

Large diffs are not rendered by default.

Loading

0 comments on commit edd1a42

Please sign in to comment.