feat: remove voucher mints

This commit is contained in:
Mohamed Sohail 2024-10-05 12:19:49 +03:00
parent c030094897
commit 1a2a1f4232
Signed by: kamikazechaser
GPG Key ID: 7DD45520C01CD85D
5 changed files with 53 additions and 184 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,158 +1,9 @@
[ [{"inputs":[{"internalType":"address","name":"_ethFaucetAddress","type":"address"},{"internalType":"address","name":"_custodialAccountIndexAddress","type":"address"},{"internalType":"address","name":"_systemAccount","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"subject","type":"address"}],"name":"NewRegistration","type":"event"},{"inputs":[],"name":"CustodialAccountIndex","outputs":[{"internalType":"contract ICustodialAccountIndex","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EthFaucet","outputs":[{"internalType":"contract IEthFaucet","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_subject","type":"address"}],"name":"register","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"setNewOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newSystemAccount","type":"address"}],"name":"setNewSystemAccount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"systemAccount","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
{
"inputs": [ ======= CustodialRegistrationProxy.sol:ICustodialAccountIndex =======
{ Contract JSON ABI
"internalType": "address", [{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"add","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
"name": "_ethFaucetAddress",
"type": "address" ======= CustodialRegistrationProxy.sol:IEthFaucet =======
}, Contract JSON ABI
{ [{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"giveTo","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]
"internalType": "address",
"name": "_custodialAccountIndexAddress",
"type": "address"
},
{
"internalType": "address",
"name": "_trainingVoucherAddress",
"type": "address"
},
{
"internalType": "address",
"name": "_systemAccount",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "subject",
"type": "address"
}
],
"name": "NewRegistration",
"type": "event"
},
{
"inputs": [],
"name": "CustodialAccountIndex",
"outputs": [
{
"internalType": "contract ICustodialAccountIndex",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "EthFaucet",
"outputs": [
{
"internalType": "contract IEthFaucet",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "TrainingVoucher",
"outputs": [
{
"internalType": "contract IDemurrageTokenSingleNocap",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_subject",
"type": "address"
}
],
"name": "register",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_newOwner",
"type": "address"
}
],
"name": "setNewOwner",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_newSystemAccount",
"type": "address"
}
],
"name": "setNewSystemAccount",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "systemAccount",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "trainingVoucerGiftAmount",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
}
]

View File

@ -0,0 +1,9 @@
{"compiler":{"version":"0.8.25+commit.b61c2a91"},"language":"Solidity","output":{"abi":[{"inputs":[{"internalType":"address","name":"_ethFaucetAddress","type":"address"},{"internalType":"address","name":"_custodialAccountIndexAddress","type":"address"},{"internalType":"address","name":"_systemAccount","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"subject","type":"address"}],"name":"NewRegistration","type":"event"},{"inputs":[],"name":"CustodialAccountIndex","outputs":[{"internalType":"contract ICustodialAccountIndex","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EthFaucet","outputs":[{"internalType":"contract IEthFaucet","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_subject","type":"address"}],"name":"register","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"setNewOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newSystemAccount","type":"address"}],"name":"setNewSystemAccount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"systemAccount","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"CustodialRegistrationProxy.sol":"CustodialRegistrationProxy"},"evmVersion":"istanbul","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"CustodialRegistrationProxy.sol":{"keccak256":"0xacb61043b4295ad2d8fc280cb2550fce2f5206e5144f96ee90f1be77c1a537bf","license":"AGPL-3.0-or-later","urls":["bzz-raw://169e16afeb5824560c80949f77f8d08c802e26591797c6c3d1d2fb11b1fe7ebb","dweb:/ipfs/QmTFTUAsuuqxWnJJjxaDzFhXy3wGuBVyAuPjSgcN497hyy"]}},"version":1}
======= CustodialRegistrationProxy.sol:ICustodialAccountIndex =======
Metadata:
{"compiler":{"version":"0.8.25+commit.b61c2a91"},"language":"Solidity","output":{"abi":[{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"add","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"CustodialRegistrationProxy.sol":"ICustodialAccountIndex"},"evmVersion":"istanbul","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"CustodialRegistrationProxy.sol":{"keccak256":"0xacb61043b4295ad2d8fc280cb2550fce2f5206e5144f96ee90f1be77c1a537bf","license":"AGPL-3.0-or-later","urls":["bzz-raw://169e16afeb5824560c80949f77f8d08c802e26591797c6c3d1d2fb11b1fe7ebb","dweb:/ipfs/QmTFTUAsuuqxWnJJjxaDzFhXy3wGuBVyAuPjSgcN497hyy"]}},"version":1}
======= CustodialRegistrationProxy.sol:IEthFaucet =======
Metadata:
{"compiler":{"version":"0.8.25+commit.b61c2a91"},"language":"Solidity","output":{"abi":[{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"giveTo","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"CustodialRegistrationProxy.sol":"IEthFaucet"},"evmVersion":"istanbul","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"CustodialRegistrationProxy.sol":{"keccak256":"0xacb61043b4295ad2d8fc280cb2550fce2f5206e5144f96ee90f1be77c1a537bf","license":"AGPL-3.0-or-later","urls":["bzz-raw://169e16afeb5824560c80949f77f8d08c802e26591797c6c3d1d2fb11b1fe7ebb","dweb:/ipfs/QmTFTUAsuuqxWnJJjxaDzFhXy3wGuBVyAuPjSgcN497hyy"]}},"version":1}

View File

@ -1,26 +1,20 @@
// SPDX-License-Identifier: AGPL-3.0-or-later // SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity >= 0.8.19; pragma solidity >=0.8.19;
interface IEthFaucet { interface IEthFaucet {
function giveTo(address _recipient) external returns(uint256); function giveTo(address _recipient) external returns (uint256);
} }
interface ICustodialAccountIndex { interface ICustodialAccountIndex {
function add(address _account) external returns (bool); function add(address _account) external returns (bool);
} }
interface IDemurrageTokenSingleNocap {
function mintTo(address _beneficiary, uint256 _amount) external returns (bool);
}
contract CustodialRegistrationProxy { contract CustodialRegistrationProxy {
address public owner; address public owner;
address public systemAccount; address public systemAccount;
uint256 public constant trainingVoucerGiftAmount = 5000000;
IEthFaucet public EthFaucet; IEthFaucet public EthFaucet;
ICustodialAccountIndex public CustodialAccountIndex; ICustodialAccountIndex public CustodialAccountIndex;
IDemurrageTokenSingleNocap public TrainingVoucher;
event NewRegistration(address indexed subject); event NewRegistration(address indexed subject);
@ -34,36 +28,31 @@ contract CustodialRegistrationProxy {
_; _;
} }
constructor(address _ethFaucetAddress, address _custodialAccountIndexAddress, address _trainingVoucherAddress, address _systemAccount) { constructor(
address _ethFaucetAddress,
address _custodialAccountIndexAddress,
address _systemAccount
) {
owner = msg.sender; owner = msg.sender;
systemAccount = _systemAccount; systemAccount = _systemAccount;
EthFaucet = IEthFaucet(_ethFaucetAddress); EthFaucet = IEthFaucet(_ethFaucetAddress);
CustodialAccountIndex = ICustodialAccountIndex(_custodialAccountIndexAddress); CustodialAccountIndex = ICustodialAccountIndex(
TrainingVoucher = IDemurrageTokenSingleNocap(_trainingVoucherAddress); _custodialAccountIndexAddress
);
} }
function setNewOwner(address _newOwner) function setNewOwner(address _newOwner) public ownerOnly {
public
ownerOnly
{
owner = _newOwner; owner = _newOwner;
} }
function setNewSystemAccount(address _newSystemAccount) function setNewSystemAccount(address _newSystemAccount) public ownerOnly {
public
ownerOnly
{
systemAccount = _newSystemAccount; systemAccount = _newSystemAccount;
} }
function register(address _subject) function register(address _subject) public systemAccountOnly {
public
systemAccountOnly
{
CustodialAccountIndex.add(_subject); CustodialAccountIndex.add(_subject);
EthFaucet.giveTo(_subject); EthFaucet.giveTo(_subject);
TrainingVoucher.mintTo(_subject, trainingVoucerGiftAmount);
emit NewRegistration(_subject); emit NewRegistration(_subject);
} }
} }

13
solidity/Makefile Normal file
View File

@ -0,0 +1,13 @@
SOLC = solc
all:
$(SOLC) CustodialRegistrationProxy.sol --abi --evm-version istanbul | awk 'NR>3' > CustodialRegistrationProxy.json
$(SOLC) CustodialRegistrationProxy.sol --bin --evm-version istanbul | awk 'NR>3' > CustodialRegistrationProxy.bin
$(SOLC) CustodialRegistrationProxy.sol --metadata --evm-version istanbul | awk 'NR>3' > CustodialRegistrationProxy.metadata.json
truncate -s -1 CustodialRegistrationProxy.bin
install: all
cp -v *.json ../custodial_registration_proxy/data/
cp -v *.bin ../custodial_registration_proxy/data/
.PHONY: install