Tech interview smart contracts coding problem – 技术面试智能合约编码问题区块链毕设代写

区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,Tech interview smart contracts coding problem – 技术面试智能合约编码问题区块链毕设代写 是一篇很好的国外资料

Tech interview smart contracts coding problem

This is a Solidity coding problem for Nayms tech interviews. It is designed to take no more than a few hours.

Getting setup

Ensure you have installed:

  • NodeJS 14+
  • Yarn (install using npm i -g yarn)

Instructions

Part 1: Setup

Clone the repo locally and install the NPM dependencies using:

yarn

Part 2: Complete the task

The contracts consist of a mintable ERC-20 Token (which is similar to a Wrapped ETH token). Callers mint tokens by depositing ETH. They can then burn their token balance to get the equivalent amount of deposited ETH back.

In addition, token holders can receive dividend payments in ETH in proportion to their token balance relative to the total supply. Dividends are assigned by looping through the list of holders.

Dividend payments are assigned to token holders’ addresses. This means that even if a token holder were to send their tokens to somebody else later on or burn their tokens, they would still be entitled to the dividends they accrued whilst they were holding the tokens.

You will thus need to efficiently keep track of individual token holder addresses in order to assign dividend payouts to holders with minimal gas cost.

For a clearer understanding of how the code is supposed to work please refer to the tests in the test folder.

You only need to write code in the Token.sol file. The task is complete once all the unit tests pass successfully.

Part 3: BONUS!

The dividends payment process requires looping through token holders. If the no. of holders is very large (e.g. >1000) it’s likely that the recordDividend() method will fail (due to out-of-gas error). Come up with another way of paying dividends that does not suffer from this issue.

Outline in writing (or code!) how you would do things differently. Create a Token2.sol file with your new code and add new unit tests too if you like!

Part 4: Send us your code

Please publish your code to a new private Github repository and give us (@hiddentao, @melks) read-only permissions to it.

Commands

  • yarn devnet – run a local ganache instance to deploy the contracts to (we recommend keeping this running form the start in a separate tab)
  • yarn compile – compile the code
  • yarn test – run the tests
  • yarn deploy – deploy compiled code to local testnet (in case you want to use Remix, etc)

License

MIT

All tests passed


技术面试智能合同编码问题

这是Nayms技术面试的一个可靠编码问题。设计的时间不超过几个小时

获取设置

确保已安装:

  • NodeJS 14+
  • 纱线(使用npm i-g纱线安装)

说明

第1部分:设置

本地克隆回购协议,并使用安装NPM依赖项:

yarn

第3部分:奖金

合同由可铸造ERC-20令牌(类似于包装ETH令牌)组成。呼叫者通过存入ETH铸造代币。然后,他们可以烧掉代币余额,取回等量的ETH存款

此外,代币持有人可以按照代币余额相对于总供给的比例,以ETH的形式获得股息支付。股息是通过循环排列持有人名单来分配的

股息支付分配给代币持有人的地址。这意味着,即使代币持有人稍后将代币发送给其他人或烧掉代币,他们仍有权获得持有代币时累积的股息

因此,您需要有效地跟踪各个代币持有人的地址,以便以最低的天然气成本将股息支付分配给持有人

要更清楚地了解代码应该如何工作,请参阅测试文件夹中的测试

您只需要在Token.sol文件中编写代码。一旦所有单元测试成功通过,任务就完成了

第4部分:向我们发送您的代码

股息支付流程需要通过代币持有人进行循环。如果持有人数量非常大(例如,>1000)RecordRedirement()方法可能会失败(由于气体不足错误)。想出另一种支付股息的方式,而不受这个问题的影响

书面提纲(或代码!)你会如何做不同的事情。使用新代码创建一个Token2.sol文件,如果愿意,还可以添加新的单元测试

命令

请将您的代码发布到一个新的私有Github存储库,并向我们授予(@hiddentao,@melks)只读权限

许可证

  • 纱线开发网-运行本地ganache实例以部署合同(我们建议将此运行形式保留在单独的选项卡中)
  • 纱线编译-编译代码
  • 纱线测试-运行测试
  • 纱线部署-将编译后的代码部署到本地testnet(如果您想使用混音等)

License

MIT

All tests passed

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/23962.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » Tech interview smart contracts coding problem – 技术面试智能合约编码问题区块链毕设代写

提供最优质的资源集合

立即查看 了解详情