From 575b0695e35f0812e44e0132bedf859ea427c68e Mon Sep 17 00:00:00 2001 From: Aleksey Bykhun Date: Thu, 22 Sep 2022 17:34:20 +0200 Subject: [PATCH 1/8] add members view --- abi/contracts/SafeStream.sol/SafeStream.json | 13 ++++++++++++ contracts/SafeStream.sol | 21 ++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/abi/contracts/SafeStream.sol/SafeStream.json b/abi/contracts/SafeStream.sol/SafeStream.json index 25ebdfd..246f383 100644 --- a/abi/contracts/SafeStream.sol/SafeStream.json +++ b/abi/contracts/SafeStream.sol/SafeStream.json @@ -82,6 +82,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "membersList", + "outputs": [ + { + "internalType": "string[]", + "name": "member_info", + "type": "string[]" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { diff --git a/contracts/SafeStream.sol b/contracts/SafeStream.sol index e18c584..52531fa 100644 --- a/contracts/SafeStream.sol +++ b/contracts/SafeStream.sol @@ -75,6 +75,27 @@ contract SafeStream is Initializable { return _members; } + function membersList() external view returns (string[] memory member_info) { + // read all members and return as string array + member_info = new string[](_members.length); + + for (uint i = 0; i < _members.length; i++) { + Member memory member = _members[i]; + + member_info[i] = string( + abi.encodePacked( + member.account, + ": ", + member.value, + " of ", + (member.total) + ) + ); + } + + return member_info; + } + function _calculateGasCap() internal view returns (uint) { if (_cap != 0) { return _cap; From c415593558d7b083f6d042261e74e955313e5483 Mon Sep 17 00:00:00 2001 From: Aleksey Bykhun Date: Fri, 23 Sep 2022 17:25:08 +0200 Subject: [PATCH 2/8] deploy to goerli --- deployments/goerli.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 deployments/goerli.json diff --git a/deployments/goerli.json b/deployments/goerli.json new file mode 100644 index 0000000..f51dae3 --- /dev/null +++ b/deployments/goerli.json @@ -0,0 +1 @@ +{"address":"0x2E63E9556709d8650061a077b9F6850be9b21E44"} \ No newline at end of file From 9e64ee7d3bb9e8c15907ffd9c57d73b55e951603 Mon Sep 17 00:00:00 2001 From: Aleksey Bykhun Date: Fri, 23 Sep 2022 17:42:29 +0200 Subject: [PATCH 3/8] fix address output --- contracts/SafeStream.sol | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contracts/SafeStream.sol b/contracts/SafeStream.sol index 55fe088..9478e43 100644 --- a/contracts/SafeStream.sol +++ b/contracts/SafeStream.sol @@ -54,6 +54,7 @@ pragma solidity ^0.8.4; import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; +import "@openzeppelin/contracts/utils/Strings.sol"; import "hardhat/console.sol"; contract SafeStream is Initializable { @@ -118,7 +119,7 @@ contract SafeStream is Initializable { member_info[i] = string( abi.encodePacked( - member.account, + Strings.toHexString(uint160(member.account), 20), ": ", member.value, " of ", From 4a0ec27ad01c1b00b6a1d7250dc330ead1c2979d Mon Sep 17 00:00:00 2001 From: Aleksey Bykhun Date: Fri, 23 Sep 2022 17:43:21 +0200 Subject: [PATCH 4/8] re-deploy goerli --- deployments/goerli.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployments/goerli.json b/deployments/goerli.json index f51dae3..cfa807d 100644 --- a/deployments/goerli.json +++ b/deployments/goerli.json @@ -1 +1 @@ -{"address":"0x2E63E9556709d8650061a077b9F6850be9b21E44"} \ No newline at end of file +{"address":"0x1C4663902A55A8346B5bD1131d7405A3513944fD"} \ No newline at end of file From f8d1fa20b0f83edbc52b1c3a46b729e823a6e428 Mon Sep 17 00:00:00 2001 From: Aleksey Bykhun Date: Fri, 23 Sep 2022 17:45:27 +0200 Subject: [PATCH 5/8] fix numbers in member list and re-deploy goerli --- contracts/SafeStream.sol | 4 ++-- deployments/goerli.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/SafeStream.sol b/contracts/SafeStream.sol index 9478e43..a41f89f 100644 --- a/contracts/SafeStream.sol +++ b/contracts/SafeStream.sol @@ -121,9 +121,9 @@ contract SafeStream is Initializable { abi.encodePacked( Strings.toHexString(uint160(member.account), 20), ": ", - member.value, + Strings.toString(member.value), " of ", - (member.total) + Strings.toString(member.total) ) ); } diff --git a/deployments/goerli.json b/deployments/goerli.json index cfa807d..daa02ae 100644 --- a/deployments/goerli.json +++ b/deployments/goerli.json @@ -1 +1 @@ -{"address":"0x1C4663902A55A8346B5bD1131d7405A3513944fD"} \ No newline at end of file +{"address":"0xf49fe95EC82E78AF89Cc4Ee667879a3004BF982C"} \ No newline at end of file From da24712e741c6dc470d3df4604c99e3f1634ebb9 Mon Sep 17 00:00:00 2001 From: Aleksey Bykhun Date: Fri, 23 Sep 2022 17:50:48 +0200 Subject: [PATCH 6/8] re-deploy goerli --- contracts/SafeStream.sol | 2 +- deployments/goerli.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/SafeStream.sol b/contracts/SafeStream.sol index a41f89f..4250933 100644 --- a/contracts/SafeStream.sol +++ b/contracts/SafeStream.sol @@ -122,7 +122,7 @@ contract SafeStream is Initializable { Strings.toHexString(uint160(member.account), 20), ": ", Strings.toString(member.value), - " of ", + "/", Strings.toString(member.total) ) ); diff --git a/deployments/goerli.json b/deployments/goerli.json index daa02ae..dd5135a 100644 --- a/deployments/goerli.json +++ b/deployments/goerli.json @@ -1 +1 @@ -{"address":"0xf49fe95EC82E78AF89Cc4Ee667879a3004BF982C"} \ No newline at end of file +{"address":"0xf6F5F6f07EDEc52EFfd5a79647FD6F420b9bD838"} \ No newline at end of file From 9c0223d6ffa1cb936e23ae4de45430740f5c97eb Mon Sep 17 00:00:00 2001 From: "theshad.eth" Date: Fri, 23 Sep 2022 18:51:19 +0200 Subject: [PATCH 7/8] fix ascii art --- contracts/SafeStream.sol | 78 +++++++++++++--------------------------- 1 file changed, 25 insertions(+), 53 deletions(-) diff --git a/contracts/SafeStream.sol b/contracts/SafeStream.sol index 4250933..5bbc3af 100644 --- a/contracts/SafeStream.sol +++ b/contracts/SafeStream.sol @@ -1,58 +1,30 @@ -///////////////////////////////////////////////////////////////////////////////////// -// -// SPDX-License-Identifier: MIT -// -///////////////////////////////////////////////////////////////////////////////////// -// SafeStream by buildship.xyz -///////////////////////////////////////////////////////////////////////////////////// -// ,:loxO0KXXc -// ,cdOKKKOxol:lKWl -// ;oOXKko:, ;KNc -// 'ox0X0d: cNK, -// ',' ;xXX0x: dWk -// ,cdO0KKKKKXKo, ,0Nl -// ;oOXKko:,;kWMNl dWO' -// ,o0XKd:' oNMMK: cXX: -// 'ckNNk: ;KMN0c cXXl -// 'OWMMWKOdl;' cl; oXXc -// ;cclldxOKXKkl, ;kNO; -// ;cdk0kl' ;clxXXo -// ':oxo' c0WMMMMK; -// :l: lNMWXxOWWo -// '; :xdc' :XWd -// , cXK; -// ':, xXl -// ;: ' o0c -// ;c;,,,,' lx; -// ''' cc -// ,' -// -// ██████  ██  ██ ██ ██  ██████  ███████ ██  ██ ██ ██████ -// ██   ██ ██  ██ ██ ██  ██   ██ ██      ██  ██ ██ ██   ██ -// ██████  ██  ██ ██ ██  ██  ██ ███████ ███████ ██ ██████ -// ██   ██ ██  ██ ██ ██  ██  ██      ██ ██   ██ ██ ██ -// ██████   ██████  ██ ███████ ██████  ███████ ██  ██ ██ ██ -// -// based on -///////////////////////////////////////////////////////////////////////////////////// -// -// ███  ███  ██████  ███  ██ ███████ ██  ██ ██████  ██ ██████  ███████ -// ████  ████ ██    ██ ████  ██ ██       ██  ██  ██   ██ ██ ██   ██ ██ -// ██ ████ ██ ██  ██ ██ ██  ██ █████   ████   ██████  ██ ██████  █████ -// ██  ██  ██ ██  ██ ██  ██ ██ ██      ██   ██      ██ ██      ██ -// ██      ██  ██████  ██   ████ ███████  ██  ██  ██ ██  ███████ -// -// ███████ ████████ ██████  ███████  █████  ███  ███ -// ██         ██    ██   ██ ██      ██   ██ ████  ████ -// ███████  ██  ██████  █████  ███████ ██ ████ ██ -//      ██  ██  ██   ██ ██     ██   ██ ██  ██  ██ -// ███████  ██  ██  ██ ███████ ██  ██ ██      ██ -// -// https://moneypipe.xyz -// -///////////////////////////////////////////////////////////////////////////////////// +// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; +////////////////////////////////////////////////////////////////////////////////////// +// // +// SafeStream by buildship.xyz // +// // +////////////////////////////////////////////////////////////////////////////////////// +// // +// ██████  ██  ██ ██ ██  ██████  ███████ ██  ██ ██ ██████ // +// ██   ██ ██  ██ ██ ██  ██   ██ ██      ██  ██ ██ ██   ██ // +// ██████  ██  ██ ██ ██  ██  ██ ███████ ███████ ██ ██████ // +// ██   ██ ██  ██ ██ ██  ██  ██      ██ ██   ██ ██ ██ // +// ██████   ██████  ██ ███████ ██████  ███████ ██  ██ ██ ██ // +// // +// contract based on // +// // +// ███  ███  ██████  ███  ██ ███████ ██  ██ ██████  ██ ██████  ███████ // +// ████  ████ ██    ██ ████  ██ ██       ██  ██  ██   ██ ██ ██   ██ ██ // +// ██ ████ ██ ██  ██ ██ ██  ██ █████   ████   ██████  ██ ██████  █████ // +// ██  ██  ██ ██  ██ ██  ██ ██ ██      ██   ██      ██ ██      ██ // +// ██      ██  ██████  ██   ████ ███████  ██  ██  ██ ██  ███████ // +// // +// https://moneypipe.xyz // +// // +////////////////////////////////////////////////////////////////////////////////////// + import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "hardhat/console.sol"; From 21422b51875375d9e2d05587a978a5d1bce0fd4d Mon Sep 17 00:00:00 2001 From: Aleksey Bykhun Date: Fri, 23 Sep 2022 20:08:28 +0200 Subject: [PATCH 8/8] deploy goerli --- deployments/goerli.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployments/goerli.json b/deployments/goerli.json index dd5135a..4887dda 100644 --- a/deployments/goerli.json +++ b/deployments/goerli.json @@ -1 +1 @@ -{"address":"0xf6F5F6f07EDEc52EFfd5a79647FD6F420b9bD838"} \ No newline at end of file +{"address":"0x18435835a395e2d9cf824966D9ffA5B46A360B4f"} \ No newline at end of file