-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AssetManager Contract #1
Conversation
We can remove all boilerplates and auto-generated files. This includes |
chaincode/contracts/AssetManager.sol
Outdated
return _allowances[owner][spender]; | ||
} | ||
|
||
function approve(address spender, uint256 amount) public returns (bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to be access-controlled and respect limits
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this needs access control (anyone can approve amounts for themselves (msg.sender)).
Will add in limit check.
I think we will need multiple operators to allow the server serving multiple SMS commands at the same time. This is similar to the problem with relayer in https://github.com/polymorpher/one-wallet . We could consider using https://docs.openzeppelin.com/contracts/2.x/access-control#role-based-access-control , or just to keep it simple and expand operator into an array |
chaincode/test/AssetManager.ts
Outdated
// let snapshotId: string; | ||
|
||
describe("AssetManager", function (this) { | ||
before(async function (this) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this
referring to a context variables passed in by Mocha? It conflicts with this
internal variable of the function. Also conflicts with the outer variable this
(which also conflicts with the outer function's internal variable)
chaincode/test/utilities/index.ts
Outdated
} | ||
|
||
export async function deploy(thisObject: Mocha.Context, contracts: any[][]) { | ||
for (const i in contracts) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const contract of contracts
All looks good. Aside from minor things commented above, the token transfer tests are missing some balance checks and event emission checks. I will re-run some tests when you add them |
I have these test failures:
After they are fixed I can merge the PR |
I will also make a note here that later we should probably also remove yarn.lock from all folders in the repository per discussion here yarnpkg/yarn#1583 . I am also concerned that specific versions pointed in yarn.lock may unknowingly carry malware (as recent large scale exploits and hacks have shown). So far packages we used and installed seem to be safe. I checked each package and their dependencies one by one |
Additional note
|
When running
Investigating workarounds
I added in hardhat-contract-sizer
without optimization it shows
And
Will leave optimizer enabled If we have issues with deploy then we can revisit. |
Is there some flexibilities in the parameters for deploying proxy-upgradeable contracts? Rather than having OpenZepplin to manage everything and hide all the details in obscure local JSON files, ideally we want to keep the address of the proxy, the logic contract's address, and the storage contract's address in some config or environment files, and just load them at times of management / deployment.
|
Optimizers may get rid of the extra storage slots allocated by the upgradeable contracts (__gap), which are reserved for upgrading logic contracts. I noticed each inherited upgradeable made their own allocation. It is probably not efficient and we may need to allocate our own __gap. Can you check OpenZepplin documentations and developers discussions and see if is some consensus on the recommended way of resolving these issues? |
This first PR is at a logical point to be Merged the Todo items and clarifications have been documented in Issue #3 and can be worked on separately.
ToDo
require
,modifiers
andpausable
functionsyarn.lock
to gitIgnore comments hereOutstanding Issues/Clarifications
Done
Decision: withdrawal logic does not effect authorizations (logic above removed)
Clarifications also added in the SMS Wallet Design Document
transfer: users will transfer the ERC20/721/1155 tokens to the AssetManager contract and then the owner of the AssetManager contract can send these tokens on the users behalf.operatorThreshold
when adding and removing operators.env
,.env.example
andconfig.js
AssetManager.sol